Cassandra CQLsh代表 Cassandra CQL shell。CQLsh 指定如何使用 Cassandra 命令。安装后,Cassandra 提供了一个提示 Cassandra 查询语言 shell(cqlsh)。它有助于用户与之通信。
Cassandra 命令在 CQLsh 上执行。看起来像这样:
启动 CQLsh:
D:\software\apache-cassandra-3.10\bin>cqlsh
WARNING: console codepage must be set to cp65001 to support utf-8 encoding on Windows platforms.
If you experience encoding problems, change your console codepage with 'chcp 65001' before starting cqlsh.
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.10 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
WARNING: pyreadline dependency missing. Install to enable tab completion.
cqlsh>
CQLsh 提供了很多选项,在下表中是一些常用的命令:
选项 | 使用/作用 |
---|---|
help | 此命令用于显示有关 CQLsh 命令选项的帮助主题。 |
version | 它用于查看您正在使用的 CQLsh 的版本。 |
color | 它用于彩色输出。 |
debug | 它显示其他调试信息。 |
execute | 它用于引导 shell 接受并执行 CQL 命令。 |
file= “file name” | 通过使用此选项,cassandra 将在给定文件中执行命令并退出。 |
no-color | 它指示 Cassandra 不使用彩色输出。 |
u “username” | 使用此选项可以验证用户。默认用户名为:cassandra 。 |
p “password” | 使用此选项,您可以使用密码验证用户。默认密码是:cassandra 。 |