1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/usr/bin/env bash set -e # 脚本当前目录 cPath=$(cd $(dirname "$0" ) || exit; pwd) # 根目录 dirPath=$(dirname "$cPath" ) # 设置端口 port=$1 if [[ ! "$port" ]]; then port=26379 fi # 删除已启动服务 containerId=$(docker ps -a | grep "sentinel_$port" | awk -F ' ' '{print $1}' ) if [[ "$containerId" ]]; then echo "正在删除服务:${containerId}" docker rm -f ${containerId} > /dev/ null fi # 启动服务 docker run -itd --privileged= true -p "$port" :26379 --name "sentinel_$port" \ -v= "${dirPath}/conf/sentinel_${port}.conf" :/etc/redis/sentinel.conf \ -w=/etc/redis/ \ redis \ redis-server /etc/redis/sentinel.conf --sentinel |
启动 sentinel 服务如果如下错误
1
2
|
1:X 10 May 2020 08:10:48.234 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 1:X 10 May 2020 08:10:48.235 # Sentinel config file /etc/redis/sentinel.conf is not writable: Permission denied. Exiting... |