首页 > 代码库 > redhat7.2运行cassandra

redhat7.2运行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