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.

  • 相关阅读:
    Windows下查看dll被哪个进程调用
    mfc笔记之string,wstring,CString
    查看用户主目录
    我看Windows 8 RT
    C# 性能优化之斤斤计较篇 一
    曾经生活过的城市
    大型.NET项目的目录、编译和版本管理实践 四
    大型.NET项目的目录、编译和版本管理实践 五
    大型.NET项目的目录、编译和版本管理实践 二
    大型.NET项目的目录、编译和版本管理实践 一
  • 原文地址:https://www.cnblogs.com/macula7/p/1960440.html
Copyright © 2011-2022 走看看