redis集群部署

jurioo1年前中间件365
wget https://github.com/redis/redis/archive/refs/tags/7.4.1.zip
unzip 7.4.1.zip
cd redis-7.4.1
apt install -y unzip zip
apt install -y make
apt install -y build-essential 
apt install -y pkg-config
apt install -y libjemalloc-dev

cd deps
make lua hiredis linenoise hdr_histogram fpconv jemalloc
make && make install

mkdir -p /data/apps/redis/cluster/{0001,0002,0003,0004,0005,0006}

# Redis配置文件模板--不设置密码
cat <<EOF >template.conf
port 7000
bind 0.0.0.0
cluster-enabled yes
protected-mode no
cluster-config-file nodes-7000.conf
cluster-node-timeout 5000
appendonly yes
save 900 1
save 300 10
save 60 10000
EOF

# Redis配置文件模板--设置密码
cat <<EOF >template.conf
port 7000
bind 0.0.0.0
cluster-enabled yes
protected-mode yes
requirepass password
cluster-config-file nodes-7000.conf
cluster-node-timeout 5000
appendonly yes
save 900 1
save 300 10
save 60 10000
EOF

# 生成6个配置文件
for i in {1..6}; do
cp template.conf /opt/apps/redis/cluster/000$i/redis.conf
sed -i "s/7000/700$i/g" /opt/apps/redis/cluster/000$i/redis.conf
done

# 删除模板文件
rm template.conf

chmod +x create_configs.sh
./create_configs.sh

for i in {1..6}; do
/usr/local/bin/redis-server /data/apps/redis/cluster/000$i/redis.conf &
done

#cctv01 单主机启动6节点
/usr/local/bin/redis-server /data/apps/redis/cluster/0001/redis.conf &
/usr/local/bin/redis-server /data/apps/redis/cluster/0002/redis.conf &
/usr/local/bin/redis-server /data/apps/redis/cluster/0003/redis.conf &
/usr/local/bin/redis-server /data/apps/redis/cluster/0004/redis.conf &
/usr/local/bin/redis-server /data/apps/redis/cluster/0005/redis.conf &
/usr/local/bin/redis-server /data/apps/redis/cluster/0006/redis.conf &

redis-cli --cluster create \
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 127.0.0.1:7006 \
--cluster-replicas 1

# 设置密码
redis-cli --cluster create \
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 127.0.0.1:7006 \
--cluster-replicas 1 \
-a password



#cctv01/02/03

/usr/local/bin/redis-server /data/apps/redis/cluster/0001/redis.conf &
/usr/local/bin/redis-server /data/apps/redis/cluster/0002/redis.conf &
/usr/local/bin/redis-server /data/apps/redis/cluster/0003/redis.conf &

# 1主2从
redis-cli --cluster create \
192.168.3.31:7001 192.168.3.31:7002 192.168.3.31:7003\
192.168.3.32:7001 192.168.3.32:7002 192.168.3.32:7003\
192.168.3.33:7001 192.168.3.33:7002 192.168.3.33:7003\
--cluster-replicas 2


评论列表

最新奇迹发布网新开服
2024-11-29 13:52:33

哥回复的不是帖子,是寂寞!

最新奇迹发布网新开服
2024-11-30 19:25:53

哥回复的不是帖子,是寂寞!

权重蜘蛛池
2024-12-04 16:23:31

权重蜘蛛池http://quanzhong.uikeji.com/post/43960.html

六夫皆妖全文免费阅读
2024-12-05 11:50:17

六夫皆妖全文免费阅读http://qiusheng.xingyunsucai.com/post/131.html

蜘蛛池
2024-12-05 12:36:06

蜘蛛池http://waitui.uikeji.com/post/42641.html

唐诚马玉婷免费阅读
2024-12-05 18:34:24

唐诚马玉婷免费阅读http://mori.xingyunsucai.com/post/117.html

金陵春全文免费阅读
2024-12-05 19:02:07

金陵春全文免费阅读http://zhichang.xingyunsucai.com/post/39.html

日收蜘蛛池
2024-12-06 10:20:08

日收蜘蛛池http://seo.uikeji.com/post/40719.html

日收蜘蛛池
2024-12-07 06:57:44

日收蜘蛛池http://zhizhu.uikeji.com/post/44025.html

我的徒弟都是大反派免费阅读

我的徒弟都是大反派免费阅读http://lishi.xingyunsucai.com/category-45.html

六夫皆妖全文免费阅读
2024-12-09 15:51:17

六夫皆妖全文免费阅读http://qiusheng.xingyunsucai.com/post/131.html

武炼巅峰全文免费阅读
2024-12-10 07:11:17

武炼巅峰全文免费阅读http://yanqing.xingyunsucai.com/post/247.html

百度蜘蛛池
2024-12-12 05:15:38

百度蜘蛛池http://waitui.uikeji.com/post/42630.html

蜘蛛池模板
2024-12-13 14:06:26

有机会找楼主好好聊聊!

百度蜘蛛池
2024-12-13 19:36:13

百度蜘蛛池http://waitui.uikeji.com/post/42630.html

日收蜘蛛池
2024-12-15 23:56:48

日收蜘蛛池http://seo.uikeji.com/post/40719.html

蜘蛛池
2024-12-16 05:43:53

蜘蛛池http://waitui.uikeji.com/post/42641.html

蜘蛛池模板
2025-01-05 15:21:47

楼主练了葵花宝典吧?

蜘蛛池
2025-01-12 08:54:32

不是惊喜,是惊吓!

强引蜘蛛池
2025-02-18 05:05:58

有机会找楼主好好聊聊!

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。