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.

  • 相关阅读:
    助你成功:十四个可以运用在任何领域的心理定律
    人生没有“如果…”,二十条经典领悟切莫错过!
    “潜意识”下的奇迹:成功说服的七条法则
    成就你一生的100句名言,改变从今天开始~
    命好不如习惯好!改造我们的习惯领域
    成功从现在开始:改变你一生的七句话
    职业经理人必须牢记六字原则:新、信、行、馨、型、星
    不要害怕自己与众不同:十个成功的秘诀
    价值百万:八个心态和十三个习惯成就成功者!
    代长珍(帮别人名字作诗)
  • 原文地址:https://www.cnblogs.com/macula7/p/1960440.html
Copyright © 2011-2022 走看看