关于Cassandra占用8080端口的问题

今天需要再一台服务器上开两个cassandra,更改了storage-conf.xml中的port后,依然出现“java.net.BindException: Address already in use”的错误,感觉非常诡异……

经过检查发现,cassandra启动时候默认启动了8080端口用于jmx(Java性能检测),如果我们不需要的话,去掉就可以了。

配置在bin/cassandra.in.sh中,如下去掉即可:

cassandra_home=`dirname $0`/..

# The directory where Cassandra's configs live (required)
CASSANDRA_CONF=$cassandra_home/conf

# This can be the path to a jar file, or a directory containing the
# compiled classes. NOTE: This isn't needed by the startup script,
# it's just used here in constructing the classpath.
cassandra_bin=$cassandra_home/build/classes
#cassandra_bin=$cassandra_home/build/cassandra.jar

# JAVA_HOME can optionally be set here
#JAVA_HOME=/usr/local/jdk6

# The java classpath (required)
CLASSPATH=$CASSANDRA_CONF:$cassandra_bin

for jar in $cassandra_home/lib/*.jar; do
    CLASSPATH=$CLASSPATH:$jar
done

# Arguments to pass to the JVM
JVM_OPTS=" \
        -ea \
        -Xms1G \
        -Xmx1G \
        -XX:+UseParNewGC \
        -XX:+UseConcMarkSweepGC \
        -XX:+CMSParallelRemarkEnabled \
        -XX:SurvivorRatio=8 \
        -XX:MaxTenuringThreshold=1 \
        -XX:CMSInitiatingOccupancyFraction=75 \
        -XX:+UseCMSInitiatingOccupancyOnly \
        -XX:+HeapDumpOnOutOfMemoryError"

        #-Dcom.sun.management.jmxremote.port=8080 \
        #-Dcom.sun.management.jmxremote.ssl=false \
        #-Dcom.sun.management.jmxremote.authenticate=false" \

然后和8080就木有关系啦!

Leave a Reply

Your email address will not be published. Required fields are marked *