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.

  • 相关阅读:
    金蝶报错事项
    ROS的脚本多拨
    zabbix4.0 相关的拓扑图及centos的虚拟配置
    ros开启快速转发模式
    linux 配置 l2tp-client
    linux 系统管理 实战技巧
    Flunetd 用于统一日志记录层的开源数据收集器
    在Centos7 更改Docker默认镜像和容器的位置
    Supervisor: 进程控制系统
    如何用正确的姿势查看 主机系统的CPU信息
  • 原文地址:https://www.cnblogs.com/macula7/p/1960440.html
Copyright © 2011-2022 走看看