Cassandra多节点群集设置问题(例如3个节点)

时间:2018-12-30 07:02:38

标签: cassandra cassandra-3.0

当我尝试运行单节点或多节点Cassandra群集时,我一直遇到以下错误。

具有默认配置的单节点群集可以正常工作,但是nodetool staus显示127.0.0.1作为IP地址。

在cassandra.yaml文件上更改listen_address:192.168.1.143(这是我的IP地址)后,我得到以下错误。

Exception (java.lang.RuntimeException) encountered during startup: Unable to gossip with any peers
java.lang.RuntimeException: Unable to gossip with any peers
        at org.apache.cassandra.gms.Gossiper.doShadowRound(Gossiper.java:1443)
        at org.apache.cassandra.service.StorageService.checkForEndpointCollision(StorageService.java:547)
        at org.apache.cassandra.service.StorageService.prepareToJoin(StorageService.java:804)
        at org.apache.cassandra.service.StorageService.initServer(StorageService.java:664)
        at org.apache.cassandra.service.StorageService.initServer(StorageService.java:613)
        at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:379)
        at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:602)
        at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:691)

2 个答案:

答案 0 :(得分:0)

好吧,在尝试了不同的方法之后,我终于能够解决它并能够运行单节点和3节点集群。

以下是您需要对cassandra.yaml文件进行的配置更改

First Node
--------------
listen_address: 192.168.1.143 (This should be your server/node IP)
seeds: "192.168.1.143" (For your first node please mention your node IP address)

Second Node
---------------
listen_address: 192.168.1.144 (This should be your server/node IP)
seeds: "192.168.1.143" (specify your first node IP, additionally, you can also mention current IP address ,192.168.1.144)

Third Node
---------------
listen_address: 192.168.1.145 (This should be your server/node IP)
seeds: "192.168.1.143" (specify your first/second node IP, additionally, you can also mention current IP address ,192.168.1.145)

在所有3台服务器上启动cassandra之后,nodetool状态返回以下信息

Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address        Load       Tokens       Owns (effective)  Host ID                               Rack
UN  192.168.1.143  258.83 KiB  256          100.0%            7b3a0644-c8dd-4a47-9186-0237f3725941  rack1
UN  192.168.1.144  309.71 KiB  256          100.0%            e7a11a60-d795-47ee-8d21-7cc21b4cbdca  rack1
UN  192.168.1.145  309.71 KiB  256          100.0%            b2a4545a-f279-r5h7-2fy6-23dk8fg5c8kq  rack1

希望这会有所帮助!

答案 1 :(得分:0)

是的,第一次加入cassandra集群。您应该先启动种子节点,然后再启动其他节点。