CQL for Apache Cassandra

Using tab completion

You can use tab completion to see hints about how to complete a cqlsh command. Some platforms, such as Mac OSX, do not ship with tab completion installed. You can use easy_install to install tab completion capabilities on Mac OSX:

pip install readline

List keyspace

show all current key spaces.

SELECT * FROM system_schema.keyspaces ;

Set password authenticator

  1. modify config/cassandra.yaml, change AllowAllAuthenticator to PasswordAuthenticator.
# authenticator:  AllowAllAuthenticator -> PasswordAuthenticator
authenticator: PasswordAuthenticator
  1. login default user: cassandra, password: cassandra
[root@megvii-redhat] ~/apache-cassandra-3.10
❯ cqlsh -u cassandra -p cassandra ⏎
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.
cassandra@cqlsh>
  1. create a new user's account.
cassandra@cqlsh> create USER megvii WITH PASSWORD 'megvii' SUPERUSER ;
cassandra@cqlsh> exit
[root@megvii-redhat] ~/apache-cassandra-3.10
❯
  1. login with new user, and remove default user.
[root@megvii-redhat] ~/apache-cassandra-3.10
❯ cqlsh -u megvii -p megvii ⏎
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.
megvii@cqlsh> DROP USER cassandra ;
megvii@cqlsh> exit
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容