This guide outlines the steps to set up and manage the Cassandra to Spanner proxy service using systemd
on a Linux-based system. The proxy service ensures reliable operation by starting automatically at boot and restarting on failure.
Before managing the service, you must first run the setup script systemd.sh
, which configures the system to run the Cassandra to Spanner proxy as a service.
- Switch the current user to the root user
sudo su -
- Navigate to the systemd directory containing the
systemd.sh
script. 3.Add the appropriate values for the below variables in the systemd.cfg file.
SPANNER_CONFIG_TABLE="TableConfigurations"
SPANNER_DB_NAME="<<comma seperated table names>>"
GCP_PROJECT_ID="<<gcp-project-id>>"
SPANNER_INSTANCE="<<spanner-instance-name>>"
- Make the script executable and run it:
chmod +x systemd.sh
source ./systemd.sh
This script builds the application, copies the binary to the appropriate location, sets up environment variables, and creates a systemd service file for the proxy.
After running the setup script, you can manage the Cassandra to Spanner proxy service using the following systemd commands
To view the current status of the service:
systemctl status cassandraproxy.service
To start the service if it's not already running:
systemctl start cassandraproxy.service
To stop the service
systemctl stop cassandraproxy.service
To restart the service (useful after configuration changes)
systemctl restart cassandraproxy.service
Logs are essential for monitoring the service's health and troubleshooting issues.
To follow the service's logs in real-time:
journalctl -fu cassandraproxy.service
To view all logs generated by the service:
journalctl -u cassandraproxy.service
- Commands to manage the service and view logs may require root privileges or sudo.
- The setup script systemd.sh must be executed from its location within the project or the systemd subfolder, as outlined in the setup instructions.