gpt4 book ai didi

redis - 使用 redis 哨兵时,如何使用密码保护主节点和副本节点?

转载 作者:可可西里 更新时间:2023-11-01 11:23:32 36 4
gpt4 key购买 nike

我能够将 requirepass "redis-dev-pass" 添加到 sentinel 配置文件中,以便为这些服务器设置密码。但是,当向包含 masteauth 字段的主服务器和副本添加相同的字段时,sentinel 认为所有这些服务器都已关闭。

67476:X 10 May 2019 11:31:43.109 # Sentinel ID is 
3ef0b36a3937477ace9e9d59134272e71c256c68
67476:X 10 May 2019 11:31:43.109 # +monitor master mymaster 127.0.0.1 7000 quorum 1
67476:X 10 May 2019 11:31:48.134 # +sdown master mymaster 127.0.0.17000
67476:X 10 May 2019 11:31:48.134 # +odown master mymaster 127.0.0.1 7000 #quorum 1/1
67476:X 10 May 2019 11:31:48.134 # +new-epoch 1
67476:X 10 May 2019 11:31:48.134 # +try-failover master mymaster 127.0.0.1 7000
67476:X 10 May 2019 11:31:48.135 # +vote-for-leader 3ef0b36a3937477ace9e9d59134272e71c256c68 1
67476:X 10 May 2019 11:31:48.135 # +elected-leader master mymaster 127.0.0.1 7000
67476:X 10 May 2019 11:31:48.135 # +failover-state-select-slave master mymaster 127.0.0.1 7000
67476:X 10 May 2019 11:31:48.190 # -failover-abort-no-good-slave master mymaster 127.0.0.1 7000
67476:X 10 May 2019 11:31:48.246 # Next failover delay: I will not start a failover before Fri May 10 11:37:48 2019

但是副本没有问题连接到主节点

67336:S 10 May 2019 11:29:12.060 # Server initialized
67336:S 10 May 2019 11:29:12.061 * DB loaded from disk: 0.000 seconds
67336:S 10 May 2019 11:29:12.061 * Before turning into a replica, using my master parameters to synthesize a cached master: I may be able to synchronize with the new master with just a partial transfer.
67336:S 10 May 2019 11:29:12.061 * Ready to accept connections
67336:S 10 May 2019 11:29:12.061 * Connecting to MASTER 127.0.0.1:7000
67336:S 10 May 2019 11:29:12.061 * MASTER <-> REPLICA sync started
67336:S 10 May 2019 11:29:12.061 * Non blocking connect for SYNC fired the event.
67336:S 10 May 2019 11:29:12.061 * Master replied to PING, replication can continue...
67336:S 10 May 2019 11:29:12.061 * Trying a partial resynchronization (request bb8f55d8e8336ec1b7bcc986b712b3f1c386d37b:3864).
67336:S 10 May 2019 11:29:12.062 * Full resync from master: 233bf4156083aa06321579c328fff42f5ec4e8a9:0
67336:S 10 May 2019 11:29:12.062 * Discarding previously cached master state.
67336:S 10 May 2019 11:29:12.125 * MASTER <-> REPLICA sync: receiving 175 bytes from master
67336:S 10 May 2019 11:29:12.125 * MASTER <-> REPLICA sync: Flushing old data
67336:S 10 May 2019 11:29:12.125 * MASTER <-> REPLICA sync: Loading DB in memory
67336:S 10 May 2019 11:29:12.126 * MASTER <-> REPLICA sync: Finished with success

sentinel.conf(我在5000 5001 5002上有3个)

port 5000
sentinel deny-scripts-reconfig yes
sentinel monitor mymaster 127.0.0.1 7000 1
sentinel down-after-milliseconds mymaster 5000
requirepass "pass"
masterauth "pass"

和master的redis.conf

port 7000
bind 127.0.0.1

requirepass pass

复制品类似的东西

最佳答案

原来这只是一个不同的配置选项

sentinel auth-pass mymaster redis-dev-pass

关于redis - 使用 redis 哨兵时,如何使用密码保护主节点和副本节点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56080814/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com