`
ivan19861025
  • 浏览: 40984 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

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"

 

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

 

 

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

./cassandra -f

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

 

INFO  02:57:13 Node /192.168.0.102 is now part of the cluster
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命令查看, 如下

./nodetool status test_1  #keyspace名称
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address      Load       Tokens       Owns (effective)  Host ID                               Rack
UN  192.168.0.100  406.85 KB  256          50.1%             2ff19d3d-67df-466d-b68b-beefa99b9640  rack1
UN  192.168.0.101  75.39 KB   256          49.9%             27bf189b-40af-47f8-a25c-6827321d2a72  rack1

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics