KB Article #178063
Start Cassandra as a service
You can start and run Cassandra as a service as follows:
To start Cassandra as a service on UNIX/Linux, you must install and configure appropriate startup script for your system.
When startup scripts are configured, you can then start Cassandra as a service.
Note: You
must have root or sudo permissions to start Cassandra as a service.
- Using systemd
Below is a sample systemd script for Cassandra (cassandra.service):
[Unit] Description=Apache Cassandra 2.2.8 After=network.target network-online.target remote-fs.target [Service] Type=forking User=admincas ExecStart=/appli/webapi_753/cassandra/bin/cassandra -p /appli/webapi_753/cassandra/cassandra.pid PIDFile=/appli/webapi_753/cassandra/cassandra.pid SuccessExitStatus=143 [Install] WantedBy=multi-user.target
This script will start Cassandra with the user “admincas”.
This script should be copied to the appropriate directory, for example using RHEL 7, /usr/lib/systemd/system/
The following commands should be run to enable Cassandra service:
$ sudo systemctl enable
cassandra.service
Cassandra will be added to the systemd startup sequence and will therefore start and stop automatically when the operating system is rebooted.
For example, typically the commands to start/stop/check/restart Cassandra as a service are as follows:
$ sudo systemctl status cassandra $ sudo systemctl stop cassandra $ sudo systemctl start cassandra $ sudo systemctl restart cassandra
- Using init.d
For example, see the example startup script for Debian Linux:
https://github.com/apache/cassandra/blob/cassandra...
For example, typically the commands to start/stop/check/restart Cassandra as a service are as follows:
$ sudo service cassandra start $ sudo service cassandra stop $ sudo service cassandra status $ sudo service cassandra restart