请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

已启动3个sentinel,但它们之间不能互相发现

在第 8-6 节中,老师启动了3个sentinel,且它们之间互相发现了【sentinels=3】

但是在我的电脑上却不能互相发现,请问是怎么回事?

  1. redis-7000、redis-7001、redis-7002 的配置信息

    //img1.sycdn.imooc.com//szimg/5a332b1c0001656305180773.jpg

  2. 三个sentinel的配置信息

    //img1.sycdn.imooc.com//szimg/5a332b5c00011de906230843.jpg

    //img1.sycdn.imooc.com//szimg/5a332b970001ebe806130424.jpg

  3. 启动三个redis和三个sentinel

    //img1.sycdn.imooc.com//szimg/5a332bc20001a43d09670260.jpg

  4. 查看sentinel的相关信息

    //img1.sycdn.imooc.com//szimg/5a332be10001d3d908630835.jpg




在最后一张图可以看到,三个sentinel的信息中的sentinels都等于1,请问这是什么原因?谢谢!


redis的版本是 4.0.6


------------------------------------------


sentinel-26379的log信息:

//img1.sycdn.imooc.com//szimg/5a353cc300018b6912520708.jpg


sentinel-26380的log信息:

//img1.sycdn.imooc.com//szimg/5a353d93000133d412490704.jpg

sentinel-26381的log信息:

//img1.sycdn.imooc.com//szimg/5a353db50001984c12630709.jpg


---------------------------------------------------------------------------


redis-7000的log信息:

17936:C 15 Dec 09:13:06.542 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo

17936:C 15 Dec 09:13:06.542 # Redis version=4.0.6, bits=64, commit=00000000, modified=0, pid=17936, just started

17936:C 15 Dec 09:13:06.542 # Configuration loaded

17937:M 15 Dec 09:13:06.550 * Increased maximum number of open files to 10032 (it was originally set to 1024).

17937:M 15 Dec 09:13:06.554 * Running mode=standalone, port=7000.

17937:M 15 Dec 09:13:06.554 # Server initialized

17937:M 15 Dec 09:13:06.554 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.

17937:M 15 Dec 09:13:06.554 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.

17937:M 15 Dec 09:13:06.554 * Ready to accept connections

17937:M 15 Dec 09:13:36.952 * Slave 127.0.0.1:7001 asks for synchronization

17937:M 15 Dec 09:13:36.952 * Full resync requested by slave 127.0.0.1:7001

17937:M 15 Dec 09:13:36.952 * Starting BGSAVE for SYNC with target: disk

17937:M 15 Dec 09:13:36.953 * Background saving started by pid 18082

18082:C 15 Dec 09:13:36.959 * DB saved on disk

18082:C 15 Dec 09:13:36.961 * RDB: 0 MB of memory used by copy-on-write

17937:M 15 Dec 09:13:36.966 * Background saving terminated with success

17937:M 15 Dec 09:13:36.966 * Synchronization with slave 127.0.0.1:7001 succeeded

17937:M 15 Dec 09:13:39.061 * Slave 127.0.0.1:7002 asks for synchronization

17937:M 15 Dec 09:13:39.061 * Partial resynchronization request from 127.0.0.1:7002 accepted. Sending 0 bytes of backlog starting from offset 1.

17937:M 15 Dec 09:42:08.117 # User requested shutdown...

17937:M 15 Dec 09:42:08.117 * Removing the pid file.

17937:M 15 Dec 09:42:08.117 # Redis is now ready to exit, bye bye...

28006:C 15 Dec 09:47:23.117 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo

28006:C 15 Dec 09:47:23.117 # Redis version=4.0.6, bits=64, commit=00000000, modified=0, pid=28006, just started

28006:C 15 Dec 09:47:23.117 # Configuration loaded

28007:M 15 Dec 09:47:23.123 * Increased maximum number of open files to 10032 (it was originally set to 1024).

28007:M 15 Dec 09:47:23.126 * Running mode=standalone, port=7000.

28007:M 15 Dec 09:47:23.126 # Server initialized

28007:M 15 Dec 09:47:23.126 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.

28007:M 15 Dec 09:47:23.126 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.

28007:M 15 Dec 09:47:23.127 * DB loaded from disk: 0.000 seconds

28007:M 15 Dec 09:47:23.127 * Ready to accept connections

28007:M 15 Dec 09:47:24.958 * Slave 127.0.0.1:7001 asks for synchronization

28007:M 15 Dec 09:47:24.958 * Partial resynchronization not accepted: Replication ID mismatch (Slave asked for 'f2cbe4d3540a1d3b525d0aa7bb087eda333e9437', my replication IDs are '7b8c7cd40e4a2e16f62518ea2e1602602e9b46c4' and '0000000000000000000000000000000000000000')

28007:M 15 Dec 09:47:24.959 * Starting BGSAVE for SYNC with target: disk

28007:M 15 Dec 09:47:24.959 * Background saving started by pid 28025

28025:C 15 Dec 09:47:24.965 * DB saved on disk

28025:C 15 Dec 09:47:24.968 * RDB: 0 MB of memory used by copy-on-write

28007:M 15 Dec 09:47:25.036 * Background saving terminated with success

28007:M 15 Dec 09:47:25.036 * Synchronization with slave 127.0.0.1:7001 succeeded

28007:M 15 Dec 09:47:26.664 * Slave 127.0.0.1:7002 asks for synchronization

28007:M 15 Dec 09:47:26.664 * Partial resynchronization request from 127.0.0.1:7002 accepted. Sending 0 bytes of backlog starting from offset 1.

28007:signal-handler (1513305883) Received SIGTERM scheduling shutdown...

28007:M 15 Dec 10:44:43.890 # User requested shutdown...

28007:M 15 Dec 10:44:43.890 * Removing the pid file.

28007:M 15 Dec 10:44:43.890 # Redis is now ready to exit, bye bye...


正在回答 回答被采纳积分+3

4回答

android55555555555 2019-06-08 16:36:38

执行redis-sentinel redis-sentinel-26379.conf的时候redis-sentinel-26379.conf生成了sentinel myid配置项,这项注释掉,再复制redis-sentinel-26379.conf到redis-sentinel-26380.conf和redis-sentinel-26381.conf上

4 回复 有任何疑惑可以回复我~
imooc_lvshun 2019-02-21 23:39:04

我第一次也是这样 后来看你们都有这样的问题 我就自己又研究了一下 老师讲课时是这样的

  • redis-sentinel redis-sentinel-26379.conf

执行这句之后,配置文件已经被改写了,然后在执行sed命令生成另外两个conf文件。如果不执行上面那句,直接把conf都生成,再执行启动就可以检测到3个哨兵了。

2 回复 有任何疑惑可以回复我~
born198x 2019-11-14 07:26:24

很神奇,我的所有日志文件都是空的 阿里云centos7.5 redis 版本5.0.2  有人遇到么

0 回复 有任何疑惑可以回复我~
carlosfu 2017-12-16 20:55:44

麻烦提供下sentinel的日志信息

0 回复 有任何疑惑可以回复我~
  • 提问者 Narlinen #1
    已将sentinel-26379的log信息更新在问题处...
    回复 有任何疑惑可以回复我~ 2017-12-16 23:34:19
  • carlosfu 回复 提问者 Narlinen #2
    加我微信 carlosfu 细说。
    回复 有任何疑惑可以回复我~ 2017-12-20 23:42:41
  • 老师您好,我也存在这个问题,请问最后是怎么解决的呢?
    回复 有任何疑惑可以回复我~ 2018-01-15 16:12:13
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信