• Cassandra 安装


    1:下载安装包,解压

    2:进入目录,输入命令: bin/cassandra -f

    报错,大体的意思是log4j setFile Error FileNotFound...

    检查错误找到原因:未使用管理员用户登录,因为有的文件不存在,用户无权限创建需要的文件。改用管理员登录后,问题解决。

    3:启动正常

    4:使用CLI方式登录

    [nosql@onlinemad-desktop bin]#./cassandra-cli -host 127.0.0.1 -port 9160
    Connected to localhost/9160
    Welcome to cassandra CLI.

    Type 'help' or '?' for help. Type 'quit' or 'exit' to quit.
    cassandra>

    帮助命令:

    cassandra> help
    List of all CLI commands:
    ?                                                                  Same as help.
    help                                                          Display this help.
    connect <hostname>/<port>                             Connect to thrift service.
    describe keyspace <keyspacename>                              Describe keyspace.
    exit                                                                   Exit CLI.
    quit                                                                   Exit CLI.
    show config file                                Display contents of config file.
    show cluster name                                          Display cluster name.
    show keyspaces                                           Show list of keyspaces.
    show version                                                Show server version.
    get <ksp>.<cf>['<key>']                                  Get a slice of columns.
    get <ksp>.<cf>['<key>']['<super>']                   Get a slice of sub columns.
    get <ksp>.<cf>['<key>']['<col>']                             Get a column value.
    get <ksp>.<cf>['<key>']['<super>']['<col>']              Get a sub column value.
    set <ksp>.<cf>['<key>']['<col>'] = '<value>'                       Set a column.
    set <ksp>.<cf>['<key>']['<super>']['<col>'] = '<value>'        Set a sub column.
    del <ksp>.<cf>['<key>']                                           Delete record.
    del <ksp>.<cf>['<key>']['<col>']                                  Delete column.
    del <ksp>.<cf>['<key>']['<super>']['<col>']                   Delete sub column.
    count <ksp>.<cf>['<key>']                               Count columns in record.
    count <ksp>.<cf>['<key>']['<super>']            Count columns in a super column

    添加资料:

    cassandra> set Keyspace1.Standard2['jsmith']['first'] = 'John'
    Value inserted.
    cassandra> set Keyspace1.Standard2['jsmith']['last'] = 'Smith'
    Value inserted.
    cassandra> set Keyspace1.Standard2['jsmith']['age'] = '42'
    Value inserted.
    读取资料:

    cassandra> get Keyspace1.Standard2['jsmith']
    => (column=last, value=Smith, timestamp=1259991884091)
    => (column=first, value=John, timestamp=1259991879010)
    => (column=age, value=42, timestamp=1259991135887)
    Returned 3 results.
    cassandra>
    计数:

    cassandra> count Keyspace1.Standard2['jsmith'] 3 columns
    修改:

    cassandra> set Keyspace1.Standard2['jsmith']['age'] = '43'
    Value inserted.

    删除:

    cassandra> del Keyspace1.Standard2['jsmith']
    row removed.

  • 相关阅读:
    (四)自定义多个Realm以及Authenticator与AuthenticationStrategy
    (三)自定义Realm
    (二)shiro之jsp标签
    (一)shiro简介和用户登录demo及角色管理
    解决Cannot change version of project facet Dynamic web module to 2.5(转)
    (十二)easyUI之表单和验证完成登录页面
    (十一)springmvc和spring的整合
    (十)springmvc之文件的处理
    (九)springmvc之json的数据请求(客户端发送json数据到服务端)
    (九)springmvc之json的处理(服务端发送json数据到客户端)
  • 原文地址:https://www.cnblogs.com/macula7/p/1960440.html
Copyright © 2020-2023  润新知