cassandra 学习之旅<二> 集群安装

一、环境准备

我这里准备两个节点,192.168.0.101, 192.168.0.102

 

二、安装

分别在192.168.0.101,192.168.0.102上安装,安装步骤如 cassandra 学习之旅<一>

修改conf/cassandra.yaml红色部分IP

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.0.101,192.168.0.102"

 

Java代码   收藏代码
  1. seed_provider 配置说明  
  2. 需要联系的节点地址。Cassandra使用-seeds集合找到其他节点并学习其整个环中的网络拓扑。  
  3. class_name:(默认org.apache.cassandra.locator.SimpleSeedProvider),可用自定义,但通常不必要。  
  4. – seeds:(默认127.0.0.1)逗号分隔的IP列表  

 

 

三、分别在192.168.0.101,192.168.0.102启动节点, cassandra用户

./cassandra -f

可以在192.168.0.101节点上看到如下字样

 

Log代码   收藏代码
  1. INFO  02:57:13 Node /192.168.0.102 is now part of the cluster  
  2. INFO  02:57:13 InetAddress /192.168.0.102 is now UP  

 分别在两个节点上启动cqlsh, 在其中一个节点上执行cql, 在另一个节点上查看结果.如果相同,则证明集群部署成功!

./cqlsh 192.168.0.101

./cqlsh 192.168.0.102

 

也可以执行nodetoo命令查看, 如下

Java代码   收藏代码
  1. ./nodetool status test_1  #keyspace名称  
  2. Datacenter: datacenter1  
  3. =======================  
  4. Status=Up/Down  
  5. |/ State=Normal/Leaving/Joining/Moving  
  6. --  Address      Load       Tokens       Owns (effective)  Host ID                               Rack  
  7. UN  192.168.0.100  406.85 KB  256          50.1%             2ff19d3d-67df-466d-b68b-beefa99b9640  rack1  
  8. UN  192.168.0.101  75.39 KB   256          49.9%             27bf189b-40af-47f8-a25c-6827321d2a72  rack1  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值