NoSQL

How to install Cassandra-web on CentOS 8

Share on Social Media

In this article, you will learn how to install Cassandra-web on CentOS 8. #centlinux #linux #cassandra

What is Cassandra Web? :

Cassandra Web is a web interface to Apache Cassandra with AngularJS and server-sent events. Cassandra Web is free and open source and its source is available at GitHub.

Cassandra Web is very simple application with limited features, but it fulfills the purpose of monitoring of complete Apache Cassandra cluster via a single web interface.

Recommended Online Training: Learn Bash Shell in Linux for Beginners

Environment Specification:

Although it is not necessary to install Cassandra Web on a Apache Cassandra node. But for the sake of simplicity, we are installing the Cassandra Web on the same machine, on which you have installed Apache Cassandra.

Install Ruby on CentOS 8:

You are required Rubygems package manager to install Cassandra Web on Linux. Therefore, install the Ruby on CentOS 8 with related packages by using dnf command.

# dnf install -y rubygems ruby-devel

Install Cassandra-web Prerequisites:

To install Cassandra Web by using rubygems, you need the make and compilation packages. You can install all the required packages by using a single dnf command.

# dnf install -y make gcc gcc-c++ redhat-rpm-config

Install Cassandra-web on CentOS 8:

Now, you are ready to install Cassandra-web interface. You can execute the following gem command to install it on our Linux server.

# gem install cassandra-web
Building native extensions. This could take a while...
Successfully installed eventmachine-1.2.7
Fetching: thin-1.7.2.gem (100%)
Building native extensions. This could take a while...
Successfully installed thin-1.7.2
Fetching: ione-1.2.4.gem (100%)
Successfully installed ione-1.2.4
Fetching: cassandra-driver-3.2.4.gem (100%)
Building native extensions. This could take a while...
Successfully installed cassandra-driver-3.2.4
Fetching: cassandra-web-0.5.0.gem (100%)
Successfully installed cassandra-web-0.5.0
5 gems installed

Ruby Bundler gem is also required by the web user interface. Install it by executing gem command.

# gem install bundler
Fetching: bundler-2.1.4.gem (100%)
Successfully installed bundler-2.1.4
1 gem installed

Configure Linux Firewall:

Cassandra-web interface runs at default port 3000/tcp. Therefore, you have to allow incoming traffic through this port in Linux firewall.

# firewall-cmd --permanent --add-port=3000/tcp
success
# firewall-cmd --reload
success

Create a Database User:

To access the Apache Cassandra nodes, Web interface requires an Admin user.

Create a database user for this purpose as follows.

# cqlsh -u ahmer -p Ahmer@1234
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.11.7 | CQL spec 3.4.4 | Native protocol v4]

Use HELP for help. 

ahmer@cqlsh> CREATE ROLE cassweb WITH PASSWORD = 'Cassweb@1234' AND SUPERUSER = true AND LOGIN = true; 

ahmer@cqlsh> exit 

Starting the Cassandra-web Interface:

Start the Cassandra-web interface by using the following command syntax.

If you have running the Apache Cassandra database on another node then you have to change the hosts address from the following command according to your environment.

# cassandra-web --hosts '127.0.0.1' --port '9042' --username 'cassweb' --password 'Cassweb@1234'
I, [2020-08-01T13:14:42.011519 #52137]  INFO -- : Establishing control connection
I, [2020-08-01T13:14:42.131120 #52137]  INFO -- : Refreshing connected host's metadata
I, [2020-08-01T13:14:42.171751 #52137]  INFO -- : Completed refreshing connected host's metadata
I, [2020-08-01T13:14:42.173263 #52137]  INFO -- : Refreshing peers metadata
I, [2020-08-01T13:14:42.176922 #52137]  INFO -- : Completed refreshing peers metadata
I, [2020-08-01T13:14:42.177016 #52137]  INFO -- : Refreshing schema
I, [2020-08-01T13:14:42.284935 #52137]  INFO -- : Schema refreshed
I, [2020-08-01T13:14:42.285016 #52137]  INFO -- : Control connection established
I, [2020-08-01T13:14:42.285665 #52137]  INFO -- : Creating session
I, [2020-08-01T13:14:42.556420 #52137]  INFO -- : Session created
Thin web server (v1.7.2 codename Bachmanity)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop

Open URL http://cassandra-01.centlinux.com:3000 in a web browser e.g Google Chrome.

Cassandra-web does not provide any user authentication. However, you can configure HTTP basic authentication to control access to Cassandra-web interface.

Click on system_schema.

Cassandra-web interface is working fine.

Create a Systemd Service:

To automate startup of Cassandra-web application, you can create a simple Systemd service.

Create a Systemd service file for Cassandra-web by using vim text editor.

# vi /usr/lib/systemd/system/cassweb.service

Add following lines of code therein.

[Unit]
Description=Cassandra Web

[Service]
Type=simple
ExecStart=cassandra-web --hosts '127.0.0.1' --port '9042' --username 'cassweb' --password 'Cassweb@1234'

[Install]
WantedBy=multi-user.target

Enable and start Cassandra-web Service.

# systemctl enable --now cassweb.service
Created symlink /etc/systemd/system/multi-user.target.wants/cassweb.service â /usr/lib/systemd/system/cassweb.service.

Cassandra Web service has been started.

Conclusion:

In this article, you have learned, how to install Cassandra-web on CentOS 8. Cassandra: The Definitive Guide: Distributed Data at Web Scale 2nd Edition (PAID LINK) by Jeff Carpenter is a very good book and we strongly recommend that you should read it.

Alaric Bird

Alaric Bird is a seasoned Linux System Administrator with over a decade of experience in managing and optimizing Linux-based servers and infrastructure. Known for his expertise in server deployment, security hardening, and performance tuning, Alaric has a deep understanding of various Linux distributions, including Ubuntu, CentOS, and Red Hat Enterprise Linux. His skills extend to cloud platforms like AWS, where he effectively manages virtual private servers and services. Alaric is also proficient in scripting languages such as Bash and Python, which he uses to automate routine tasks, enhancing efficiency and reliability. With a strong commitment to continuous learning, he stays updated with the latest developments in open-source technologies and best practices. His problem-solving abilities, combined with excellent communication skills, make him a valuable asset to any IT team. In addition to his technical expertise, Alaric is passionate about mentoring junior administrators and fostering a collaborative environment.

Share
Published by
Alaric Bird

Recent Posts

Puppy Linux: Fast and Simple OS

Puppy Linux is a fast, lightweight OS designed for speed and simplicity, perfect for old…

1 day ago

Change Apache Document Root in Linux

Learn how to change Apache document root in Linux by following this step-by-step guide. Adjust…

2 weeks ago

How to Change Apache Port in Linux

Discover how to change Apache port in Linux easily. Follow our simple guide to modify…

2 weeks ago

How to Create Virtual Host in Apache Server

Learn how to create a virtual host in Apache Server with this comprehensive guide. Set…

3 weeks ago

10 Practical Tasks for RHCSA Exam with Solutions

Discover 10 practical tasks for the RHCSA exam with step-by-step solutions. Boost your Linux skills…

3 weeks ago

Ultimate Fail2ban Configuration Guide

Discover the ultimate Fail2ban configuration guide. Learn how to set up, customize, and optimize Fail2ban…

4 weeks ago

This website uses cookies.