Cassandra : java.lang.RuntimeException: Unable to gossip with any peers

If  you are getting below exception while setting up Cassandra cluster, please follow below steps to resolve the issue. Here, I’ve described to setup 3 node cluster.


Exception <span class="token punctuation">(</span>java.lang.RuntimeException<span class="token punctuation">)</span> 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<span class="token punctuation">(</span>Gossiper.java:1443<span class="token punctuation">)</span>
        at org.apache.cassandra.service.StorageService.checkForEndpointCollision<span class="token punctuation">(</span>StorageService.java:547<span class="token punctuation">)</span>
        at org.apache.cassandra.service.StorageService.prepareToJoin<span class="token punctuation">(</span>StorageService.java:804<span class="token punctuation">)</span>
        at org.apache.cassandra.service.StorageService.initServer<span class="token punctuation">(</span>StorageService.java:664<span class="token punctuation">)</span>
        at org.apache.cassandra.service.StorageService.initServer<span class="token punctuation">(</span>StorageService.java:613<span class="token punctuation">)</span>
        at org.apache.cassandra.service.CassandraDaemon.setup<span class="token punctuation">(</span>CassandraDaemon.java:379<span class="token punctuation">)</span>
        at org.apache.cassandra.service.CassandraDaemon.activate<span class="token punctuation">(</span>CassandraDaemon.java:602<span class="token punctuation">)</span>
        at org.apache.cassandra.service.CassandraDaemon.main<span class="token punctuation">(</span>CassandraDaemon.java:691<span class="token punctuation">)</span>

Below are the configuration changes you need to make on cassandra.yaml file

First Node
--------------
listen_address: 192.168.1.143 <span class="token punctuation">(</span>This should be your server/node IP<span class="token punctuation">)</span>
seeds: <span class="token string">"192.168.1.143"</span> <span class="token punctuation">(</span>For your first node please mention your node IP address<span class="token punctuation">)</span>

Second Node
---------------
listen_address: 192.168.1.144 <span class="token punctuation">(</span>This should be your server/node IP<span class="token punctuation">)</span>
seeds: <span class="token string">"192.168.1.143"</span> <span class="token punctuation">(</span>specify your first node IP, additionally, you can also mention current IP address ,192.168.1.144<span class="token punctuation">)</span>

Third Node
---------------
listen_address: 192.168.1.145 <span class="token punctuation">(</span>This should be your server/node IP<span class="token punctuation">)</span>
seeds: <span class="token string">"192.168.1.143"</span> <span class="token punctuation">(</span>specify your first/second node IP, additionally, you can also mention current IP address ,192.168.1.145<span class="token punctuation">)</span>

After starting cassandra on all 3 servers, nodetool status returned the following

Datacenter: datacenter1
<span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">=</span>
Status<span class="token operator">=</span>Up/Down
<span class="token operator">|</span>/ State<span class="token operator">=</span>Normal/Leaving/Joining/Moving
--  Address        Load       Tokens       Owns <span class="token punctuation">(</span>effective<span class="token punctuation">)</span>  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

NNK

SparkByExamples.com is a Big Data and Spark examples community page, all examples are simple and easy to understand and well tested in our development environment Read more ..

Leave a Reply