mac下redis cluster

1.安装redis

执行命令:brew info redis

mac下redis cluster_第1张图片

2.cd /usr/local/etc

mkdir redis/cluster/7000
mkdir redis/cluster/7001
mkdir redis/cluster/7002
mkdir redis/cluster/7003
mkdir redis/cluster/7004
mkdir redis/cluster/7005

3.cp /usr/local/etc/redis.conf 到六个文件夹中
mac下redis cluster_第2张图片
4.修改配置文件如下:

port 7000
cluster-enabled yes
cluster-config-file nodes-7000.conf
cluster-node-timeout 5000
appendonly yes

5.启动redis

redis-server /usr/local/etc/redis/cluster/7000/7000.conf;
redis-server /usr/local/etc/redis/cluster/7001/7001.conf;
redis-server /usr/local/etc/redis/cluster/7002/7002.conf;
redis-server /usr/local/etc/redis/cluster/7003/7003.conf;
redis-server /usr/local/etc/redis/cluster/7004/7004.conf;
redis-server /usr/local/etc/redis/cluster/7005/7005.conf;

查看是否启动


6.安装redis的ruby模块

brew update
brew install ruby
sudo gem install redis

7.从github上redis源码中把redis-trib.rb放在本地某个目录下然后执行下面命令
ruby Documents/redis-trib.rd 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
mac下redis cluster_第3张图片

mac下redis cluster_第4张图片
7.安装成功
mac下redis cluster_第5张图片
mac下redis cluster_第6张图片

你可能感兴趣的:(mac下redis cluster)