地图-Redis集群部署
时间:2025-02-12 14:52:48
Redis集群部署
- 服务信息如下:
表1 服务信息5 服务名
服务器
安装目录
端口
密码
redis
10.190.x.x
/app/redis-6.2.6
6379、6380、6381
******
- 安装redis
- 准备安装包
cd /appwget https://download.redis.io/releases/redis-6.2.6.tar.gztar -zxvf redis-6.2.6.tar.gzcd /app/redis-6.2.6
- 编译
yum -y install gcc-c++yum -y install make##首先进入deps目录,编译Redis依赖库cd deps/make -j4 hiredis lua jemalloc linenoise ##再进行编译Rediscd ../redis-6.2.6/yum provides */ldyum install -y binutils-2.31.1-13.h3.eulerosv2r8.aarch64[root@host-172-16-1-173 redis-6.2.6]# which ld/usr/bin/ldmake -j4make install
- 修改6个实例的配置文件,端口分别为7000、7001、7002、7003、7004、7005
cp redis.conf redis-7000.confvim redis-7000.confbind 0.0.0.0protected-mode noport 7000daemonize yes #守护进程pidfile ./redis_7000.pidLoglevel warninglogfile ./redis-7000.logdbfilename "dump-7000.rdb"maxmemory 8GBmaxmemory-policy allkeys-lruappendonly yes #持久化cluster-enabled yescluster-config-file "node-7000.conf"activedefrag yes #碎片整理masterauth "redis123"##user default on requirepass ****** #服务连接密码Ignore-warnings ARM64-COW-BUG #配置ARM64内核bug问题选项
- 三节点分别启动服务
nohup ./src/redis-server redis-7000.conf &nohup ./src/redis-server redis-7001.conf &nohup ./src/redis-server redis-7002.conf &nohup ./src/redis-server redis-7003.conf &nohup ./src/redis-server redis-7004.conf &nohup ./src/redis-server redis-7005.conf & cd /opt/redis/redis-6.2.1/src/./redis-cli --cluster create node1:7001 node2:7003 node3:7005 node2:7002 node3:7004 node1:7000 --cluster-replicas 1[root@zh-prod-redis-1 src]# ./redis-cli --cluster create 172.16.19.25:7001 172.16.19.26:7003 172.16.19.18:7005 172.16.19.26:7002 172.16.19.18:7004 172.16.19.25:7000 --cluster-replicas 1 -a 'redis123'[OK] All 16384 slots covered.
- 部署成redis一主两从三哨兵的集群模式
mkdir /app/redis-5.0.5 mkdir /app/redis-5.0.5/logs/[root@host-172-16-1-173 conf]# ls /app/redis-5.0.5conf dump.rdb logs start.sh stop.sh[root@host-172-16-1-173 conf]# lsredis.conf sentinel1.conf sentinel2.conf sentinel3.conf slave1.conf slave2.conf
- 启动、停止
./start.sh./stop.sh
- 准备安装包
父主题: 数据库及中间件服务部署
support.huaweicloud.com/sfmcdtp-mapslt/sfmcdtp_10.html