zoukankan      html  css  js  c++  java
  • 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.

  • 相关阅读:
    IDEA+SpringMVC+Spring+Mybatis
    WSDL详解
    cxf的使用
    cxf使用wsdl文件生成代码
    给你的博客加上“Fork me on Github”彩带(转)
    老毛桃pe装机工具一键还原系统
    老毛桃pe装机工具备份系统
    java项目中classpath路径到底指的是哪里?
    this.class.getClassLoader().getResourceAsStream与this.class.getResourceAsStream
    Eclipse中导入项目后js报错解决方法(转未解决问题)
  • 原文地址:https://www.cnblogs.com/macula7/p/1960440.html
Copyright © 2011-2022 走看看