我尝试使用以下节点配置设置2节点cassandra-2.1群集:
Cluster Name: 'Cluster1'
num_tokens: 256
listen_address: 10.20.0.52/10.20.0.53
rpc_address: 10.20.0.52/10.20.0.53
class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
# seeds is actually a comma-delimited list of addresses.
# Ex: "<ip1>,<ip2>,<ip3>"
- seeds: "10.20.0.52"
我首先启动种子节点(52)然后,我检查nodetool status
并仅返回52的数据。但是我启动(53)并且nodetool status
在几秒后抛出以下异常:
-- StackTrace --
java.lang.RuntimeException: No nodes present in the cluster. Has this node finished starting up?
at org.apache.cassandra.dht.Murmur3Partitioner.describeOwnership(Murmur3Partitioner.java:131)
at org.apache.cassandra.service.StorageService.getOwnership(StorageService.java:3912)
at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:112)
at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:46)
at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:237)
at com.sun.jmx.mbeanserver.PerInterface.getAttribute(PerInterface.java:83)
at com.sun.jmx.mbeanserver.MBeanSupport.getAttribute(MBeanSupport.java:206)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:647)
at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1443)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1399)
at javax.management.remote.rmi.RMIConnectionImpl.getAttribute(RMIConnectionImpl.java:637)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$250(TCPTransport.java:683)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$$Lambda$1/1165999373.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
但是在非种子节点(53)上,它返回标准输出,其中仅包含其自身的详细信息(53)。
种子节点(52)上的nodetool gossipinfo
返回有关两个节点的信息:
/10.20.0.52
generation:1439824481
heartbeat:2433
SCHEMA:500091e4-e8ab-303d-9111-8cca7edff2d0
HOST_ID:2d78ed48-13e8-4fc5-ac55-8b2a6d00c8c5
NET_VERSION:8
RELEASE_VERSION:2.1.8-SNAPSHOT
STATUS:NORMAL,-1091407767707699731
RPC_ADDRESS:10.20.0.52
SEVERITY:0.5025125741958618
DC:DC1
LOAD:2524926.0
RACK:RAC1
INTERNAL_IP:10.20.0.52
/10.20.0.53
generation:1439824502
heartbeat:2376
SCHEMA:500091e4-e8ab-303d-9111-8cca7edff2d0
NET_VERSION:8
HOST_ID:2d78ed48-13e8-4fc5-ac55-8b2a6d00c8c5
RELEASE_VERSION:2.1.8-SNAPSHOT
STATUS:NORMAL,-1091407767707699731
RPC_ADDRESS:10.20.0.53
SEVERITY:0.0
DC:DC1
LOAD:2603302.0
RACK:RAC1
INTERNAL_IP:10.20.0.53
非种子节点上的但它只显示有关自身的信息,不包括种子节点(52)。
关于2个节点的状态/信息之间的另一个差异是nodetool netstats
的输出,对于种子节点(52)显示:
ubuntu@52:~$ nodetool netstats
Mode: NORMAL
Not sending any streams.
Read Repair Statistics:
Attempted: 0
Mismatch (Blocking): 0
Mismatch (Background): 0
Pool Name Active Pending Completed
Commands n/a 0 0
Responses n/a 0 1135
而对于非种子节点(53),完成的请求数是种子节点的两倍:
ubuntu@53:~$ nodetool netstats
Mode: NORMAL
Not sending any streams.
Read Repair Statistics:
Attempted: 0
Mismatch (Blocking): 0
Mismatch (Background): 0
Pool Name Active Pending Completed
Commands n/a 0 0
Responses n/a 0 2388
源代码
鉴于stacktrace,我尝试插入一些标志,并在调用Murmur3Partitioner.java
方法时打印出似乎导致L206 describeOwnership
错误的内容:
- 引导种子节点时调用该方法
- 当非种子节点被引导时调用该方法
两次tokes(或sortedTokens
)列表完全相同,但迭代器为空并触发标题中的错误。
注意:两个节点(52,53)上的relvant端口(7000,7001)都已打开。
更新#1:所以,我发现(感谢irc #cassandra频道)如果两个节点具有相同的tokes,则会创建冲突并且一个会失败引导。
为了解决这个问题,我尝试了以下方法: cqlsh&GT; DROP KEYSPACE ycsb;
没有解决问题 - nodetool ring
仍显示与非种子节点相对应的相同令牌;关闭cqlsh
后,我也刷新了更改。然后:
sudo rm -rf /var/lib/cassandra/data/*
sudo rm -rf /var/lib/cassandra/commitlog/*
sudo rm -rf /var/lib/cassandra/saved_caches/*
仍然没有减少或更改nodetool ring
中显示的标记。
感谢任何指导。