【redis】 linux 下redis 集群环境搭建

时间:2024-05-03 23:36:08

Redis集群

(要让集群正常工作至少需要3个主节点,在这里我们要创建6个redis节点,其中三个为主节点,三个为从节点,对应的redis节点的ip和端口对应关系如下)

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

1:下载redis。官网下载3.0.7版本

下载地址:http://download.redis.io/releases/redis-3.0.7.tar.gz

2:上传服务器,解压,编译

tar -zxvf redis-3.0.7.tar.gz

mv redis-3.0.7.tar.gz redis3.0

cd /usr/local/redis3.0

make

make instal

3:配置集群环境

vi redis.conf

##修改配置文件中的下面选项

port 6379

daemonize yes

appendonly yes

cluster-enabled yes

cluster-config-file  nodes-6379.conf

cluster-node-timeout 15000

6:执行redis的创建集群命令创建集群

分别启动这6个redis实例

./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

错误内容:/usr/bin/env: ruby: No such file or directory6.1执行上面的命令的时候会报错,因为是执行的ruby的脚本,需要ruby的环境

所以需要安装ruby的环境,这里推荐使用yum install ruby安装

yum install ruby

6.2然后再执行第6步的创建集群命令,还会报错,提示缺少rubygems组件,使用yum安装

yum install rubygems

错误内容:

