当前位置:网站首页>Redis分布式集群搭建
Redis分布式集群搭建
2022-06-13 08:35:00 【T浩浩】
redis版本 6.0.6 集群版本3主3从
准备阶段
1.官网下载redis安装包
2.解压到指定文件夹
3.进入解压好的安装包安装redis
安装阶段
并且创建6个文件夹 7000 70001 7002 7003 7004 7005
make install PREFIX=/usr/local/app/redis/7000安装好后将/usr/local/app/redis/7000/* 复制到其他几个文件夹
cp -r /usr/local/app/redis/7000/* /usr/local/app/redis/7001配置阶段
# 配置文件进行了精简,完整配置可自行和官方提供的完整conf文件进行对照。端口号自行对应修改
#后台启动的意思
daemonize yes
#端口号
port 7000
# IP绑定,redis不建议对公网开放,这里绑定了服务器私网IP及环回地址
bind 172.17.0.13 127.0.0.1
# redis数据文件存放的目录
dir /redis/workingDir
# 日志文件
logfile "/redis/logs/cluster-node-7000.log"
# 开启AOF
appendonly yes
# 开启集群
cluster-enabled yes
# 集群持久化配置文件,内容包含其它节点的状态,持久化变量等,会自动生成在上面配置的dir目录下
cluster-config-file cluster-node-6381.conf
# 集群节点不可用的最大时间(毫秒),如果主节点在指定时间内不可达,那么会进行故障转移
cluster-node-timeout 5000
# 云服务器上部署需指定公网ip
cluster-announce-ip 122.51.151.130
# Redis总线端口,用于与其它节点通信
cluster-announce-bus-port 17000
启动redis(可以创建shell脚本直接全部启动)
touch redis-start.sh
vi redis-start.shcd /usr/local/app/redis/7000/bin
redis-server redis.conf
cd /usr/local/app/redis/7001/bin
redis-server redis.conf
cd /usr/local/app/redis/7002/bin
redis-server redis.conf
cd /usr/local/app/redis/7003/bin
redis-server redis.conf
cd /usr/local/app/redis/7004/bin
redis-server redis.conf
cd /usr/local/app/redis/7005/bin
redis-server redis.conf修改文件权限
chmod u+x redis-start.sh
执行文件
./redis-start.sh
查看redis启动状态
ps aux|grep redis创建redis集群
进入/usr/local/app/redis/7000/bin
./redis-cli --cluster create 192.168.0.80:7000 192.168.0.80:7001 192.168.0.80:7002 192.168.0.80:7003 192.168.0.80:7004 192.168.0.80:7005 --cluster-replicas 1
查看集群状态
cat nodes.conf配置完成了
使用客户端 使用集群要加-c
./redis-cli -h 127.0.0.1 -p 7000 -c
注意:需要在防火墙和服务器出入规则添加 7000 17000端口,其他几个端口也一样
边栏推荐
- Shellshock Attack Lab
- How about a well-known food material distribution information management system?
- Buuctf web (VI)
- Buuctf web (III)
- Wechat upload picture material interface
- Four ways to install MySQL in Linux
- Explanation of JS event loop mechanism and asynchronous tasks
- Emotion handling skills
- Process and scheduled task management
- Logstash failed to create queue
猜你喜欢

Penetration problem (main directory, password explosion, database uploading Trojan horse)

DIY无人机(匿名拓控者P2+F330机架)

Gtk+ programming example on page 115 - simplest progress bar 2 with steps to write GTK program using anjuta

When submitting the laravel admin form and using the required verification, an error is reported when the value is 0

anaconda下安装pytorch

Founder of Starbucks: no longer open "public toilets" to non store consumers for safety reasons

关于redis使用分布式锁的封装工具类

HCIP_ OSPF irregular area

File upload question type

How to hide tabs in nailing applet
随机推荐
Verify the word limit of textarea input box. Only prompt but no submission limit
Namespace in TS (1)
Logstash configuration reference article
Differences among let, VaR and const when JS declares variables
4、 Js-es5-i / O
星巴克创始人:出于安全考量 或不再向非店内消费者开放“公厕”
[pychart pit stepping record] prompt after configuring remote operation, [errno 2] no such file or directory
PHP PNG to webp
DNS domain name resolution service
Buuctf web (III)
Is signed or unsigned selected to create an integer field in MySQL? The answer is as follows:
redis. exceptions. ConnectionError: Error 111 connecting to 172.16.8.128:6379. Connection refused.
Which is the stronger fresh food distribution and sorting management system?
1、 JS introduction
JS gets the first month of the year, the second month to the last month, and the first day to the last day
Determine whether a string is rotated from another string
How to install the bdtab (BD) new tab plug-in in edge browser (Graphic tutorial)
Penetration problem (main directory, password explosion, database uploading Trojan horse)
Tiktok keyword search list interface, ultra detailed interface docking steps
How does the BD new tab plug-in log in?