IBM Support

Implementing JMX authentication

Troubleshooting


Problem

By default, Apache Cassandra's JMX interface does not require authentication. The following instructions explain how to enable JMX authentication in Apache Cassandra.

Configuring Apache Cassandra

At the very end of cassandra-env.sh, add the following lines enabling jmx authentication:

#JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=true"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.access.file=/opt/cassandra/resources/cassandra/conf/jmx.access"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.password.file=/opt/cassandra/resources/cassandra/conf/jmx.passwd"

Create jmx.access with the following contents (usernames can be changed as desired):
user_rw readwrite
user_ro readonly

Create jmx.passwd with the following contents (usernames and passwords can be changed if desired).
user_rw user_rw_pwd
user_ro user_ro_pwd

Note: access file and password file must have permission set to 600 on OS level. Passwords are case sensitive and use tab between username password and do not use spaces.

Configuring OpsCenter

In order for OpsCenter to work with JMX authentication enabled, the following changes need to be made to opscenter and agent as well.

In cluster configuration file (e.g., Development_Cluster.conf) add the following to the JMX section:

[jmx]
username = user_rw
password = user_rw_pwd
port = 7199

In opscenter-agent-env.sh‚ 
#added for JMX authentication
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.access.file=/opt/cassandra/resources/cassandra/conf/jmx.access"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.password.file=/opt/cassandra/resources/cassandra/conf/jmx.passwd"
‚ 

Using nodetool with JMX Authentication

Once JMX is enabled, nodetool will require a username and password before it can connect to the node. Use the -u flag to specify the username and the -p flag to specify the password. For example:

nodetool -h localhost -u user_rw -p user_rw_pwd ring

Last reviewed: 2023/11/13

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB76","label":"Data Platform"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSCR56","label":"IBM DataStax Enterprise"},"ARM Category":[{"code":"","label":""}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)"}]

Historical Number

ka06R000000HcW0QAK

Document Information

Modified date:
30 January 2026

UID

ibm17258898