This commit is contained in:
2021-11-14 15:52:46 +08:00
parent 915c231124
commit 1e344dc204
112 changed files with 1039 additions and 1039 deletions

View File

@@ -6,7 +6,7 @@ tags: ["redis", "sentinel", "哨兵"]
categories: ["database"]
---
# 环境
## 环境
主机名 | 地址 | 操作系统 | 初始状态
---- | ---- | ---- | ----
sentinel86 | 10.1.14.86 | CentOS7.4 | null
@@ -14,27 +14,27 @@ redis87 | 10.1.14.87 | CentOS7.4 | master
redis88 | 10.1.14.88 | CentOS7.4 | slave
redis89 | 10.1.14.89 | CentOS7.4 | slave
# 安装 redis
## 安装 redis
- 在全部服务器上安装 redis
```bash
yum install epel-release
yum install redis
```
# redis master 配置
## redis master 配置
- 在 redis87 上修改 /etc/redis.conf
```
bind 0.0.0.0
```
# redis slave 配置
## redis slave 配置
- 在 redis88 和 redis89 上修改 /etc/redis.conf
```
bind 0.0.0.0
slaveof 10.1.14.87 6379
```
# redis sentinel 配置
## redis sentinel 配置
- 在 sentinel86 上创建三个 sentinel 配置文件
```bash
cd /etc/
@@ -103,7 +103,7 @@ redis89 | 10.1.14.89 | CentOS7.4 | slave
systemctl daemon-reload
```
# 启动 redis 服务
## 启动 redis 服务
- 在 redis87、redis88 和 redis89 上启动 redis 服务
```bash
systemctl start redis
@@ -111,7 +111,7 @@ redis89 | 10.1.14.89 | CentOS7.4 | slave
redis-cli info replication
```
# 启动 redis sentinel 监控
## 启动 redis sentinel 监控
- 在 sentinel86 上启动 sentinel 监管程序
```bash
systemctl start redis-sentinel-16379