1、配置电脑让vmware下的虚拟联网
2、更改网络yum源为国内的阿里云
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
3、安装gcc-c++
yum -y install gcc-c++
4、下载redis
wget http://download.redis.io/releases/redis-3.2.11.tar.gz
5、解压压缩包后进行安装
tar -zxf redis-3.2.11.tar.gz
make
make PREFIX=/usr/local/redis install
cp /usr/local/src/redis-3.2.11/redis.conf /usr/local/redis/
6、创建节点
mkdir redis_cluster
cd redis_cluster
mkdir 6379 6380 6381 6382 6383 6384
7、配置配置文件
port 6379
daemonize
yes
pidfile /var/run/redis6379.pid
cluster-enabled yes
cluster-config-file nodes_6379.conf
cluster-node-timeout 15000
8、启动所有redis
9、安装ruby
yum -y install ruby ruby-devel rubygems rpm-build
10、安装rubygem redis依赖
wget http://rubygems.org/downloads/redis-3.3.0.gem
gem install -l redis-3.3.0.gem
11、使用redis-trib.rb搭建集群
cp redis-trib.rb /usr/local/bin
redis-trib.rb create --replicas 1 127.0.0.1:6379 127.0.0.1:6380 127.0.0.1:6381 127.0.0.1:6382 127.0.0.1:6383 127.0.0.1:6384
12、验证集群
/usr/local/redis/bin/redis-cli -c -p 6379
/usr/local/redis/bin/redis-cli -c -p 6380
/usr/local/redis/bin/redis-cli -c -p 6381
/usr/local/redis/bin/redis-cli -c -p 6382
/usr/local/redis/bin/redis-cli -c -p 6383
/usr/local/redis/bin/redis-cli -c -p 6384
QQ群:979499172
网友评论