使用哨兵模式连接redis连接池时,遇到错误:

Caused by: redis.clients.jedis.exceptions.JedisDataException:
 ERR Client sent AUTH, but no password is set

发现是redis没有设置密码,程序却发送了auth选项。

工程里JedisSentinelPool是通过spring配置的:

    <bean id="jedisPool" class="redis.clients.jedis.JedisSentinelPool" destroy-method="destroy">
<constructor-arg value="${redis.master}" />
<constructor-arg>
<set>
<value>${redis.host}:${redis.port}</value>
</set>
</constructor-arg>
<constructor-arg ref="jedisPoolConfig" />
<constructor-arg value="${redis.timeout}"/>
</bean>

发现JedisSentinelPool的构造方法有2个类似的:

	public JedisSentinelPool(String masterName, Set sentinels,
GenericObjectPoolConfig poolConfig, int timeout) {
this(masterName, sentinels, poolConfig, timeout, null, 0);
} public JedisSentinelPool(String masterName, Set sentinels,
GenericObjectPoolConfig poolConfig, String password) {
this(masterName, sentinels, poolConfig, 2000, password);
}

JedisSentinelPool初始化构造方法的入参是根据spring配置文件的参数配置顺序加载的,JedisSentinelPool使用了第二个构造方法,导致上面的错误。

解决方法,给配置文件的参数配置name属性.

    <bean id="jedisPool" class="redis.clients.jedis.JedisSentinelPool" destroy-method="destroy">
<constructor-arg name="masterName" value="${redis.master}" />
<constructor-arg name="sentinels">
<set>
<value>${redis.host}:${redis.port}</value>
</set>
</constructor-arg>
<constructor-arg name="poolConfig" ref="jedisPoolConfig" />
<constructor-arg name="timeout" value="${redis.timeout}"/>
</bean>

问题解决

redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set的更多相关文章

  1. Redis错误:jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set

    原文链接:http://blog.csdn.net/rchm8519/article/details/48347797 redis.clients.util.Pool.getResource(Pool ...

  2. redis.clients.jedis.exceptions.JedisDataException: ERR invalid DB index

    添加redis配置文件, 启动后,调用报错  redis.clients.jedis.exceptions.JedisDataException: ERR invalid DB index ERR i ...

  3. 【问题集】redis.clients.jedis.exceptions.JedisDataException: ERR value is not an integer or out of range

    redis.clients.jedis.exceptions.JedisDataException: ERR value is not an integer or out of range incrm ...

  4. 【异常】redis.clients.jedis.exceptions.JedisDataException: ERR unknown command 'PSETEX'

    在spring中 针对 RedisTemplate类: private RedisTemplate<String, String> template; 当调用下面方法 template.o ...

  5. 阿里云 Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR invalid password

    如果你是买的阿里云的redis服务的话,不要被这个ERR invalid password所迷惑了. 你应该去检查一下你买的服务有没有设置白名单. 像mysql和mongodb的服务如果连不上的话也可 ...

  6. ERR Unsupported CONFIG parameter: notify-keyspace-events; nested exception is redis.clients.jedis.exceptions.JedisDataException

    异常信息 时间:2017-04-05 15:53:57,361 - 级别:[ WARN] - 消息: [other] The web application [ROOT] appears to hav ...

  7. redis.clients.jedis.exceptions.JedisDataException :READONLY You can't write

    分布式直连同步调用测试时出现的错误:主从复制架构下,默认Slave是只读的,如果写入则会报错: redis.clients.jedis.exceptions.JedisDataException: R ...

  8. redis.clients.jedis.exceptions.JedisDataException: MISCONF Redis is configured to save RDB snapshots

    最近在学习Redis ,在写test测试的时候碰到这个报错: redis.clients.jedis.exceptions.JedisDataException: MISCONF Redis is c ...

  9. Caused by: redis.clients.jedis.exceptions.JedisDataException: READONLY You can't write against a read only slave.

    Caused by: redis.clients.jedis.exceptions.JedisDataException: READONLY You can't write against a rea ...

随机推荐

  1. jdk8 eclipse luna market crashed

    THAT WORKS! Eclipse Luna starts normally when I first do the suggested: export SWT_GTK3=0 https://bu ...

  2. [算法] trie树实现

    小写字母的字典树 #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAXN 1 ...

  3. tensorflow的Virtualenv安装方式安装

    本文介绍了如何在ubuntu上以virtualenv方式安装tensorflow. 安装pip和virtualenv: # Ubuntu/Linux 64-bit sudo apt-get insta ...

  4. openstack controller ha测试环境搭建记录(七)——配置glance

    在所有集群安装glance软件:yum install -y openstack-glance python-glanceclient 在任一节点创建glance用户:mysql -u root -p ...

  5. Ubuntu和win10双系统Grup无法引导解决方案

    通常我们经常安装双系统, 但是有时候安装完系统无法正常引导, 以下就说明Ubuntu和win10双系统, win10在grub界面不断循环的解决方案 直接在win10启动项目上按e进入编辑模式 在文档 ...

  6. xcode 6 出现的新问题

    1.prefix.pch文件的使用 [1].需要自己创建 点击new file-->选择IOS中的Other选项卡,选择PCH File [2].创建完后需要设置一下才能成功 Prefix He ...

  7. Tomcat与Nginx、Apache结合的相关实践

    一.LNMT 简介:在Tomcat服务器前端部署一个Nginx(反向代理),当用户请求静态资源时,由Nginx服务器负责响应:当用户请求java应用程序资源时,由后端的Tomcat服务器进行响应. 环 ...

  8. CSS3 Media Queries 详解

    说起CSS3的新特性,就不得不提到 Media Queries .最近 Max Design 更新的一个泛读列表里,赫然就有关于 Media Queries 的文章.同时位列其中的也有前天我刚刚翻译的 ...

  9. springmvc的jdbcTemplate 插入 返回主键

    public int insertCustomer(final Customer customer) {        //TODO.        final String sql = " ...

  10. leetcode-005 reorder list

    1 package leetcode; public class ReOrderList { public void reorderList(ListNode head) { if(head==nul ...