./redis-trib.rb:24:in `require': no such file to load -- rubygems (LoadError)

from ./redis-trib.rb:24

6.3再次执行第6步的命令,还会报错,提示不能加载redis,是因为缺少redis和ruby的接口,使用gem 安装

gem install redis

错误内容:

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- redis (LoadError)

from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'

from ./redis-trib.rb:25

6.4 再次执行第6步的命令,正常执行

[root@iZ28afos96aZ src]# ./redis-trib.rb create --replicas 1 127.0.0.1:6384 127.0.0.1:6383 127.0.0.1:6382 127.0.0.1:6381 127.0.0.1:6380 127.0.0.1:6379
>>> Creating cluster
>>> Performing hash slots allocation on nodes...
Using masters:
127.0.0.1:
127.0.0.1:
127.0.0.1:
Adding replica 127.0.0.1: to 127.0.0.1:
Adding replica 127.0.0.1: to 127.0.0.1:
Adding replica 127.0.0.1: to 127.0.0.1:
M: d75e3842921a04d2e530a899194fb5ee92b6fa91 127.0.0.1:
slots:- ( slots) master
M: a74e0aa159bcec51dfc94dd52d13f93f1c45ca1a 127.0.0.1:
slots:- ( slots) master
M: cafe8b69992c2171ad2d1119f65b242e315a68e2 127.0.0.1:
slots:- ( slots) master
S: d3826c34d09550a4d56d1569eb5bd652548f7a91 127.0.0.1:
replicates d75e3842921a04d2e530a899194fb5ee92b6fa91
S: 0d78e8b3bff995b41c18b2edbbc9ea870f9c1c4a 127.0.0.1:
replicates a74e0aa159bcec51dfc94dd52d13f93f1c45ca1a
S: fdacca0da5627679ad3e22ee49efc4611e584fae 127.0.0.1:
replicates cafe8b69992c2171ad2d1119f65b242e315a68e2
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join.....
>>> Performing Cluster Check (using node 127.0.0.1:)
M: d75e3842921a04d2e530a899194fb5ee92b6fa91 127.0.0.1:
slots:- ( slots) master
M: a74e0aa159bcec51dfc94dd52d13f93f1c45ca1a 127.0.0.1:
slots:- ( slots) master
M: cafe8b69992c2171ad2d1119f65b242e315a68e2 127.0.0.1:
slots:- ( slots) master
M: d3826c34d09550a4d56d1569eb5bd652548f7a91 127.0.0.1:
slots: ( slots) master
replicates d75e3842921a04d2e530a899194fb5ee92b6fa91
M: 0d78e8b3bff995b41c18b2edbbc9ea870f9c1c4a 127.0.0.1:
slots: ( slots) master
replicates a74e0aa159bcec51dfc94dd52d13f93f1c45ca1a
M: fdacca0da5627679ad3e22ee49efc4611e584fae 127.0.0.1:
slots: ( slots) master
replicates cafe8b69992c2171ad2d1119f65b242e315a68e2
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All slots covered.

输入yes,然后配置完成。

至此redis集群即搭建成功!

7:使用redis-cli命令进入集群环境

redis-cli -c -p 6379

附上信息:

[root@iZ28afos96aZ home]# yum install ruby
Loaded plugins: security
base | 3.7 kB 00:00
epel | 4.3 kB 00:00
epel/primary_db | 5.9 MB 00:06
extras | 3.4 kB 00:00
puppetlabs-deps | 2.5 kB 00:00
puppetlabs-deps/primary_db | 47 kB 00:04
puppetlabs-products | 2.5 kB 00:00
puppetlabs-products/primary_db | 154 kB 00:08
updates | 3.4 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ruby.x86_64 0:1.8.7.374-4.el6_6 will be installed
--> Processing Dependency: ruby-libs = 1.8.7.374-4.el6_6 for package: ruby-1.8.7.374-4.el6_6.x86_64
--> Processing Dependency: libruby.so.1.8()(64bit) for package: ruby-1.8.7.374-4.el6_6.x86_64
--> Running transaction check
---> Package ruby-libs.x86_64 0:1.8.7.374-4.el6_6 will be installed
--> Processing Dependency: libreadline.so.5()(64bit) for package: ruby-libs-1.8.7.374-4.el6_6.x86_64
--> Running transaction check
---> Package compat-readline5.x86_64 0:5.2-17.1.el6 will be installed
--> Finished Dependency Resolution Dependencies Resolved ================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
ruby x86_64 1.8.7.374-4.el6_6 base 538 k
Installing for dependencies:
compat-readline5 x86_64 5.2-17.1.el6 base 130 k
ruby-libs x86_64 1.8.7.374-4.el6_6 base 1.7 M Transaction Summary
================================================================================
Install 3 Package(s) Total download size: 2.3 M
Installed size: 7.8 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): compat-readline5-5.2-17.1.el6.x86_64.rpm | 130 kB 00:00
(2/3): ruby-1.8.7.374-4.el6_6.x86_64.rpm | 538 kB 00:00
(3/3): ruby-libs-1.8.7.374-4.el6_6.x86_64.rpm | 1.7 MB 00:01
--------------------------------------------------------------------------------
Total 1.0 MB/s | 2.3 MB 00:02
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : compat-readline5-5.2-17.1.el6.x86_64 1/3
Installing : ruby-libs-1.8.7.374-4.el6_6.x86_64 2/3
Installing : ruby-1.8.7.374-4.el6_6.x86_64 3/3
Verifying : compat-readline5-5.2-17.1.el6.x86_64 1/3
Verifying : ruby-libs-1.8.7.374-4.el6_6.x86_64 2/3
Verifying : ruby-1.8.7.374-4.el6_6.x86_64 3/3 Installed:
ruby.x86_64 0:1.8.7.374-4.el6_6 Dependency Installed:
compat-readline5.x86_64 0:5.2-17.1.el6 ruby-libs.x86_64 0:1.8.7.374-4.el6_6 Complete!
[root@iZ28afos96aZ home]# ls
apache-tomcat-8.0.33 redis-3.0.7_2 redis-3.0.7_6 softs
hadoop redis-3.0.7_3 redis-3.0.7_7 svnrepos
redis redis-3.0.7_4 reids zlib-1.2.8
redis-3.0.7_1 redis-3.0.7_5 ruby-2.3.1 zlib-1.2.8.tar.gz
[root@iZ28afos96aZ home]# ruby -v
ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-
linux]
[root@iZ28afos96aZ home]# cd redis-3.0.7_1
[root@iZ28afos96aZ redis-3.0.7_1]# ls
00-RELEASENOTES COPYING Makefile redis.conf runtest-sentinel tests
BUGS deps MANIFESTO runtest sentinel.conf utils
CONTRIBUTING INSTALL README runtest-cluster src
[root@iZ28afos96aZ redis-3.0.7_1]# cd src
[root@iZ28afos96aZ src]# ls
adlist.c crc64.h memtest.o redis-cli sort.c
adlist.h crc64.o mkreleasehdr.sh redis-cli.c sort.o
adlist.o db.c multi.c redis-cli.o sparkline.c
ae.c db.o multi.o redis.h sparkline.h
ae_epoll.c debug.c networking.c redis.o sparkline.o
ae_evport.c debug.o networking.o redis-sentinel syncio.c
ae.h dict.c notify.c redis-server syncio.o
ae_kqueue.c dict.h notify.o redis-trib.rb testhelp.h
ae.o dict.o object.c release.c t_hash.c
ae_select.c dump.rdb object.o release.h t_hash.o
anet.c endianconv.c pqsort.c release.o t_list.c
anet.h endianconv.h pqsort.h replication.c t_list.o
anet.o endianconv.o pqsort.o replication.o t_set.c
aof.c fmacros.h pubsub.c rio.c t_set.o
aof.o help.h pubsub.o rio.h t_string.c
asciilogo.h hyperloglog.c rand.c rio.o t_string.o
bio.c hyperloglog.o rand.h scripting.c t_zset.c
bio.h intset.c rand.o scripting.o t_zset.o
bio.o intset.h rdb.c sds.c util.c
bitops.c intset.o rdb.h sds.h util.h
bitops.o latency.c rdb.o sds.o util.o
blocked.c latency.h redisassert.h sentinel.c valgrind.sup
blocked.o latency.o redis-benchmark sentinel.o version.h
cluster.c lzf_c.c redis-benchmark.c setproctitle.c ziplist.c
cluster.h lzf_c.o redis-benchmark.o setproctitle.o ziplist.h
cluster.o lzf_d.c redis.c sha1.c ziplist.o
config.c lzf_d.o redis-check-aof sha1.h zipmap.c
config.h lzf.h redis-check-aof.c sha1.o zipmap.h
config.o lzfP.h redis-check-aof.o slowlog.c zipmap.o
crc16.c Makefile redis-check-dump slowlog.h zmalloc.c
crc16.o Makefile.dep redis-check-dump.c slowlog.o zmalloc.h
crc64.c memtest.c redis-check-dump.o solarisfixes.h zmalloc.o
[root@iZ28afos96aZ src]# ./redis-server ../redis.conf
[root@iZ28afos96aZ src]# cd..
-bash: cd..: command not found
[root@iZ28afos96aZ src]# cd ..
[root@iZ28afos96aZ redis-3.0.7_1]# ls
00-RELEASENOTES COPYING Makefile redis.conf runtest-sentinel tests
BUGS deps MANIFESTO runtest sentinel.conf utils
CONTRIBUTING INSTALL README runtest-cluster src
[root@iZ28afos96aZ redis-3.0.7_1]# cd ..
[root@iZ28afos96aZ home]# cd re
-bash: cd: re: No such file or directory
[root@iZ28afos96aZ home]# cd redis
[root@iZ28afos96aZ redis]# ls
cluser data logs
[root@iZ28afos96aZ redis]# cd logs
[root@iZ28afos96aZ logs]# ls
redis-6379.log redis-6380.log redis-6382.log
[root@iZ28afos96aZ logs]# more redis-6379.log
4001:M 05 May 23:33:28.240 # Creating Server TCP listening socket *:6379: bind:
Address already in use
[root@iZ28afos96aZ logs]# ps -aux|grep redis
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
root 4012 0.0 0.0 103252 840 pts/8 S+ 23:35 0:00 grep redis
root 22201 0.0 0.3 137448 7524 ? Sl 13:04 0:20 ./redis-server *:6379
root 22383 0.0 0.4 137444 7800 ? Sl 13:16 0:22 ./redis-server *:6380 [cluster]
root 22417 0.0 0.4 137448 7812 ? Sl 13:18 0:22 ./redis-server *:6381 [cluster]
root 22480 0.0 0.3 137444 7464 ? Sl 13:22 0:22 ./redis-server *:6383 [cluster]
root 22507 0.0 0.4 137448 7812 ? Sl 13:23 0:22 ./redis-server *:6384 [cluster]
root 22515 0.0 0.3 137444 7484 ? Sl 13:24 0:21 ./redis-server *:6382 [cluster]
[root@iZ28afos96aZ logs]# ls
redis-6379.log redis-6380.log redis-6382.log
[root@iZ28afos96aZ logs]# ls
redis-6379.log redis-6380.log redis-6382.log
[root@iZ28afos96aZ logs]# cd ..
[root@iZ28afos96aZ redis]# ls
cluser data logs
[root@iZ28afos96aZ redis]# cd ..
[root@iZ28afos96aZ home]# cd redis-3.0.7_1
[root@iZ28afos96aZ redis-3.0.7_1]# ls
00-RELEASENOTES COPYING Makefile redis.conf runtest-sentinel tests
BUGS deps MANIFESTO runtest sentinel.conf utils
CONTRIBUTING INSTALL README runtest-cluster src
[root@iZ28afos96aZ redis-3.0.7_1]# cd src
[root@iZ28afos96aZ src]# ls
adlist.c crc64.h memtest.o redis-cli sort.c
adlist.h crc64.o mkreleasehdr.sh redis-cli.c sort.o
adlist.o db.c multi.c redis-cli.o sparkline.c
ae.c db.o multi.o redis.h sparkline.h
ae_epoll.c debug.c networking.c redis.o sparkline.o
ae_evport.c debug.o networking.o redis-sentinel syncio.c
ae.h dict.c notify.c redis-server syncio.o
ae_kqueue.c dict.h notify.o redis-trib.rb testhelp.h
ae.o dict.o object.c release.c t_hash.c
ae_select.c dump.rdb object.o release.h t_hash.o
anet.c endianconv.c pqsort.c release.o t_list.c
anet.h endianconv.h pqsort.h replication.c t_list.o
anet.o endianconv.o pqsort.o replication.o t_set.c
aof.c fmacros.h pubsub.c rio.c t_set.o
aof.o help.h pubsub.o rio.h t_string.c
asciilogo.h hyperloglog.c rand.c rio.o t_string.o
bio.c hyperloglog.o rand.h scripting.c t_zset.c
bio.h intset.c rand.o scripting.o t_zset.o
bio.o intset.h rdb.c sds.c util.c
bitops.c intset.o rdb.h sds.h util.h
bitops.o latency.c rdb.o sds.o util.o
blocked.c latency.h redisassert.h sentinel.c valgrind.sup
blocked.o latency.o redis-benchmark sentinel.o version.h
cluster.c lzf_c.c redis-benchmark.c setproctitle.c ziplist.c
cluster.h lzf_c.o redis-benchmark.o setproctitle.o ziplist.h
cluster.o lzf_d.c redis.c sha1.c ziplist.o
config.c lzf_d.o redis-check-aof sha1.h zipmap.c
config.h lzf.h redis-check-aof.c sha1.o zipmap.h
config.o lzfP.h redis-check-aof.o slowlog.c zipmap.o
crc16.c Makefile redis-check-dump slowlog.h zmalloc.c
crc16.o Makefile.dep redis-check-dump.c slowlog.o zmalloc.h
crc64.c memtest.c redis-check-dump.o solarisfixes.h zmalloc.o
[root@iZ28afos96aZ src]# ./redis-trib.rb create --replicas 1 127.0.0.1:6384 127.0.0.1:6383 127.0.0.1:6382 127.0.0.1:6381 127.0.0.1:6380 127.0.0.1:6379
./redis-trib.rb:24:in `require': no such file to load -- rubygems (LoadError)
from ./redis-trib.rb:24

