Cassandra最小化安裝

Cassandra最小化安裝

環境java

CentOS 7.2 64位node

IP_address:172.27.0.8linux

安裝包裝備apache

[root@master ~]# ll /usr/local/src
total 227828
-rw-r--r-- 1 root root  41235177 Feb 12 06:32 apache-cassandra-3.11.4-bin.tar.gz
-rw-r--r-- 1 root root 191817140 Apr 22 11:09 jdk-8u201-linux-x64.tar.gz

Ⅰ、關閉防火牆

[root@master ~]# systemctl stop firewalld.service
[root@master ~]# systemctl disable firewalld.service
[root@master ~]# setenforce 0
[root@master ~]# sed -i '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config

驗證:
[root@master ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[root@master ~]# getenforce
Disabled

Ⅱ、安裝最新版JDK

tar xvf /usr/local/src/jdk-8u201-linux-x64.tar.gz -C /usr/local
ln -s /usr/local/jdk1.8.0_201/ /usr/local/jdk

配置環境變量:
cat >> /etc/profile << EOF
export JAVA_HOME=/usr/local/jdk
export JRE_HOME=/usr/local/jdk/jre
export CLASSPATH=/usr/local/jdk/jre/lib:/usr/local/jdk/lib
EOF
source /etc/profile
cat >> /etc/profile << EOF
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
EOF
source /etc/profile

驗證:
[root@master]# java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

Ⅲ、安裝Cassandra

3.1 安裝

[root@master]# tar zxvf /usr/local/src/apache-cassandra-3.11.3-bin.tar.gz -C /usr/local
[root@master]# ln -s /usr/local/apache-cassandra-3.11.3/ /usr/local/cassandra/

3.2 編輯最小化配置文件

[root@master]# vim /usr/local/cassandra/conf/cassandra.yaml
cluster_name: '91Porn'

seed_provider:
    - class_name: org.apache.cassandra.locator.SimpleSeedProvider
      parameters:
          # Ex: "<ip1>,<ip2>,<ip3>"
          - seeds: "127.0.0.1"
      
listen_address: 172.27.0.8

data_file_directories:
     - /data/cassandra/data
commitlog_directory: /data/cassandra/commitlog
hints_directory: /data/cassandra/hints
saved_caches_directory: /data/cassandra/saved_caches

具體參數含義後續專門分析

3.3 啓動並驗證Cassandra

[root@master]# cd /usr/local/cassandra && ./bin/cassandra -R
-R 表示用root帳號啓動

查看集羣狀態:
[root@master]# bin/nodetool status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address     Load       Tokens       Owns (effective)  Host ID                               Rack
UN  172.27.0.8  226.27 KiB  256          100.0%            128c15c1-b1f8-448e-b55e-37b01fe49a5a  rack1

cql工具登錄Cassandra:
[root@master]# ./bin/cqlsh 172.27.0.8
Connected to 91Porn at 172.27.0.8:9042.
[cqlsh 5.0.1 | Cassandra 3.11.4 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh>

tips:vim

啓動時jvm報以下錯誤:是由於服務器可用內存不足發生oom了
-XX:+HeapDumpOnOutOfMemoryError
-XX:OnOutOfMemoryError=kill -9 %p
相關文章
相關標籤/搜索