要關(guān)閉 redis 哨兵模式,請執(zhí)行以下步驟:將 sentinel 配置文件中的 down-after-milliseconds 設(shè)置為 0。刪除 sentinel 配置文件。刪除 sentinel 數(shù)據(jù)目錄。重啟 redis 服務(wù)。
如何關(guān)閉 Redis 哨兵模式
要關(guān)閉 Redis 哨兵模式,請執(zhí)行以下步驟:
1. 停止哨兵進(jìn)程
在 Sentinel 配置文件中(通常位于 /etc/redis/sentinel.conf)的每個哨兵程序項中,將 down-after-milliseconds 設(shè)置為 0:
sentinel monitor mymaster 127.0.0.1 6379 2 sentinel down-after-milliseconds mymaster 0
登錄后復(fù)制
這將立即關(guān)閉哨兵進(jìn)程。
2. 刪除 Sentinel 配置文件
接下來,刪除 Sentinel 配置文件,通常位于 /etc/redis/sentinel.conf:
sudo rm /etc/redis/sentinel.conf
登錄后復(fù)制
3. 刪除 Sentinel 數(shù)據(jù)目錄
Sentinel 將其數(shù)據(jù)存儲在數(shù)據(jù)目錄中,通常位于 /var/lib/redis/sentinel:
sudo rm -rf /var/lib/redis/sentinel
登錄后復(fù)制
4. 重啟 Redis 服務(wù)
最后,重啟 Redis 服務(wù)以應(yīng)用更改:
sudo service redis-server restart
登錄后復(fù)制
執(zhí)行這些步驟后,Redis 哨兵模式將被禁用。