[root@iZ28afos96aZ src]# yum install rubygems
Loaded plugins: security

Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package rubygems.noarch 0:1.3.7-5.el6 will be installed
--> Processing Dependency: ruby-rdoc for package: rubygems-1.3.7-5.el6.noarch
--> Running transaction check
---> Package ruby-rdoc.x86_64 0:1.8.7.374-4.el6_6 will be installed
--> Processing Dependency: ruby-irb = 1.8.7.374-4.el6_6 for package: ruby-rdoc-1.8.7.374-4.el6_6.x86_64
--> Running transaction check
---> Package ruby-irb.x86_64 0:1.8.7.374-4.el6_6 will be installed
--> Finished Dependency Resolution Dependencies Resolved ================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
rubygems noarch 1.3.7-5.el6 base 207 k
Installing for dependencies:
ruby-irb x86_64 1.8.7.374-4.el6_6 base 317 k
ruby-rdoc x86_64 1.8.7.374-4.el6_6 base 381 k Transaction Summary
================================================================================
Install 3 Package(s) Total download size: 905 k
Installed size: 3.0 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): ruby-irb-1.8.7.374-4.el6_6.x86_64.rpm | 317 kB 00:00
(2/3): ruby-rdoc-1.8.7.374-4.el6_6.x86_64.rpm | 381 kB 00:00
(3/3): rubygems-1.3.7-5.el6.noarch.rpm | 207 kB 00:00
--------------------------------------------------------------------------------
Total 1.3 MB/s | 905 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : ruby-irb-1.8.7.374-4.el6_6.x86_64 1/3
Installing : ruby-rdoc-1.8.7.374-4.el6_6.x86_64 2/3
Installing : rubygems-1.3.7-5.el6.noarch 3/3
Verifying : ruby-rdoc-1.8.7.374-4.el6_6.x86_64 1/3
Verifying : ruby-irb-1.8.7.374-4.el6_6.x86_64 2/3
Verifying : rubygems-1.3.7-5.el6.noarch 3/3 Installed:
rubygems.noarch 0:1.3.7-5.el6 Dependency Installed:
ruby-irb.x86_64 0:1.8.7.374-4.el6_6 ruby-rdoc.x86_64 0:1.8.7.374-4.el6_6 Complete!
[root@iZ28afos96aZ src]# ./redis-trib.rb create --replicas 1 127.0.0.1:6384 127.0.0.1:6383 127.0.0.1:6382 127.0.0.1:6381 127.0.0.1:6380 127.0.0.1:6379

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- redis (LoadError)
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from ./redis-trib.rb:25
[root@iZ28afos96aZ src]# gem install redis
Successfully installed redis-3.3.0
1 gem installed
Installing ri documentation for redis-3.3.0...
Installing RDoc documentation for redis-3.3.0...
[root@iZ28afos96aZ src]# ./redis-trib.rb create --replicas 1 127.0.0.1:6384 127.0.0.1:6383 127.0.0.1:6382 127.0.0.1:6381 127.0.0.1:6380 127.0.0.1:6379
>>> Creating cluster
[ERR] Node 127.0.0.1:6379 is not configured as a cluster node.
[root@iZ28afos96aZ src]# ps -aux|grep redis
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
root 4288 0.0 0.0 103252 840 pts/8 S+ 23:44 0:00 grep redis
root 22201 0.0 0.3 137448 7532 ? Sl 13:04 0:20 ./redis-server *:6379
root 22383 0.0 0.4 137444 7836 ? Sl 13:16 0:23 ./redis-server *:6380 [cluster]
root 22417 0.0 0.4 137448 7844 ? Sl 13:18 0:23 ./redis-server *:6381 [cluster]
root 22480 0.0 0.3 137444 7624 ? Sl 13:22 0:23 ./redis-server *:6383 [cluster]
root 22507 0.0 0.4 137448 7844 ? Sl 13:23 0:22 ./redis-server *:6384 [cluster]
root 22515 0.0 0.3 137444 7628 ? Sl 13:24 0:22 ./redis-server *:6382 [cluster]
[root@iZ28afos96aZ src]# ./redis-trib.rb create --replicas 1 127.0.0.1:6384 127.0.0.1:6383 127.0.0.1:6382 127.0.0.1:6381 127.0.0.1:6380
>>> Creating cluster
*** ERROR: Invalid configuration for cluster creation.
*** Redis Cluster requires at least 3 master nodes.
*** This is not possible with 5 nodes and 1 replicas per node.
*** At least 6
nodes are required.
[root@iZ28afos96aZ src]# ls
adlist.c crc64.h memtest.o redis-cli sort.c
adlist.h crc64.o mkreleasehdr.sh redis-cli.c sort.o
adlist.o db.c multi.c redis-cli.o sparkline.c
ae.c db.o multi.o redis.h sparkline.h
ae_epoll.c debug.c networking.c redis.o sparkline.o
ae_evport.c debug.o networking.o redis-sentinel syncio.c
ae.h dict.c notify.c redis-server syncio.o
ae_kqueue.c dict.h notify.o redis-trib.rb testhelp.h
ae.o dict.o object.c release.c t_hash.c
ae_select.c dump.rdb object.o release.h t_hash.o
anet.c endianconv.c pqsort.c release.o t_list.c
anet.h endianconv.h pqsort.h replication.c t_list.o
anet.o endianconv.o pqsort.o replication.o t_set.c
aof.c fmacros.h pubsub.c rio.c t_set.o
aof.o help.h pubsub.o rio.h t_string.c
asciilogo.h hyperloglog.c rand.c rio.o t_string.o
bio.c hyperloglog.o rand.h scripting.c t_zset.c
bio.h intset.c rand.o scripting.o t_zset.o
bio.o intset.h rdb.c sds.c util.c
bitops.c intset.o rdb.h sds.h util.h
bitops.o latency.c rdb.o sds.o util.o
blocked.c latency.h redisassert.h sentinel.c valgrind.sup
blocked.o latency.o redis-benchmark sentinel.o version.h
cluster.c lzf_c.c redis-benchmark.c setproctitle.c ziplist.c
cluster.h lzf_c.o redis-benchmark.o setproctitle.o ziplist.h
cluster.o lzf_d.c redis.c sha1.c ziplist.o
config.c lzf_d.o redis-check-aof sha1.h zipmap.c
config.h lzf.h redis-check-aof.c sha1.o zipmap.h
config.o lzfP.h redis-check-aof.o slowlog.c zipmap.o
crc16.c Makefile redis-check-dump slowlog.h zmalloc.c
crc16.o Makefile.dep redis-check-dump.c slowlog.o zmalloc.h
crc64.c memtest.c redis-check-dump.o solarisfixes.h zmalloc.o
[root@iZ28afos96aZ src]# cd ..
[root@iZ28afos96aZ redis-3.0.7_1]# ls
00-RELEASENOTES COPYING Makefile redis.conf runtest-sentinel tests
BUGS deps MANIFESTO runtest sentinel.conf utils
CONTRIBUTING INSTALL README runtest-cluster src
[root@iZ28afos96aZ redis-3.0.7_1]# cd src
[root@iZ28afos96aZ src]# ls
adlist.c crc64.h memtest.o redis-cli sort.c
adlist.h crc64.o mkreleasehdr.sh redis-cli.c sort.o
adlist.o db.c multi.c redis-cli.o sparkline.c
ae.c db.o multi.o redis.h sparkline.h
ae_epoll.c debug.c networking.c redis.o sparkline.o
ae_evport.c debug.o networking.o redis-sentinel syncio.c
ae.h dict.c notify.c redis-server syncio.o
ae_kqueue.c dict.h notify.o redis-trib.rb testhelp.h
ae.o dict.o object.c release.c t_hash.c
ae_select.c dump.rdb object.o release.h t_hash.o
anet.c endianconv.c pqsort.c release.o t_list.c
anet.h endianconv.h pqsort.h replication.c t_list.o
anet.o endianconv.o pqsort.o replication.o t_set.c
aof.c fmacros.h pubsub.c rio.c t_set.o
aof.o help.h pubsub.o rio.h t_string.c
asciilogo.h hyperloglog.c rand.c rio.o t_string.o
bio.c hyperloglog.o rand.h scripting.c t_zset.c
bio.h intset.c rand.o scripting.o t_zset.o
bio.o intset.h rdb.c sds.c util.c
bitops.c intset.o rdb.h sds.h util.h
bitops.o latency.c rdb.o sds.o util.o
blocked.c latency.h redisassert.h sentinel.c valgrind.sup
blocked.o latency.o redis-benchmark sentinel.o version.h
cluster.c lzf_c.c redis-benchmark.c setproctitle.c ziplist.c
cluster.h lzf_c.o redis-benchmark.o setproctitle.o ziplist.h
cluster.o lzf_d.c redis.c sha1.c ziplist.o
config.c lzf_d.o redis-check-aof sha1.h zipmap.c
config.h lzf.h redis-check-aof.c sha1.o zipmap.h
config.o lzfP.h redis-check-aof.o slowlog.c zipmap.o
crc16.c Makefile redis-check-dump slowlog.h zmalloc.c
crc16.o Makefile.dep redis-check-dump.c slowlog.o zmalloc.h
crc64.c memtest.c redis-check-dump.o solarisfixes.h zmalloc.o
[root@iZ28afos96aZ src]# ./re
-bash: ./re: No such file or directory
[root@iZ28afos96aZ src]# ./redis-cli
127.0.0.1:6379> get
(error) ERR wrong number of arguments for 'get' command
127.0.0.1:6379> exit
[root@iZ28afos96aZ src]# ./redis-cli shutdown
[root@iZ28afos96aZ src]# ./redis-server ../redis.conf
[root@iZ28afos96aZ src]# ps -aux|grep redis
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
root 4327 0.0 0.3 137444 7508 ? Ssl 23:50 0:00 ./redis-server *:6379 [cluster]
root 4335 0.0 0.0 103252 840 pts/8 S+ 23:50 0:00 grep redis
root 22383 0.0 0.4 137444 7836 ? Sl 13:16 0:23 ./redis-server *:6380 [cluster]
root 22417 0.0 0.4 137448 7848 ? Sl 13:18 0:23 ./redis-server *:6381 [cluster]
root 22480 0.0 0.3 137444 7624 ? Sl 13:22 0:23 ./redis-server *:6383 [cluster]
root 22507 0.0 0.4 137448 7844 ? Sl 13:23 0:23 ./redis-server *:6384 [cluster]
root 22515 0.0 0.3 137444 7628 ? Sl 13:24 0:22 ./redis-server *:6382 [cluster]
[root@iZ28afos96aZ src]# ./redis-trib.rb create --replicas 1 127.0.0.1:6384 127.0.0.1:6383 127.0.0.1:6382 127.0.0.1:6381 127.0.0.1:6380 127.0.0.1:6379
>>> Creating cluster
>>> Performing hash slots allocation on 6 nodes...
Using 3 masters:
127.0.0.1:6384
127.0.0.1:6383
127.0.0.1:6382
Adding replica 127.0.0.1:6381 to 127.0.0.1:6384
Adding replica 127.0.0.1:6380 to 127.0.0.1:6383
Adding replica 127.0.0.1:6379 to 127.0.0.1:6382
M: d75e3842921a04d2e530a899194fb5ee92b6fa91 127.0.0.1:6384
slots:0-5460 (5461 slots) master
M: a74e0aa159bcec51dfc94dd52d13f93f1c45ca1a 127.0.0.1:6383
slots:5461-10922 (5462 slots) master
M: cafe8b69992c2171ad2d1119f65b242e315a68e2 127.0.0.1:6382
slots:10923-16383 (5461 slots) master
S: d3826c34d09550a4d56d1569eb5bd652548f7a91 127.0.0.1:6381
replicates d75e3842921a04d2e530a899194fb5ee92b6fa91
S: 0d78e8b3bff995b41c18b2edbbc9ea870f9c1c4a 127.0.0.1:6380
replicates a74e0aa159bcec51dfc94dd52d13f93f1c45ca1a
S: fdacca0da5627679ad3e22ee49efc4611e584fae 127.0.0.1:6379
replicates cafe8b69992c2171ad2d1119f65b242e315a68e2
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join.....
>>> Performing Cluster Check (using node 127.0.0.1:6384)
M: d75e3842921a04d2e530a899194fb5ee92b6fa91 127.0.0.1:6384
slots:0-5460 (5461 slots) master
M: a74e0aa159bcec51dfc94dd52d13f93f1c45ca1a 127.0.0.1:6383
slots:5461-10922 (5462 slots) master
M: cafe8b69992c2171ad2d1119f65b242e315a68e2 127.0.0.1:6382
slots:10923-16383 (5461 slots) master
M: d3826c34d09550a4d56d1569eb5bd652548f7a91 127.0.0.1:6381
slots: (0 slots) master
replicates d75e3842921a04d2e530a899194fb5ee92b6fa91
M: 0d78e8b3bff995b41c18b2edbbc9ea870f9c1c4a 127.0.0.1:6380
slots: (0 slots) master
replicates a74e0aa159bcec51dfc94dd52d13f93f1c45ca1a
M: fdacca0da5627679ad3e22ee49efc4611e584fae 127.0.0.1:6379
slots: (0 slots) master
replicates cafe8b69992c2171ad2d1119f65b242e315a68e2
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384
slots covered.
[root@iZ28afos96aZ src]#