美文网首页我爱编程
CQL for Apache Cassandra

CQL for Apache Cassandra

作者: tan_jun | 来源:发表于2017-02-15 11:25 被阅读0次

    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
    

    相关文章

      网友评论

        本文标题:CQL for Apache Cassandra

        本文链接:https://www.haomeiwen.com/subject/caqqwttx.html