The script of start cassandra at boot time,scriptcassandra
For those that installed Cassandra from the tar package found at Cassandra website, here is a very basic script to start it at boot time and stop it later if needed.
Create cassandra boot script in /etc/init.d and make it executable.
sudo nano /etc/init.d/cassandra
#!/bin/sh
#
# chkconfig: - 80 45
# description: Starts and stops Cassandra
# update deamon path to point to the cassandra executable
DEAMON=/opt/cassandra/bin/cassandra
start() {
echo -n "Starting Cassandra... "
$DEAMON -p /var/run/cassandra.pid
echo "OK"
return 0
}
stop() {
echo -n "Stopping Cassandra... "
kill $(cat /var/run/cassandra.pid)
echo "OK"
return 0
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
sudo chmod +x /etc/init.d/cassandra
For Ubuntu, add it to the startup by executing
sudo update-rc.d cassandra defaults
That’s it! Next time you bootup, it will be automatically and you can stop it by:
sudo /etc/init.d/cassandra stop
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。