当前位置: 首页 > news >正文

04.Redis 的多实例

Redis 的多实例

使用多实例,需要指定不同实例的相应的端口,配置文件,日志文件等相关配置

# 在前面的编译安装的基础上,需要再指定不同实例的service文件、相应的端口,配置文件,日志文件等相关配置
[root@ubuntu2204 ~]#sed 's/6379/6380/' /apps/redis/etc/redis.conf > /apps/redis/etc/redis_6380.conf[root@ubuntu2204 ~]#grep 6380 /apps/redis/etc/redis_6380.confport 6380
# tls-port 6380
pidfile /apps/redis/run/redis_6380.pid
logfile "/apps/redis/log/redis_6380.log"
dbfilename dump_6380.rdb
appendfilename "appendonly_6380.aof"
# cluster-config-file nodes-6380.conf
# cluster-announce-tls-port 6380
# cluster-announce-bus-port 6380[root@ubuntu2204 ~]#cd /lib/systemd/system
[root@ubuntu2204 system]#cp redis.service redis_6380.service# 修改配置文件 /apps/redis/etc/redis_6380.conf 来启动这个实例
[root@ubuntu2204 system]#cat redis_6380.service 
[Unit]
Description=Redis persistent key-value database
After=network.target[Service]
ExecStart=/apps/redis/bin/redis-server /apps/redis/etc/redis_6380.conf --supervised systemd
ExecStop=/bin/kill -s QUIT $MAINPID
Type=notify
User=redis
Group=redis
RuntimeDirectory=redis
RuntimeDirectoryMode=0755
LimitNOFILE=1000000[Install]
WantedBy=multi-user.target[root@ubuntu2204 system]#systemctl daemon-reload
[root@ubuntu2204 system]#systemctl enable --now redis_6380.service
[root@ubuntu2204 system]#systemctl restart redis_6380.service 
[root@ubuntu2204 system]#ss -nlt
State                Recv-Q               Send-Q                             Local Address:Port                               Peer Address:Port               Process               
LISTEN               0                    4096                               127.0.0.53%lo:53                                      0.0.0.0:*                                        
LISTEN               0                    511                                      0.0.0.0:6379                                    0.0.0.0:*                                        
LISTEN               0                    511                                      0.0.0.0:6380                                    0.0.0.0:*                                        
LISTEN               0                    128                                      0.0.0.0:22                                      0.0.0.0:*                                        
LISTEN               0                    128                                         [::]:22                                         [::]:*                     # 客户端连接
[root@ubuntu2204 ~]#redis-cli -p 6380 -a 123456 --no-auth-warning
127.0.0.1:6380> 

前台运行redis多实例

[root@ubuntu2204 system]#redis-server --port 6381[root@ubuntu2204 ~]#ss -nlt
State       Recv-Q      Send-Q           Local Address:Port             Peer Address:Port      Process      
LISTEN      0           4096             127.0.0.53%lo:53                    0.0.0.0:*                      
LISTEN      0           511                    0.0.0.0:6379                  0.0.0.0:*                      
LISTEN      0           511                    0.0.0.0:6381                  0.0.0.0:*                      
LISTEN      0           511                    0.0.0.0:6380                  0.0.0.0:*                      
LISTEN      0           128                    0.0.0.0:22                    0.0.0.0:*                      
LISTEN      0           511                       [::]:6381                     [::]:*                      
LISTEN      0           128                       [::]:22                       [::]:*         
http://www.lryc.cn/news/608759.html

相关文章:

  • 笔试——Day27
  • 前端面试手撕题目全解析
  • 【数据迁移】Windows11 下将 Ubuntu 从 C 盘迁移到 D 盘
  • Redis——常用指令汇总指南(三)(哈希类型)
  • Odoo OWL前端框架全面学习指南 (后端开发者视角)
  • 三角洲行动ACE反作弊VT-d报错?CPU虚拟化如何开启!
  • GitOps:云原生时代的革命性基础设施管理范式
  • Ubuntu20.04 Carla安装与和Ros联合仿真
  • Ubuntu22.4部署大模型前置安装
  • AI + 云原生:正在引爆下一代应用的技术革命
  • LabVIEW小波变换检测信号断点
  • HCIP笔记(第四章)
  • 悬挂的绳子,它的函数方程是什么样子的?
  • Python Dash 全面讲解
  • 大屏项目展示
  • 基于Springboot+UniApp+Ai实现模拟面试小工具八:管理端基础功能实现
  • RAG与智能体技术全景解析:架构革新、场景落地与未来趋势
  • linux2.6 和 unix-v6 源码实验
  • uni-app学习笔记01-项目初始化及相关文件
  • Java小红书源码1:1还原uniapp_仿小红书源码
  • UniApp 实现顶部固定导航栏 Tab 及滚动变色效果
  • 7.13.B+树
  • io_setup系统调用及示例
  • [AI8051U入门第十五步]W5500实现DHCP自动获取IP
  • UE5的渲染Debug技巧
  • [每周一更]-(第154期):Docker 底层深度剖析:掌控 CPU 与内存资源的艺术
  • Leetcode 12 java
  • GitHub 趋势日报 (2025年08月02日)
  • ThinkPad P16 Gen2,P16 Gen2 LTE(21FA,21FB)原装Win10Pro,Win11专业版系统镜像,恢复出厂开箱状态
  • All the Mods 9 - To the Sky - atm9sky 局域网联机报错可能解决方法