Learn how to install and configure Cassandra-web on CentOS 8 for an easy-to-use web-based interface to manage Apache Cassandra databases. Follow our step-by-step guide to set up Cassandra-web, resolve dependencies, and access the dashboard. #centlinux #linux #cassandra
Table of Contents
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.
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
Installing Cassandra-web on CentOS 8 provides a convenient web-based interface for managing Apache Cassandra databases. By following the installation steps, configuring the required dependencies, and ensuring proper connectivity, you can efficiently monitor and interact with your Cassandra clusters.
Once installed, you can access the Cassandra-web dashboard from a web browser, making database administration more intuitive and user-friendly.
Need expert AWS and Linux system administration? From cloud architecture to server optimization, I provide reliable and efficient solutions tailored to your needs. Hire me on Fiverr today!
Recommended Training: Amazon DynamoDB Data Modeling for Architects & Developers from Rajeev Sakhuja
FAQs
What is Cassandra-web, and why is it used?
Cassandra-web is a lightweight, web-based GUI tool that allows users to interact with and manage Apache Cassandra databases more easily, providing a visual interface for querying and monitoring data.
What are the prerequisites for installing Cassandra-web on CentOS 8?
Before installing Cassandra-web, ensure that Apache Cassandra is installed and running. Additionally, Python 3, pip
, and necessary dependencies such as cassandra-driver
must be set up.
Why do I need Python to run Cassandra-web?
Cassandra-web is built using Python, and it relies on Python-based libraries like cassandra-driver
to communicate with Cassandra databases, making Python a necessary requirement.
What are the key features of Cassandra-web?
Cassandra-web provides a graphical user interface (GUI) to browse keyspaces, run CQL queries, view table data, and monitor database performance, simplifying database management.
How do I access Cassandra-web after installation?
Once installed and configured, Cassandra-web runs as a web service, and you can access it using a web browser by entering the server’s IP address followed by the configured port number.