question

yashwanth.kondeti@verizon.com avatar image
yashwanth.kondeti@verizon.com asked Erick Ramirez edited

What is the difference between starting Cassandra as a Service vs normal startup?

Hi All,

I have been having a tough time in trying to understand the actual difference between the different ways to start Cassandra on a LINUX Host and how it affects the nodes being visible to each other. I have a 3 node cluster and all the 3 nodes are up and running. There are multiple admins on our team and everyone is using their own ways to start the cassandra on a node. I am wondering if that has any bad effect on the node visibility to each other and other cluster performance issues. When I see that there are multiple ways to start cassandra:

1. Start cassandra from the bin directory (as a stand-alone process)

./bin/cassandra

2. Start Cassandra as a Service option1

sudo service cassandra start

3. Start Cassandra as a Service option2

sudo systemctl start cassandra

What is the difference between the 3 options? How do they vary in the behavior of the nodes?

Also, how to find out which option was used to start it?I don't know what command was used to start the cassandra on this particular node, but as you can see below, it says Cassandra is stopped in 1 command, and that it is active and running in another command. What might be the issue here?

[root@host1 bin]# sudo service cassandra status
Cassandra is stopped.
[root@host1 bin]# sudo systemctl status cassandra
cassandra.service - LSB: Apache Cassandra database server
Loaded: loaded (/etc/rc.d/init.d/cassandra; bad; vendor preset: disabled)
Active: active (running) since Sat 2021-04-03 05:07:38 UTC; 3 days ago

Please help as this is issue is really confusing me and I am not able to understand how to proceed further?

installation
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered Erick Ramirez edited

This is a Linux system administration question rather than a Cassandra question so my suggestion is to get in touch with your sysadmin team to get more information.

The Linux service command works on files in /etc/init.d which belong to the old SysV init scripts. The systemctl command works on files in /*/systemd which is the implementation for running services on newer Linux releases such as CentOS/RHEL 7, Ubuntu 15.04 (and newer).

Whether the Cassandra service is managed through service or systemctl command depends on the version of the operating system it is running on.

For what it's worth, Cassandra runs as a service if you have installed it as a package using YUM or APT. Installing Cassandra as a package:

  • requires full root access to run YUM/APT installation commands and creates the cassandra OS user
  • installs Cassandra binaries/scripts/tools in default locations

On the other hand, a tarball installation:

  • does not require full root access
  • installs Cassandra binaries/scripts/tools in any directory of your choice
  • runs Cassandra as a standalone process

I've explained this in greater detail on the Installing Cassandra page of the official Apache Cassandra website when I rewrote it for CASSANDRA-15466. Cheers!

2 comments Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

yashwanth.kondeti@verizon.com avatar image yashwanth.kondeti@verizon.com commented ·

This explanation is really helpful Erick. Now I understand the differences better :) ... Thanks a ton for taking the time to answer the question with details from both Linux and Cassandra. Really appreciate it.

0 Likes 0 ·
Erick Ramirez avatar image Erick Ramirez ♦♦ yashwanth.kondeti@verizon.com commented ·

Happy to help. Cheers!

0 Likes 0 ·