How to Install Apache Cassandra on CentOS 8

How to Install Apache Cassandra on CentOS 8,第1张

How to Install Apache Cassandra on CentOS 8

Step1 : Installing Java in CentOS 8

[root@iZbp1ehco2fi1l7bj6hhphZ ~]# java -version
-bash: java: command not found

Step2 :To install OpenJDK 8, run the following dnf command.
[root@iZbp1ehco2fi1l7bj6hhphZ ~]# sudo dnf install java-1.8.0-openjdk-devel

 

 Step3 : If another version of OpenJDK is installed apart from OpenJDK 8, you can set the default Java version to OpenJDK 8 by running the command below.Currently just one version.using default version.

[root@iZbp1ehco2fi1l7bj6hhphZ ~]# sudo alternatives --config java

 

There is 1 program that provides 'java'.

  Selection    Command
-----------------------------------------------
*  1           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre/bin/java)

Enter to keep the current selection[+], or type selection number: 1

Step4 : Installing Apache Cassandra on CentOS 8

After installing Java, we can now proceed to install Apache Cassandra. Create a new repository file for Apache Cassandra as shown below:

[root@iZbp1ehco2fi1l7bj6hhphZ ~]# sudo vim /etc/yum.repos.d/cassandra.repo

Then add Cassandra’s repository as shown.

[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

Save and exit the repository file.

Step5: install Apache Cassandra using the command:

[root@iZbp1ehco2fi1l7bj6hhphZ ~]# sudo dnf install cassandra -y

 

 Step 6: start Cassandra and confirm its status by invoking the command:

[root@iZbp1ehco2fi1l7bj6hhphZ ~]# sudo systemctl enable cassandra
cassandra.service is not a native service, redirecting to systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable cassandra
[root@iZbp1ehco2fi1l7bj6hhphZ ~]# sudo systemctl start cassandra
[root@iZbp1ehco2fi1l7bj6hhphZ ~]# sudo systemctl status cassandra
● cassandra.service - LSB: distributed storage system for structured data
   Loaded: loaded (/etc/rc.d/init.d/cassandra; generated)
   Active: active (running) since Tue 2022-01-04 17:11:16 CST; 7s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 213658 ExecStart=/etc/rc.d/init.d/cassandra start (code=exited, status=0/SUCCESS)
 Main PID: 213744 (java)
    Tasks: 33 (limit: 22788)
   Memory: 1.2G
   CGroup: /system.slice/cassandra.service
           └─213744 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre/bin/java -Xloggc:/var/log/cassandra/gc.log -ea -XX:+UseThreadPriorities>

Jan 04 17:11:16 iZbp1ehco2fi1l7bj6hhphZ systemd[1]: Starting LSB: distributed storage system for structured data...
Jan 04 17:11:16 iZbp1ehco2fi1l7bj6hhphZ runuser[213670]: pam_unix(runuser:session): session opened for user cassandra by (uid=0)
Jan 04 17:11:16 iZbp1ehco2fi1l7bj6hhphZ runuser[213670]: pam_unix(runuser:session): session closed for user cassandra
Jan 04 17:11:16 iZbp1ehco2fi1l7bj6hhphZ cassandra[213658]: Starting Cassandra: OK
Jan 04 17:11:16 iZbp1ehco2fi1l7bj6hhphZ systemd[1]: Started LSB: distributed storage system for structured data.

Step 7: install python3

[root@iZbp1ehco2fi1l7bj6hhphZ ~]# sudo dnf install python3
Last metadata expiration check: 0:29:20 ago on Tue 04 Jan 2022 04:42:46 PM CST.
Package python36-3.6.8-38.module_el8.5.0+895+a459eca8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

Step 8: install cqlsh

 [root@iZbp1ehco2fi1l7bj6hhphZ ~]# cqlsh
Traceback (most recent call last):
  File "/usr/bin/cqlsh.py", line 169, in
    from cqlshlib import cql3handling, cqlhandling, pylexotron, sslhandling, cqlshhandling
importError: No module named cqlshlib
[root@iZbp1ehco2fi1l7bj6hhphZ ~]# find /usr/lib/ -name cqlshlib
/usr/lib/python3.6/site-packages/cqlshlib
[root@iZbp1ehco2fi1l7bj6hhphZ ~]# export PYTHonPATH=/usr/lib/python3.6/site-packages/
[root@iZbp1ehco2fi1l7bj6hhphZ ~]# cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.11.11 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh>

Another issue , Should be careful. once we install Cassandra, we will meet issue as bleow :

[root@iZbp1ehco2fi1l7bj6hhphZ ~]# sudo dnf install Cassandra
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-epel.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Last metadata expiration check: 0:00:47 ago on Tue 04 Jan 2022 04:20:17 PM CST.
No match for argument: Cassandra
  * Maybe you meant: cassandra
Error: Unable to find a match: Cassandra

How to fix it above?

[root@iZbp1ehco2fi1l7bj6hhphZ ~]# vi /etc/yum.repos.d/CentOS-epel.repo

delete or command  failovermethod=priority

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5697043.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存