Nodetool when viewing the local cluster state, an error indicating that an unreachable connection timeout occurred after n long time:
$ nodetool Status
nodetool:failed to connect to ' 127.0.0.1:7199 '-connectexception: ' Connection timed out '.
After being checked for/etc/hosts file configuration error, the actual host name (not localhost) in the file corresponds to the IP address resolution line set incorrectly, this is due to the host IP address replacement did not update the hosts file in time. Changing to the correct IP address is similar to the following:
192.168.1.104 Yoga.localdomain Yoga
Then restart the Cassandra Service
$ Sudo/etc/init.d/cassandra Restart
[OK] Restarting Cassandra (via Systemctl): Cassandra.service.
Or
$ sudo systemctl restart Cassandra.service
And then do it again.
$ nodetool Status
Datacenter:datacenter1
=======================
Status=up/down
|/state=normal/leaving/joining/moving
--Address Load tokens owns (effective) Host ID Rack
UN 127.0.0.1 139.45 KB 256 100.0% 27e51705-c13d-4f4b-b4f8-de3759fcd895 rack1
If the command is executed when the Cassandra has not been fully started, an exception is thrown, similar to the following:
$ nodetool Status
Error:no nodes present in the cluster. Has this node finished starting up?
--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:129)
At Org.apache.cassandra.service.StorageService.effectiveOwnership (storageservice.java:3762)
At Org.apache.cassandra.service.StorageService.effectiveOwnership (storageservice.java:103)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native method)
At Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:57)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43)
At Java.lang.reflect.Method.invoke (method.java:606)
At Sun.reflect.misc.Trampoline.invoke (methodutil.java:75)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native method)
At Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:57)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43)
At Java.lang.reflect.Method.invoke (method.java:606)
At Sun.reflect.misc.MethodUtil.invoke (methodutil.java:279)
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.invoke (perinterface.java:138)
At Com.sun.jmx.mbeanserver.MBeanSupport.invoke (mbeansupport.java:252)
At Com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke (defaultmbeanserverinterceptor.java:819)
At Com.sun.jmx.mbeanserver.JmxMBeanServer.invoke (jmxmbeanserver.java:801)
At Javax.management.remote.rmi.RMIConnectionImpl.doOperation (rmiconnectionimpl.java:1487)
At javax.management.remote.rmi.rmiconnectionimpl.access$300 (rmiconnectionimpl.java:97)
At Javax.management.remote.rmi.rmiconnectionimpl$privilegedoperation.run (rmiconnectionimpl.java:1328)
At Javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation (rmiconnectionimpl.java:1420)
At Javax.management.remote.rmi.RMIConnectionImpl.invoke (rmiconnectionimpl.java:848)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native method)
At Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:57)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43)
At Java.lang.reflect.Method.invoke (method.java:606)
At Sun.rmi.server.UnicastServerRef.dispatch (unicastserverref.java:322)
At Sun.rmi.transport.transport$1.run (transport.java:177)
At Sun.rmi.transport.transport$1.run (transport.java:174)
At Java.security.AccessController.doPrivileged (Native method)
At Sun.rmi.transport.Transport.serviceCall (transport.java:173)
At Sun.rmi.transport.tcp.TCPTransport.handleMessages (tcptransport.java:556)
At Sun.rmi.transport.tcp.tcptransport$connectionhandler.run0 (tcptransport.java:811)
At Sun.rmi.transport.tcp.tcptransport$connectionhandler.run (tcptransport.java:670)
At Java.util.concurrent.ThreadPoolExecutor.runWorker (threadpoolexecutor.java:1145)
At Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:615)
At Java.lang.Thread.run (thread.java:745)
The IP address resolution for the host name is not set at all in the/etc/hosts file on the Mac OS x platform, and the error message appears slightly different:
nodetool:failed to connect to ' 127.0.0.1:7199 '-connectexception: ' Operation timed out '.
The solution is the same, for dynamic IP of the client test environment, directly the host name corresponding to the IP set to 127.0.0.1 can also be:
127.0.0.1 MBA
Reload the Cassandra and it's okay.
$ launchctl Unload/usr/local/opt/cassandra/homebrew.mxcl.cassandra.plist
$ launchctl Load/usr/local/opt/cassandra/homebrew.mxcl.cassandra.plist