关于Redis报错:sentinel directive while not in sentinel mode 解决

启动redis哨兵机制的时候,居然报错这个信息,仔细一看才发现,原来是自己命令敲错了!

敲的命令是:src/redis-server ./redis_cluster/7000/sentinel-7000.conf sentinel

*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 84
>>> 'sentinel monitor mymaster 120.79.233.206 7000 2'
sentinel directive while not in sentinel mode

眼尖的同学应该已经看出来了,就是最后面的sentinel,没有加上--,正确的写法是:

src/redis-server ./redis_cluster/7000/sentinel-7000.conf --sentinel

注意:--sentinel

正常启动成功!
我们可以不用这么担心,这么麻烦后面还要加上--sentinel ,一不小心还敲错了! 
我们可以使用 redis->src 目录下的 redis-sentinel 命令,这样就不需要写后面的 --sentinel 参数了!
写法如下: 
    src/redis-sentinel ./redis_cluster/7000/sentinel-7000.conf

同样的启动成功!

各位小伙伴,有什么不足的地方,欢迎底下留言,谢谢!

Logo

助力广东及东莞地区开发者,代码托管、在线学习与竞赛、技术交流与分享、资源共享、职业发展,成为松山湖开发者首选的工作与学习平台

更多推荐