无法设置Cassandra集群

时间:2017-05-18 07:59:57

标签: cassandra centos6

我在centos 6.9上设置了cassandra集群但不幸的是我无法做到。

cassandra versiion:3.10

运行cassandra -R -f

控制台日志停留在

INFO  [main] 2017-05-18 16:48:50,724 Server.java:156 - Starting listening for CQL clients on /192.168.22.231:9042 (unencrypted)...
INFO  [main] 2017-05-18 16:48:50,788 ThriftServer.java:116 - Binding thrift service to /192.168.22.231:9160
INFO  [Thread-2] 2017-05-18 16:48:50,794 ThriftServer.java:133 - Listening for thrift clients...

debug.log显示以下

    at org.apache.cassandra.net.OutboundTcpConnection.run(OutboundTcpConnection.java:234) [apache-cassandra-3.10.jar:3.10]
DEBUG [MessagingService-Outgoing-/192.168.22.229-Gossip] 2017-05-18 16:54:57,313 OutboundTcpConnection.java:495 - Unable to connect to /192.168.22.229
java.net.NoRouteToHostException: No route to host
        at sun.nio.ch.Net.connect0(Native Method) ~[na:1.8.0_131]
        at sun.nio.ch.Net.connect(Net.java:454) ~[na:1.8.0_131]
        at sun.nio.ch.Net.connect(Net.java:446) ~[na:1.8.0_131]
        at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648) ~[na:1.8.0_131]
        at org.apache.cassandra.net.OutboundTcpConnectionPool.newSocket(OutboundTcpConnectionPool.java:146) ~[apache-cassandra-3.10.jar:3.10]
        at org.apache.cassandra.net.OutboundTcpConnectionPool.newSocket(OutboundTcpConnectionPool.java:132) ~[apache-cassandra-3.10.jar:3.10]
        at org.apache.cassandra.net.OutboundTcpConnection.connect(OutboundTcpConnection.java:397) [apache-cassandra-3.10.jar:3.10]
        at org.apache.cassandra.net.OutboundTcpConnection.run(OutboundTcpConnection.java:234) [apache-cassandra-3.10.jar:3.10]
(END) 

请帮忙。

2 个答案:

答案 0 :(得分:2)

在其他节点的每个节点上打开防火墙。

将这些行添加到每个节点上的/etc/sysconfig/iptables,用相应的IP地址替换NODE #_IP:

-A INPUT -s NODE1_IP -j ACCEPT
-A INPUT -s NODE2_IP -j ACCEPT
-A INPUT -s NODE3_IP -j ACCEPT

然后重启iptables:service iptables restart

答案 1 :(得分:1)

这也可能是防火墙的问题。请尝试停止防火墙并再次测试。对于centos 6,以下命令应该有效。

service iptables stop