Apache Cassandra maintenance tasks

This section describes periodic maintenance tasks for Cassandra.

Anti-entropy maintenance

The Apache Cassandra ring nodes require periodic maintenance to ensure consistency across all nodes. To perform this maintenance, use the following command:

nodetool -h localhost repair -pr

Apigee recommends the following when running this command:

  • Run on every Cassandra node (across all regions or data centers).
  • Run on one node at a time, to ensure consistency across all nodes in the ring.
  • Run during periods of relatively low workload (the tool imposes a significant load on the system).
  • Run at least every seven days in order to eliminate problems related to Cassandra "forgotten deletes".
  • You can run it on different nodes on different days, or schedule it so that there are several hours between running it on each node.
  • Use the -pr option (partitioner range) to specify the primary partitioner range of the node only.

If you enabled JMX authentication for Cassandra, you must include the username and password when you invoke nodetool. For example:

nodetool -u username -pw password -h localhost repair -pr

For more information, see the following resources:

Log file maintenance

Cassandra logs are stored in the /opt/apigee/var/log/cassandra directory on each node. By default, a maximum of 50 log files, each with a maximum size of 20 MB, can be created; once this limit is reached older logs are deleted when newer logs are created.

If you should find that Cassandra log files are taking up excessive space, you can modify the amount of space allocated for log files by editing the log4j settings.

  1. Edit /opt/apigee/customer/application/cassandra.properties to set the following properties. If that file does not exist, create it:
    conf_log4j-server_log4j.appender.r.maxfilesize=20MB
    # max file size
    conf_log4j-server_log4j.appender.r.maxbackupindex=50 # max open files
  2. Restart Cassandra by using the following command:
    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra restart