-
Install JDK8
1) 获取安装包
$ wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.rpm" -O jdk-8u111-linux-x64.rpm
2) 安装
$ yum -y install jdk-8u111-linux-x64.rpm
-
安装cassandra
$ wget http://mirrors.cnnic.cn/apache/cassandra/3.9/apache-cassandra-3.9-bin.tar.gz -O cassandra-3.9-bin.tar.gz
$ tar -xvf cassandra-3.9-bin.tar.gz
$ vim ~/.bashrc
在末尾追加:export PATH=$PATH:/opt/apache-cassandra-3.9/bin/
$ cassandra -f -R & // 启动Cassandra服务
3、配置cassandra.yaml文件,使得cqlsh 127.0.0.1 或cqlsh 172.2.16.101都能连接到服务器
1) 修改配置项 rpc_address: 0.0.0.0, broadcast_rpc_address:本机广播地址(ifconfig命令可查看)
4、升级版本(3.3.0->3.10)
1) 将现在的CASSANDRA_HOME环境变量指向新版本所在目录
$ vim ~/.bash_profile
$ export CASSANDRA_HOME=/Users/haha/Personal/ProgramFiles/apache-cassandra-3.10
$ export PATH=$PATH:$CASSANDRA_HOME/bin
$ source ~/.bash_profile
2) 新版本的cassandra.yaml文件中,重新配置data_file_directories, saved_cache_directory, commit_log_directory指向旧版本的data目录下相关的目录。
data_file_directories:
- /Users/haha/opt/cassandra/data/data
commitlog_directory: /Users/haha/opt/cassandra/data/commitlog
saved_caches_directory: /Users/haha/opt/cassandra/data/saved_caches
3)停止旧版本(kill 线程),启动新版本(指定cassandra.yaml路径)
>>> cassandra -f -Dcassandra.config=file:///Users/haha/Personal/ProgramFiles/apache-cassandra-3.10/conf/cassandra.yaml
解决exception:
Exception encountered during startup
org.apache.cassandra.exceptions.ConfigurationException: Expecting URI in variable: [cassandra.config]. Found[cassandra.yaml]. Please prefix the file with [file:///] for local files and [file://<server>/] for remote files.
#cqlsh版本控制
>>> cqlsh --cqlversion=“3.4.4”
解决exception: