CentOS8にApache Cassandraをインストールする方法

環境
OSバージョンを確認します
# cat/etc/redhat-release
CentOS Stream release 8

操作方法
1.java8をインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo yum -y install epel-release python2 java-1.8.0-openjdk-devel
# sudo yum -y install epel-release python2 java-1.8.0-openjdk-devel
# sudo yum -y install epel-release python2 java-1.8.0-openjdk-devel

2.javaバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# java -version
openjdk version "1.8.0_322"
OpenJDK Runtime Environment (build 1.8.0_322-b06)
OpenJDK 64-Bit Server VM (build 25.322-b06, mixed mode)
# java -version openjdk version "1.8.0_322" OpenJDK Runtime Environment (build 1.8.0_322-b06) OpenJDK 64-Bit Server VM (build 25.322-b06, mixed mode)
# java -version
openjdk version "1.8.0_322"
OpenJDK Runtime Environment (build 1.8.0_322-b06)
OpenJDK 64-Bit Server VM (build 25.322-b06, mixed mode)

pythonのバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# python2.7 --version
Python 2.7.18
# python2.7 --version Python 2.7.18
# python2.7 --version
Python 2.7.18

3.Cassandraポジトリを追加します
# sudo nano /etc/yum.repos.d/cassandra.repo
以下の内容を編集します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
[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
[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
[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

4.Cassandraをインストールします
# sudo yum -y install cassandra

5.サービスを作成します
# sudo nano /etc/systemd/system/cassandra.service
以下の内容を編集します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
[Unit]
Description=Apache Cassandra
After=network.target
[Service]
PIDFile=/var/run/cassandra/cassandra.pid
User=cassandra
Group=cassandra
ExecStart=/usr/sbin/cassandra -f -p /var/run/cassandra/cassandra.pid
Restart=always
[Install]
WantedBy=multi-user.target
[Unit] Description=Apache Cassandra After=network.target [Service] PIDFile=/var/run/cassandra/cassandra.pid User=cassandra Group=cassandra ExecStart=/usr/sbin/cassandra -f -p /var/run/cassandra/cassandra.pid Restart=always [Install] WantedBy=multi-user.target
[Unit]
Description=Apache Cassandra
After=network.target

[Service]
PIDFile=/var/run/cassandra/cassandra.pid
User=cassandra
Group=cassandra
ExecStart=/usr/sbin/cassandra -f -p /var/run/cassandra/cassandra.pid
Restart=always

[Install]
WantedBy=multi-user.target

6.cassandraサービスを起動します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo systemctl daemon-reload
# sudo systemctl start cassandra.service
# sudo systemctl daemon-reload # sudo systemctl start cassandra.service
# sudo systemctl daemon-reload
# sudo systemctl start cassandra.service

cassandraサービスを有効にします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo systemctl enable cassandra
Synchronizing state of cassandra.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable cassandra
Created symlink /etc/systemd/system/multi-user.target.wants/cassandra.service → /etc/systemd/system/cassandra.service.
# sudo systemctl enable cassandra Synchronizing state of cassandra.service with SysV service script with /usr/lib/systemd/systemd-sysv-install. Executing: /usr/lib/systemd/systemd-sysv-install enable cassandra Created symlink /etc/systemd/system/multi-user.target.wants/cassandra.service → /etc/systemd/system/cassandra.service.
# sudo systemctl enable cassandra
Synchronizing state of cassandra.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable cassandra
Created symlink /etc/systemd/system/multi-user.target.wants/cassandra.service → /etc/systemd/system/cassandra.service.

ステータスを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl status cassandra.service
● cassandra.service - Apache Cassandra
Loaded: loaded (/etc/systemd/system/cassandra.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2022-11-13 22:48:47 JST; 50s ago
# systemctl status cassandra.service ● cassandra.service - Apache Cassandra Loaded: loaded (/etc/systemd/system/cassandra.service; enabled; vendor preset: disabled) Active: active (running) since Sun 2022-11-13 22:48:47 JST; 50s ago
# systemctl status cassandra.service
● cassandra.service - Apache Cassandra
   Loaded: loaded (/etc/systemd/system/cassandra.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2022-11-13 22:48:47 JST; 50s ago

 

CentOS Stream 8

Posted by arkgame