Installation from binary tarball files
1、下載下傳最新的穩定版 http://cassandra.apache.org/download/
2、解壓檔案,例如:
tar -xvf apache-cassandra-3.6-bin.tar.gz cassandra
3、
CASSANDRA_HOME=/root/cassandra/apache-cassandra-1.2.5
export PATH=$PATH:$CASSANDRA_HOME/bin
Cassandra 叢集配置
#the name of your cluster
cluster_name: 'Test Cluster'
#逗号分隔的叢集IP位址
parameters: - seeds: "192.168.232.142 "
#一般不用修改這個端口,但是要確定沒有被防火牆屏蔽
storage_port:1234
#監聽,要與seeds一緻,否則提示 java.lang.RuntimeException: Unable to gossip with any seeds 異常
listen_address: 192.168.232.142
#存放data files
data_file_directories: - /var/lib/cassandra/data
#commitlog files
commitlog_directory: /var/lib/cassandra/commitlog
#caches files
saved_caches_directory: /var/lib/cassandra/saved_caches
Cassandra沒有傳統叢集的中心節點,各個節點地位都是平等,通過Gossip協定維持叢集中的節點資訊。為了使叢集中的各節點在啟動時能夠發現其他節點,需要指定種子節點,各節點都先和種子節點通信,通過種子節點擷取其他節點清單,然後和其他節點通信
No appropriate python interpreter found.
出現這個問題的原因是大部分Linux系統自帶的Python版本為2.6,隻有将2.6更新為2.7以上 然後在啟動Cassandra服務,這個時候就可以啟動 cqlsh了
記得要修改/usr/bin/python軟連接配接為2.7版本的位址
$ bin/cqlsh localhost
Connected to Test Cluster at localhost:9042.
[cqlsh 5.0.1 | Cassandra 3.8 | CQL spec 3.4.2 | Native protocol v4]
Use HELP for help.
cqlsh> SELECT cluster_name, listen_address FROM system.local;
cluster_name | listen_address
--------------+----------------
Test Cluster | 127.0.0.1
(1 rows)
cqlsh>