Cassandra charm changes cluster name incorrectly

Bug #1099917 reported by Evan
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cassandra (Juju Charms Collection)
Fix Released
Undecided
Unassigned

Bug Description

The Cassandra charm changes the cluster name in the config-changed hook by editing Cassandra configuration file and restarting the process. This does not work if Cassandra has already been started as the cluster name will be stored in the database and when the starting Cassandra process notices that the database cluster name and configuration file cluster name do not match, it will raise an exception and die.

The correct approach is to set the cluster name in the database first using cassandra-cli, then update the configuration file. This is documented on the FAQ:
http://wiki.apache.org/cassandra/FAQ#clustername_mismatch

I've taken a stab at implementing this myself, but got caught around the problem of the RPC listen address needing to be set first with the database started before this will work. I've worked around it for now by just setting the name to the Cassandra default of "Test Cluster", but some variation of the following should work:

if service cassandra status; then
  cmd="use system;:set LocationInfo[utf8('L')][utf8('ClusterName')]=utf8('$CLUSTER_NAME');:exit;"
  echo "$cmd" | tr ':' '\n' | cassandra-cli -h $LISTEN_ADDRESS -B
  nodetool flush
fi

Revision history for this message
Stuart Bishop (stub) wrote :

The current charm allows the cluster name to be set only at initial deploy time (juju deploy cassandra --config=foo.yaml). If an operator attempts to change the cluster name after this, the service gets put into a blocked state and the operator informed by the service status message.

Changed in cassandra (Juju Charms Collection):
status: New → Fix Committed
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.