# redis 5.0.5 搭建集群
环境:CentOS Linux release 7.7.1908 (Core)
下载并安装redis
```
$ yum install cpp binutils glibc glibc-kernheaders glibc-devel gcc tcl gcc-c++ -y
$ wget http://download.redis.io/releases/redis-5.0.5.tar.gz
$ tar xzf redis-5.0.5.tar.gz
$ cd redis-5.0.5
$ make
```
![image-20200617164245921](C:\Users\86150\AppData\Roaming\Typora\typora-user-images\image-20200617164245921.png)
配置文件模板:
```
#redis-6379.conf
daemonize yes
port 6379
logfile 6379.log
dir ./
bind 192.168.70.11 127.0.0.1
cluster-enabled yes
cluster-config-file nodes-6379.conf
cluster-node-timeout 15000
appendonly yes
appendfilename aof-6379.aof
appendfsync everysec
no-appendfsync-on-rewrite yes
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
```
启动每一个redis服务,然后执行:
```
./src/redis-cli --cluster create 192.168.70.11:6379 192.168.70.11:6380 192.168.70.12:6379 192.168.70.12:6380 192.168.70.13:6379 192.168.70.13:6380 --cluster-replicas 1
```
成功!
网友评论