Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to start Cassandra DSC on Mac - Error starting local jmx server

Tags:

cassandra

Am trying to run Cassandra on my Mac OSX 10.10. I've installed dsc-cassandra-2.1.9. Some of the cassandra.yaml settings are: listen_address: 127.0.0.1 rpc_address: 127.0.0.1 rpc_port: 9160

However when I start cassandra, it fails:

$ ./bin/cassandra 
...

WARN  [main] 2015-10-08 23:01:43,226 CLibrary.java:70 - JNA link failure, one or more native method will be unavailable.
WARN  [main] 2015-10-08 23:01:43,227 CassandraDaemon.java:81 - JMX is not enabled to receive remote connections. Please see cassandra-env.sh for more info.
ERROR [main] 2015-10-08 23:02:58,707 CassandraDaemon.java:116 - Error starting local jmx server:
java.io.IOException: Cannot bind to URL [rmi://localhost:7199/jmxrmi]:    javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Operation timed out]
at javax.management.remote.rmi.RMIConnectorServer.newIOException(RMIConnectorServer.java:826) ~[na:1.7.0_51]
at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:431) ~[na:1.7.0_51]
at org.apache.cassandra.service.CassandraDaemon.maybeInitJmx(CassandraDaemon.java:112) [apache-cassandra-2.1.9.jar:2.1.9]
at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:216) [apache-cassandra-2.1.9.jar:2.1.9]
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:537) [apache-cassandra-2.1.9.jar:2.1.9]
at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:626) [apache-cassandra-2.1.9.jar:2.1.9]
Caused by: javax.naming.ServiceUnavailableException: null

Could anyone please help with fixing this issue?

updates to above problem --

after setting the JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=127.0.0.1" as suggested in the answer below, cassandra seems to be running, however the nodetool doesn't seem to be reporting correct status:

$ ps -ef|grep cass
0 49292     1   0  8:53PM ttys001    0:13.04 /usr/bin/java -ea -javaagent:./bin/../lib/jamm-0.3.0.jar -XX:+CMSClassUnloadingEnabled -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms4096M -Xmx4096M -Xmn800M -XX:+HeapDumpOnOutOfMemoryError -Xss256k -XX:StringTableSize=1000003 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=1 -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+UseTLAB -XX:CompileCommandFile=./bin/../conf/hotspot_compiler -XX:CMSWaitDuration=10000 -XX:+UseCondCardMark -Djava.net.preferIPv4Stack=true -Djava.rmi.server.hostname=127.0.0.1 -Dcassandra.jmx.local.port=7199 -XX:+DisableExplicitGC -Dlogback.configurationFile=logback.xml -Dcassandra.logdir=./bin/../logs -Dcassandra.storagedir=./bin/../data -cp ./bin/../conf:./bin/../build/classes/main:./bin/../build/classes/thrift:./bin/../lib/ST4-4.0.8.jar:./bin/../lib/airline-0.6.jar:./bin/../lib/antlr-runtime-3.5.2.jar:./bin/../lib/apache-cassandra-2.1.9.jar:./bin/../lib/apache-cassandra-clientutil-2.1.9.jar:./bin/../lib/apache-cassandra-thrift-2.1.9.jar:./bin/../lib/commons-cli-1.1.jar:./bin/../lib/commons-codec-1.2.jar:./bin/../lib/commons-lang3-3.1.jar:./bin/../lib/commons-math3-3.2.jar:./bin/../lib/compress-lzf-0.8.4.jar:./bin/../lib/concurrentlinkedhashmap-lru-1.4.jar:./bin/../lib/disruptor-3.0.1.jar:./bin/../lib/guava-16.0.jar:./bin/../lib/high-scale-lib-1.0.6.jar:./bin/../lib/jackson-core-asl-1.9.2.jar:./bin/../lib/jackson-mapper-asl-1.9.2.jar:./bin/../lib/jamm-0.3.0.jar:./bin/../lib/javax.inject.jar:./bin/../lib/jbcrypt-0.3m.jar:./bin/../lib/jline-1.0.jar:./bin/../lib/jna-4.0.0.jar:./bin/../lib/json-simple-1.1.jar:./bin/../lib/libthrift-0.9.2.jar:./bin/../lib/logback-classic-1.1.2.jar:./bin/../lib/logback-core-1.1.2.jar:./bin/../lib/lz4-1.2.0.jar:./bin/../lib/metrics-core-2.2.0.jar:./bin/../lib/netty-all-4.0.23.Final.jar:./bin/../lib/reporter-config-2.1.0.jar:./bin/../lib/slf4j-api-1.7.2.jar:./bin/../lib/snakeyaml-1.11.jar:./bin/../lib/snappy-java-1.0.5.2.jar:./bin/../lib/stream-2.5.2.jar:./bin/../lib/super-csv-2.1.0.jar:./bin/../lib/thrift-server-0.3.7.jar org.apache.cassandra.service.CassandraDaemon

$ ./bin/nodetool status
objc[52026]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
nodetool: Failed to connect to '127.0.0.1:7199' - NameNotFoundException: 'jmxrmi'.

And cqlsh seems to be working:

$ ./bin/cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 2.1.9 | CQL spec 3.2.0 | Native protocol v3]
Use HELP for help.
cqlsh>
like image 744
Sreejith M Avatar asked Oct 09 '15 06:10

Sreejith M


1 Answers

Faced the same error and below is the solution.

Stop cassandra ps -ef | grep cassandra | grep -v grep | awk '{print $2}' | xargs kill -9

In cassandra-env.sh modify the following:-

  1. Uncomment JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=" and change to JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=127.0.0.1"

  2. Change LOCAL_JMX=yes to LOCAL_JMX=no

  3. Change true to false JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false"

If still you see any issues check if the port specified by JMX_PORT="XXX" is occupied or not. OR Simply you can change it to JMX_PORT="9909" and restart cassandra.

like image 191
user3886907 Avatar answered Sep 24 '22 14:09

user3886907