无法从运行@myIpaddress的哨兵获得主地址:6379

时间:2017-08-04 07:57:48

标签: java spring-boot redis redis-sentinel

我正在使用Redis中的带有弹簧启动应用程序的标记来实现主从属。在使用哨兵创建JedisSentinelPool时,我收到以下错误

  

无法从运行@myIpaddress的哨兵获取主地址:6379

以下是代码。

        final String MASTER_NAME = "mymaster";
        final String PASSWORD = "empower";
        final Set sentinels;

        sentinels = new HashSet();
        sentinels.add("127.0.0.1:6379");
        sentinels.add("127.0.0.1:2222");
        sentinels.add("127.0.0.1:3333");

        JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, sentinels);

我的问题是如何运行哨兵以及如何解决此问题。任何形式的帮助都表示赞赏。

提前致谢。

1 个答案:

答案 0 :(得分:0)

将您的ip address绑定到127.0.0.1

# Example sentinel.conf
# By default Sentinel will not be reachable from interfaces different than
# localhost, either use the 'bind' directive to bind to a list of network
# interfaces, or disable protected mode with "protected-mode no" by
# adding it to this configuration file.
#
# Before doing that MAKE SURE the instance is protected from the outside
# world via firewalling or other means.
#
# For example you may use one of the following:
#
bind 10.10.21.192 127.0.0.1