This article describes the steps to install and configure Cassandra database on RHEL to be used as KFF server for FTK applications.

Prerequisites

  • It is strongly recommended to install Cassandra on a freshly installed operating system.
  • Assign an IP address for the virtual machine and make sure the server is accessible over the network.
  • Open the required TCP port for Cassandra network communication as shown in the example below. The default port is TCP/9042.
    $ sudo firewall-cmd --add-port=9042/tcp
    $ sudo firewall-cmd --runtime-to-permanent

Installation


Follow the steps below to install Cassandra and the required packages:


  1. Install Java using the command below:
    $ sudo yum install java-1.8.0-openjdk-devel -y
  2. You can verify Java installation and the version using the command below:
    $ java -version
    openjdk version "1.8.0_372"
    OpenJDK Runtime Environment (build 1.8.0_372-b07)
    OpenJDK 64-Bit Server VM (build 25.372-b07, mixed mode)
  3. Install Python 2 using the command below:
    $ sudo yum install python2 -y
  4. Verify the installation as shown below:
    $ pyhton2 -V
  5. Create the file "/etc/yum.repos.d/cassandra.repo" using the command below:
    $ cat > /etc/yum.repos.d/cassandra.repo
  6. The above command will not release the command prompt. With the command above still active, paste the lines below and press Enter to return to an empty line.
    [cassandra]
    name=Apache Cassandra
    baseurl=https://www.apache.org/dist/cassandra/redhat/311x/
    gpgcheck=1
    repo_gpgcheck=1
    gpgkey=https://www.apache.org/dist/cassandra/KEYS
  7. Press "Ctrl + D" on an empty line to save the file.
  8. Update installed packages using the command below:
     $ sudo yum update -y
  9. Install Cassandra using the command below:
    $ sudo yum install cassandra -y

Post-Install Configurations


Enabling and Starting Cassandra service


Cassandra service won't start automatically after the installation and you need to enable and start the service manually. To enable and start the service follow the steps below:

  1. Run the command below to enable the service:
    $ sudo systemctl enable cassandra.service
  2. To verify that the service is enable, use the command below:
    $ sudo systemctl is-enabled cassandra.service
    cassandra.service is not a native service, redirecting to systemd-sysv-install.
    Executing: /usr/lib/systemd/systemd-sysv-install is-enabled cassandra
    enabled
  3. Run the command below to start the service:
    $ sudo service cassandra start
  4. To check the status of Cassandra run the command below. "UN" at the beginning of the line indicates that the service is Up and Normal state. 
    $ nodetool status
    Datacenter: datacenter1
    =======================
    Status=Up/Down

    |/ State=Normal/Leaving/Joining/Moving
    --  Address        Load       Tokens       Owns (effective)  Host ID               Rack
    UN  192.168.11.20  222.63 KiB 256          100.0%            91190df1-5bb955a9deb  rack1

Changing RPC address


By default, Cassandra listens on localhost address (127.0.0.1) and does not respond to the requests over the network. To change the RPC address and configure the service to respond to network requests, follow the steps below:

  1. First, stop Cassandra service using the command below:
    $ sudo service cassandra stop
  2. To verify that the service is stopped, use the command below:
    $ sudo systemctl is-active cassandra.service
    failed
  3. Modify the file "/etc/cassandra/conf/cassandra.yaml" and change RPC address as required. The service port number can also be modified in this file. In the examples below, vi text editor is used for editing the file:

    $ vi /etc/cassandra/conf/cassandra.yaml
    ...
    # For security reasons, you should not expose this port to the internet. Firewall it if needed.

    rpc_address: 192.168.11.20

    # port for Thrift to listen for clients on

    rpc_port: 9042
  4. Once the file is modified and saved, run the command below to enable the service:
    $ sudo service cassandra start
  5. Verify that Cassandra service is successfully started using the command below. "UN" at the beginning of the line indicates that the service is Up and Normal state.
    $ nodetool status
    Datacenter: datacenter1
    =======================
    Status=Up/Down

    |/ State=Normal/Leaving/Joining/Moving
    --  Address        Load       Tokens       Owns (effective)  Host ID               Rack
    UN  192.168.11.20  222.63 KiB 256          100.0%            91190df1-5bb955a9deb  rack1