Cassandra charm changes cluster name incorrectly
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://
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[
echo "$cmd" | tr ':' '\n' | cassandra-cli -h $LISTEN_ADDRESS -B
nodetool flush
fi
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.