【问题标题】:can't connect to cassandra with jconsole无法使用 jconsole 连接到 cassandra
【发布时间】:2012-11-17 06:47:44
【问题描述】:

我在远程服务器上安装了 cassandra。该机器有 2 个 IP - 内部外部。在 cassandra 的 jvm opts 中,我将 java.rmi.server.hostname 设置为 internal ip。 nodetool 连接得很好。但是我无法通过 external ip 使用 jconsole 进行连接 - 它挂断了很长时间,然后(在 -debug 模式下)打印一个带有超时的 java.net.ConnectException。这不是防火墙问题 - 服务器上没有防火墙,而且我可以使用 telnet 连接到 external ip 和 jmx 端口。我也尝试通过 ssh 隧道连接到 internal ip - 但结果仍然相同。

谁能帮我解决这个问题?

【问题讨论】:

    标签: cassandra jmx jconsole


    【解决方案1】:

    conf/cassandra-env.sh

    JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=public_name"
    

    【讨论】:

    • 谢谢,这是真正丢失的那个。
    【解决方案2】:

    很可能您尚未配置远程 JMX。 This should help.

    【讨论】:

      【解决方案3】:

      默认情况下,Cassandra 只允许从 localhost 访问 JMX。要启用远程 JMX 连接,您需要将
      "LOCAL_JMX=yes" 更改为 "LOCAL_JMX=no"乙>
      这个属性来自 Cassandra-env.sh 文件。
      可选地,如果您想启用身份验证,您可以设置与身份验证相关的属性,否则只保留注释。

      希望这会对您有所帮助。

      【讨论】:

        【解决方案4】:

        关键点是JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=x.x.x.x"

        我在这里粘贴我完整的 sn-p 以帮助其他人:

        LOCAL_JMX=no
        
        # Specifies the default port over which Cassandra will be available for
        # JMX connections.
        # For security reasons, you should not expose this port to the internet.  Firewall it if needed.
        JMX_PORT="7199"
        
        if [ "$LOCAL_JMX" = "yes" ]; then
          JVM_OPTS="$JVM_OPTS -Dcassandra.jmx.local.port=$JMX_PORT"
          JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
        else
          JVM_OPTS="$JVM_OPTS -Dcassandra.jmx.remote.port=$JMX_PORT"
          # if ssl is enabled the same port cannot be used for both jmx and rmi so either
          # pick another value for this property or comment out to use a random port (though see CASSANDRA-7087 for origins)
          JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=192.168.42.101"
          JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT"
          JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote"
          JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl=false"
        
          # turn on JMX authentication. See below for further options
          JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
        
          # jmx ssl options
          #JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl=true"
          #JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl.need.client.auth=true"
          #JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl.enabled.protocols=<enabled-protocols>"
          #JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl.enabled.cipher.suites=<enabled-cipher-suites>"
          #JVM_OPTS="$JVM_OPTS -Djavax.net.ssl.keyStore=/path/to/keystore"
          #JVM_OPTS="$JVM_OPTS -Djavax.net.ssl.keyStorePassword=<keystore-password>"
          #JVM_OPTS="$JVM_OPTS -Djavax.net.ssl.trustStore=/path/to/truststore"
          #JVM_OPTS="$JVM_OPTS -Djavax.net.ssl.trustStorePassword=<truststore-password>"
        fi
        

        【讨论】:

          猜你喜欢
          • 2021-11-14
          • 1970-01-01
          • 1970-01-01
          • 2016-02-14
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2023-03-14
          • 2016-04-11
          相关资源
          最近更新 更多