1.
2.安装JVM
3.OS环境配置:
关闭防火墙:service iptables stop
vi/etc/sysctl.conf
vm.zone_reclaim_mode=0
vm.max_map_count = 262144
vm.swappiness = 1
vi /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 65536
* hard nproc 65536
vi/etc/hosts
192.168.99.6 JacK6
192.168.99.7 JacK7
192.168.99.8 JacK8
192.168.99.9 JacK9
4.添加用户:
useradd -d /data/hadoop -m hadoop
passwd hadoop
5.配置存储:挂在硬盘等
6.Cassandra的安装:
1.建立相关目录:
mkdir -p /data/hadoop/Cassandra_2.2.10
mkdir -p /data/tmp_data/cassan_data/commitlog
mkdir -p /data/tmp_data/cassan_data/saved_caches
mkdir -p /data/tmp_data/cassan_data/tables
2.上传压缩包,解压文件:
tar -xvf /data/tar/apache-cassandra-2.1.18-bin.tar.gz -C /data/hadoop/Cassandra_2.2.18/
cd /data/hadoop/Cassandra_2.2.18/apache-cassandra-2.1.18-bin
mv * ../
cd ..
rm -rf apache-cassandra-2.1.10-bin
3.修改配置文件:
1.修改cassandra.yaml
cd /data/hadoop/Cassandra_2.2.10/conf/
cp cassandra.yaml cassandra.yaml.bak
1.配置基本配置项
vi cassandra.yaml
cluster_name: 'Cluster_JacK'
data_file_directories:
- /data/tmp_data/cassan_data/tables
commitlog_directory: /data/tmp_data/cassan_data/commitlog
saved_caches_directory: /data/tmp_data/cassan_data/saved_caches
seeds: "192.168.99.6"(可以是自己也可以是集群中的任意节点)
listen_address: 192.168.99.6
rpc_address: 192.168.99.6
cp cassandra-env.sh cassandra-env.sh.bak
2.配置远程JMX访问(暂时不配)
vi cassandra-env.sh
if [ "x$LOCAL_JMX" = "x" ]; then
LOCAL_JMX=no
fi
cp/usr/java/jdk1.8.0_51/jre/lib/management/jmxremote.password.template /etc/cassandra/jmxremote.password
chown cassandra.cassandra /etc/cassandra/jmxremote.password
chmod 400 /etc/cassandra/jmxremote.password
echo "cassandra cassandrapassword">>/etc/cassandra/jmxremote.password
sed -i '/controlRole/icassandra readwrite'/usr/java/jdk1.8.0_51/jre/lib/management/jmxremote.access
3.配置用户与权限(暂时不配)
修改cassandra.yaml中的以下两行
authenticator: PasswordAuthenticator
authorizer: CassandraAuthorizer
在cassandra启动后,在第一个seed节点执行以下命令:
echo "ALTER KEYSPACE system_auth WITHREPLICATION={'class':'org.apache.cassandra.locator.SimpleStrategy','replication_factor':'8'};"|cqlsh 10.202.20.191 -ucassandra -pcassandra
注:上面8为整个集群节点数,因为权限认证表需要全集群同步
echo "create user admin with password '123456'superuser;"|cqlsh 10.202.20.191 -ucassandra -pcassandra
echo "drop user cassandra;"|cqlsh 10.202.20.191 -uadmin -p123456
4.其他节点:修改相应的监听地址即可listen_address和rpc_address
7.启动验证
cd /data/hadoop/Cassandra_2.2.10/bin
若在启动过程中报如下错误:listen地址设置成本机的IP地址或者防火墙未关闭
ERROR 03:09:13 Exception encountered during startup
java.lang.RuntimeException: Unable to gossip with any seeds
8.使用cqlsh报如下错误:
[hadoop@JacK7 bin]$ ./cqlsh
No appropriate python interpreter found.
仅支持python2.7,所以安装python2.7