更新系统
yum install -y gcc g++ gcc-c++ make
yum -y update
下载Redis
cd /opt/
wget http://download.redis.io/releases/redis-4.0.10.tar.gz
tar xzf redis-4.0.10.tar.gz
创建Cluster文件夹
mkdir /opt/redis-4.0.10/redis-cluster
cd /opt/redis-4.0.10/redis-cluster
创建配置文件
mkdir 7000
vi 7000/redis.conf
添加配置如下
port 7000
bind 192.168.10.164
daemonize yes
pidfile /var/run/redis_7000.pid
cluster-enabled yes
cluster-config-file nodes_7000.conf
cluster-node-timeout 10100
appendonly no
启动实例
/opt/redis-4.0.10/src/redis-server /opt/redis-4.0.10/redis-cluster/7000/redis.conf
检查实例是否启动
ps -ef | grep redis
netstat -tnlp | grep redis
安装管理脚本依赖包
yum -y install ruby ruby-devel rubygems rpm-build
gem install redis
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
curl -L get.rvm.io | bash -s stable
find / -name rvm -print
/usr/local/rvm/bin/rvm list
/usr/local/rvm/bin/rvm install 2.3.3
rvm use 2.3.3
/usr/local/rvm/bin/rvm use 2.3.3
/usr/local/rvm/bin/rvm use 2.3.3 --default
配置Ruby环境变量
vi /etc/profile.d/rvm.sh
添加以下内容
#
# RVM profile
#
# /etc/profile.d/rvm.sh # sh extension required for loading.
#
if
[ -n "${BASH_VERSION:-}" -o -n "${ZSH_VERSION:-}" ] &&
test "`\command \ps -p $$ -o ucomm=`" != dash &&
test "`\command \ps -p $$ -o ucomm=`" != sh
then
[[ -n "${rvm_stored_umask:-}" ]] || export rvm_stored_umask=$(umask)
# Load user rvmrc configurations, if exist
for file in "/etc/rvmrc" "$HOME/.rvmrc"
do
[[ -s "$file" ]] && source $file
done
if
[[ -n "${rvm_prefix:-}" ]] &&
[[ -s "${rvm_prefix}/.rvmrc" ]] &&
[[ ! "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]
then
source "${rvm_prefix}/.rvmrc"
fi
# Load RVM if it is installed, try user then root install.
if
[[ -s "$rvm_path/scripts/rvm" ]]
then
source "$rvm_path/scripts/rvm"
elif
[[ -s "$HOME/.rvm/scripts/rvm" ]]
then
true ${rvm_path:="$HOME/.rvm"}
source "$HOME/.rvm/scripts/rvm"
elif
[[ -s "/usr/local/rvm/scripts/rvm" ]]
then
true ${rvm_path:="/usr/local/rvm"}
source "/usr/local/rvm/scripts/rvm"
fi
# Add $rvm_bin_path to $PATH if necessary. Make sure this is the last PATH variable change.
if [[ -n "${rvm_bin_path}" && ! ":${PATH}:" == *":${rvm_bin_path}:"* ]]
then PATH="${PATH}:${rvm_bin_path}"
fi
fi
启动集群
/opt/redis-4.0.10/src/redis-trib.rb create --replicas 1 192.168.10.164:7000 192.168.10.165:7000 192.168.10.166:7000 192.168.10.167:7000 192.168.10.168:7000 192.168.10.169:7000
网友评论