1. 程式人生 > >redhat7.2運行cassandra

redhat7.2運行cassandra

設置linux中jdk版本 cassandra安裝

#機器自帶openjdk-1.8.0,但以經為現有業務安裝了jdk7

1、tar -zxf apache-cassandra-3.10-bin.tar.gz

2、配置環境變量

cd /etc/profile.d

vim cassandra.sh

CASSANDRA_HOME=/opt/deploy/apache-cassandra-3.10

PATH=$PATH:$CASSANDRA_HOME/bin

3、執行cassandra命令,報錯需要jdk1.8.0_u40

配置使用openjdk-1.8.0

cd /opt/deploy/apache-cassandra-3.10/bin

vim cassandra.in.sh

#添加

JAVA_HOME=/usr/lib/jvm/java-openjdk

4、執行cassandra命令,提示

Running Cassandra as root user or group is not recommended - please start Cassandra using a different system user.

If you really want to force running Cassandra as root, use -R command line option.

5、cassandra -R,提示WARN

......

WARN [main] 2017-05-09 11:07:07,068 StartupChecks.java:124 - jemalloc shared library could not be preloaded to speed up memory allocations

WARN [main] 2017-05-09 11:07:07,068 StartupChecks.java:157 - JMX is not enabled to receive remote connections. Please see cassandra-env.sh for more info.

WARN [main] 2017-05-09 11:07:07,069 StartupChecks.java:194 - OpenJDK is not recommended. Please upgrade to the newest Oracle Java release

INFO [main] 2017-05-09 11:07:07,070 SigarLibrary.java:44 - Initializing SIGAR library

WARN [main] 2017-05-09 11:07:07,079 SigarLibrary.java:174 - Cassandra server running in degraded mode. Is swap disabled? : false, Address space adequate? : true, nofile limit adequate? : false, nproc limit adequate? : true

#cassandar會自動新建data內的子目錄

WARN [main] 2017-05-09 11:07:07,085 StartupChecks.java:236 - Directory ./../data/data doesn‘t exist

WARN [main] 2017-05-09 11:07:07,087 StartupChecks.java:236 - Directory ./../data/commitlog doesn‘t exist

WARN [main] 2017-05-09 11:07:07,088 StartupChecks.java:236 - Directory ./../data/saved_caches doesn‘t exist

WARN [main] 2017-05-09 11:07:07,088 StartupChecks.java:236 - Directory /opt/deploy/apache-cassandra-3.10/bin/./../data/hints doesn‘t exist

......

6、安裝jdk1.8

rpm -i jdk-8u131-linux-x64.rpm

rm -f /usr/java/default

#默認jdk依舊設置為1.7

ln -sv /usr/java/jdk1.7.0_80 /usr/java/default

vim cassandra.in.sh

JAVA_HOME=/usr/java/jdk-1.8.0_131

7、cd ~

cassandra -p ./cassandra/pid -R


8、關閉cassandra的命令,依據stop-server的提示

將stop-server內容改為

kill `cat ~/.cassandra/pid`

rm -f ~/.cassandra/pid


9、建立start-server

vim start-server

cassandra -p ./cassandra/pid -R

chmod 755 start-server


以後就可以start-server,stop-server搭配使用了


本文出自 “記筆記” 博客,請務必保留此出處http://dressame.blog.51cto.com/12551541/1923615

redhat7.2運行cassandra