无法在Mac上启动Cassandra DSC - 启动本地jmx服务器时出错

时间:2015-10-09 06:20:33

标签: cassandra

我试图在Mac OSX 10.10上运行Cassandra。我已经安装了dsc-cassandra-2.1.9。 一些cassandra.yaml设置是: listen_address:127.0.0.1 rpc_address:127.0.0.1 rpc_port:9160

然而,当我启动cassandra时,它失败了:

$ ./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

有人可以帮忙解决这个问题吗?

更新上述问题 -

按照以下答案中的建议设置JVM_OPTS =“$ JVM_OPTS -Djava.rmi.server.hostname = 127.0.0.1”之后,cassandra似乎正在运行,但是nodetool似乎没有报告正确的状态:

$ 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'.

cqlsh似乎正在运行:

$ ./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>

2 个答案:

答案 0 :(得分:9)

面临同样的错误,以下是解决方案。

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

在cassandra-env.sh中修改以下内容: -

  1. 取消注释JVM_OPTS =“$ JVM_OPTS -Djava.rmi.server.hostname =”并更改为 JVM_OPTS =“$ JVM_OPTS -Djava.rmi.server.hostname = 127.0.0.1”

  2. 将LOCAL_JMX = yes更改为LOCAL_JMX =否

  3. 将true更改为false JVM_OPTS =“$ JVM_OPTS -Dcom.sun.management.jmxremote.authenticate = false”

  4. 如果仍然看到任何问题,请检查JMX_PORT =“XXX”指定的端口是否被占用。或者只需将其更改为JMX_PORT =“9909”并重新启动cassandra。

答案 1 :(得分:0)

  1. 确认端口 7199 上没有其他任何内容正在运行。你可以,例如通过修改 cassandra-env.sh 中的 JMX_PORT ,也可以为JMX使用不同的端口。
  2. 查看 cassandra-env.sh 并尝试修改以下行:

    JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=<public name>"