环境准备检测

  • 等新依赖
命令行:  hostnamectl set-hostname cassandra.liangglab.cn
命令行:  dnf update -y
命令行:  dnf install -y python2  (安装cassandra运行需要python环境)

  • 使用uname命令验证活动内核的版本
uname -r

  •  验证CentOS操作系统的版本
cat /etc/redhat-release

 添加Apache Cassandra官方Yum存储库
如下所示为Cassendra创建一个repo文件。

[root@cassandra ~]# vi /etc/yum.repos.d/cassandra.repo

在此文件中添加以下指令。

[cassandra]
name=Apache Cassandra
baseurl=https://downloads.apache.org/cassandra/redhat/311x/
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://downloads.apache.org/cassandra/KEYS

为新安装的Cassandra存储库构建yum缓存。如果要求,请接受GPG密钥。

命令行:  dnf makecache
命令行:  dnf clean all
命令行:  dnf repolist

CentOS 8上已安装Apache Cassandra 3.11 yum存储库。

 CentOS 8上安装Apache Cassandra
命令行:  dnf install -y cassandra

运行
启动方式1: service cassandra start 
启动方式2: chkconfig cassandra on

  • 验证cassandra.service的状态。
[root@cassandra ~]# systemctl status cassandra.service

 或者

 service cassandra status

  • 查看cassandra.service的端口监听信息。 
 ss -anplt| grep java

  • 使用nodetool命令来验证Cassandra集群的状态。  
nodetool status

  • 检查一下我们修改的配置内容中。 
cat  /etc/cassandra/conf/cassandra.yaml |egrep 
修改配置后重启生效
systemctl restart cassandra.service