Cassandra database installation and deployment

Keywords: Linux Java Apache Docker Python

Installation version

cassandra-3.11.4

System version

more /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)

Dead work

Cassandra database is based on Java platform, so it can run in many operating systems that support Java technology, and it can start working with very little disk space and available memory. For the applications described in this tutorial, the recommended configuration is:

Minimum 2GB RAM available - To install and run a Cassandra database instance, it is recommended that the machine have at least 4GB RAM, of which at least 2GB can be used for the Cassandra instance. 8GB RAM machine is better. If you decide to run Cassandra instances on Docker, each container must have at least 1 GB RAM to run each Cassandra node.
Java 8 - Starting with Apache Cassandra V3, you need to install Java Standard Edition 8 on your machine because Cassandra runs on a Java Virtual Machine (JVM). Old Cassandra versions (such as V2.2) can be run using Java 7. You can type in the operating system prompt shell
java -version
To check your Java version.
Python 2.7 - If you want to use Cassandra node management tool nodetool and shell utility cqlsh, you need to install Python. These tools are useful for getting information about Cassandra instances and their databases and managing them. You can type
python --version to check which Python version you installed.
Docker CE - If you want to configure all Cassandra nodes on containers running on the same machine, you can choose this product. I recommend using it to create a test cluster environment. If you are not familiar with Docker containers, don't worry. Next, I'll describe the commands needed to set up Cassandra clusters. Download the latest Docker CE version for your platform from the Docker website.

Add yum source

cat >/etc/yum.repos.d/cassandra.repo <<-EOF
[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
EOF

install

yum install cassandra -y

To configure

cd /etc/cassandra/conf

cluster_name: 'pte-test'
num_tokens: 256
seed_provider:
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
- seeds: "172.16.2.693"
#listen_address: 172.16.2.693 #Because mirror startup is not sure what the ip address is, the network card is used.

listen_interface: eth0
#rpc_address: 172.16.2.693 #Because mirror startup is not sure what the ip address is, the network card is used.

rpc_interface: eth0
endpoint_snitch: SimpleSnitch

data_file_directories:
- /data/cassandra/data     #Since ssd hard disk is added, a data directory is specified

start-up

systemctl daemon-reload
service cassandra start
chkconfig cassandra on

Start-up inspection

[root@172-16-2-69 conf]# nodetool status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN 172.16.2.131 88.87 KiB 256 48.1% a7311478-5278-4385-be4c-1313f7edf29d rack1
UN 172.16.2.116 109.47 KiB 256 54.1% 29a907a0-f782-4d7e-916c-760d7017617e rack1
UN 172.16.2.228 114.49 KiB 256 50.5% a8a8d7a6-1580-4c2f-9cd8-916d4600e8ff rack1
UN 172.16.2.69 108.62 KiB 256 47.3% 25e080a9-94fc-49a3-a6a2-26fe7c62a309 rack1

Reference documents:

http://cassandra.apache.org/download/

Posted by gabe on Wed, 12 Jun 2019 16:46:55 -0700