如果使用cassandra的默认配置,只需要修改如下行即可,其他性能参数请参照官方文档。
10 cluster_name: 'My Cluster'
71 hints_directory: /data/cassandra/hints
169 data_file_directories:170 - /data/cassandra/dbdata
175 commitlog_directory: /data/cassandra/commitlog
287 saved_caches_directory: /data/cassandra/caches
343 - seeds: "10.10.8.3,10.10.8.4,10.10.8.5"
473 listen_address: localhost
(4)创建对应的目录
10.10.8.3、10.10.8.4、10.10.8.5
$ mkdir -p /data/cassandra/{dbdata,commitlog,caches,hints}
(5)启动进程
10.10.8.3、10.10.8.4、10.10.8.5
$ /opt/cassandra/bin/cassandra
二:插件工具使用
(1)nodetool工具
nodetool是cassandra的集群和节点的管理和信息查看工具。
$ /opt/cassandra/bin/nodetool
usage: nodetool [(-u <username> | --username <username>)]
[(-pw <password> | --password <password>)]
[(-pwf <passwordFilePath> | --password-file <passwordFilePath>)]
[(-h <host> | --host <host>)] [(-p <port> | --port <port>)] <command> [<args>]
1:查看集群状态
$/opt/cassandra/bin/nodetool status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN 10.10.8.3 304.71 KB 256 68.0% 64b6a935-caa6-4ed5-857b-70963e74a81d rack1
UN 10.10.8.4 173.84 KB 256 65.3% db77bd8a-2655-41c6-b13e-584cf44b8162 rack1
UN 10.10.8.5 297.2 KB 256 66.7% 8fac64f8-1ed9-4ca3-af70-dee9ebcf77c2 rack1
spacer.gif
2:当前节点状态
$/opt/cassandra/bin/nodetool info
ID : db77bd8a-2655-41c6-b13e-584cf44b8162
Gossip active : true
Thrift active : true
Native Transport active: true
Load : 173.84 KB
Generation No : 1478159246
Uptime (seconds) : 4554
Heap Memory (MB) : 297.65 / 7987.25
Off Heap Memory (MB) : 0.00
Data Center : datacenter1
Rack : rack1
Exceptions : 0
Key Cache : entries 14, size 1.08 KB, capacity 100 MB, 110 hits, 127 requests, 0.866 recent hit rate, 14400 save period in seconds
Row Cache : entries 0, size 0 bytes, capacity 0 bytes, 0 hits, 0 requests, NaN recent hit rate, 0 save period in seconds
Counter Cache : entries 0, size 0 bytes, capacity 50 MB, 0 hits, 0 requests, NaN recent hit rate, 7200 save period in seconds
Token : (invoke with -T/--tokens to see all 256 tokens)