- 下载:
https://redis.io/
- 解压:
tar -xzf redis-5.0.3.tar.gz
- 进入目录:
cd redis-5.0.3
- 编译安装:
make
- 创建配置文件夹:
mkdir -p /usr/local/redis/redis_1
mkdir -p /usr/local/redis/redis_2
mkdir -p /usr/local/redis/redis_3
mkdir -p /usr/local/redis/redis_4
mkdir -p /usr/local/redis/redis_5
mkdir -p /usr/local/redis/redis_6
- 创建配置文件:
vim /usr/local/redis/redis_1/redis.conf
port 7001
bind 172.20.10.12
requirepass 123456
daemonize yes
pidfile /var/run/redis_1.pid
cluster-enabled yes
cluster-config-file nodes_1.conf
cluster-node-timeout 10100
appendonly no
- 启动:
src/redis-server /usr/local/redis/redis_1/redis.conf
src/redis-server /usr/local/redis/redis_2/redis.conf
src/redis-server /usr/local/redis/redis_3/redis.conf
src/redis-server /usr/local/redis/redis_4/redis.conf
src/redis-server /usr/local/redis/redis_5/redis.conf
src/redis-server /usr/local/redis/redis_6/redis.conf
- 初始化:
src/redis-cli --cluster create 172.20.10.12:7001 172.20.10.12:7002 172.20.10.12:7003 172.20.10.12:7004 172.20.10.12:7005 172.20.10.12:7006 -a 123456 --cluster-replicas 1
- 检测状态:
src/redis-cli --cluster check 172.20.10.12:7001 -a 123456
- 连接:
src/redis-cli -c -h 172.20.10.12 -p 7001 -a 123456
- 停止:
pkill redis
广告
给大家推荐几个好用的工具
- 时间校验工具
- ip查询工具
- 二维码生成工具
- json格式化工具
- 时间缀-时间转换工具