cassandra集群部署

    在国内cassandra感觉用的人不多,资料也比较少,一查全是hbase和mongodb等no sql的资料,比起国外,cassandra确实要活跃的多。说起来,cassandra集群部署非常简单,虽然比起elastic search和redis稍微麻烦一点点,但是比起hbase和mongodb 的集群部署,真是简单多了。

    首先准备机器,我这里准备三台,192.168.1.100/101/102。用100作为seed机器。首先配置100上的cassandra。打开conf/cassandra.yaml。修改3个地方:

    1.listen_address: 192.168.1.100

    2.rpc_address: 192.168.1.100

    3.seed_provider:

    # Addresses of hosts that are deemed contact points. 

    # Cassandra nodes use this list of hosts to find each other and learn

    # the topology of the ring.  You must change this if you are running

    # multiple nodes!

    - class_name: org.apache.cassandra.locator.SimpleSeedProvider

      parameters:

          # seeds is actually a comma-delimited list of addresses.

          # Ex: "<ip1>,<ip2>,<ip3>"

          - seeds: "192.168.1.100"

    然后把配置好的cassandra目录拷贝到101和102,

    $> scp -r apache-cassandra-x.y.z 192.168.1.101

    $> scp -r apache-cassandra-x.y.z 192.168.1.102

    修改101和102上的部分配置,只需要修改1和2两个地方,也就是:listen_address和rpc_address修改为自己的ip,第3个地方,seed_provider不需要修改。然后启动100/101/102。启动成功以后,使用nodetool查看集群状态。

 $> bin/nodetool status

 #########################################################################################

 里面就一个seed配置需要注意,seed意思是种子,在这里意思就相当于种子节点,用来发现节点的,然后把他们加入集群。实际上就是每台机器cassandra启动以后,会和自己配置的seed机器通信,seed节点就把它加入集群配置中去。

猜你喜欢

转载自kibear.iteye.com/blog/2338620