download the centos7.1
http://www.centoscn.com/CentosSoft/iso/2015/0402/5070.html
thunder://QUFodHRwOi8vbGludXgueGl0b25neHoubmV0OjgwOC8yMDE2MDMvQ2VudE9TLTcteDg2XzY0LURWRC0xNTAzLTAxLmlzb1pa
1.首先安装reids最新版本吧~
-
wget http://download.redis.io/releases/redis-3.2.8.tar.gz
-
tar xzf redis-3.2.8.tar.gz
-
cd redis-3.2.8
-
make
如果是单节点的redis,安装后可以直接启动。
2.安装ruby软件包
3.安装rubygams软件包
-
https://rubygems.org/pages/download
-
tar -zxvf rubygems-2.2.2.tar
-
cd rubygems-2.2.2
-
ruby setup.rb
4.不出所料的话,会报错:`require':cannot load such file -- json/pure
安装json_pure
5.安装redis (重复安装)
6.创建多个文件夹7000-7005
将redis.conf 复制到各个目录下
cp redis.conf 7000
.....
cp redis.conf 7005
7.修改redis.conf配置文件的内容
-
port 7000 //端口7000,7002,7003
-
bind 本机ip //默认ip为127.0.0.1 需要改为其他节点机器可访问的ip 否则创建集群时无法访问对应的端口,无法创建集群
-
daemonize yes //redis后台运行
-
pidfile /var/run/redis_7000.pid //pidfile文件对应7000,7001,7002
-
cluster-enabled yes //开启集群 把注释#去掉
-
cluster-config-file nodes_7000.conf //集群的配置 配置文件首次启动自动生成 7000,7001,7002
-
cluster-node-timeout 15000 //请求超时 默认15秒,可自行设置
-
appendonly yes //aof日志开启 有需要就开启,它会每次写操作都记录一条日志
linux替换文本内容
:g/str1/s//str2/g
7.启动各节点
redis-server 7000/redis.conf
......7001
......7005
8.创建集群
-
./redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005
-
>>> Creating cluster
-
Connecting to node 127.0.0.1:7000: OK
-
Connecting to node 127.0.0.1:7001: OK
-
Connecting to node 127.0.0.1:7002: OK
-
Connecting to node 127.0.0.1:7003: OK
-
Connecting to node 127.0.0.1:7004: OK
-
Connecting to node 127.0.0.1:7005: OK
(责任编辑:IT) |