本文版权归博客园和作者吴双本人共同所有 转载和爬虫请注明原文地址 www.cnblogs.com/tdws

使用jedis 2.9.0连接,异常信息:

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

说我没有设置密码,当时我就震惊了。我明明设置了密码呀。我用redis-cli连接的时候 还让我输入密码了呢~

检查了好久才想起来,redis-cli默认连接6379,我只给6379设置密码了,实际上要给每个节点都设置密码:

config set masterauth abc
config set requirepass abc

spring配置,jedis连接集群,竟然没有RedisCluster一个构造函数的参数只由 Set<HostAndPort>和password组成,害得我还要配置这么多参数。

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd"> <context:property-placeholder location="classpath:conf/redis.properties"/> <!--cluster版本-->
<bean class="redis.clients.jedis.JedisCluster" id="jedisClusterOrginal">
<constructor-arg name="jedisClusterNode">
<set>
<bean class="redis.clients.jedis.HostAndPort">
<constructor-arg index="0" value="${IP}"/>
<constructor-arg index="1" value="6379"/>
</bean>
<bean class="redis.clients.jedis.HostAndPort">
<constructor-arg index="0" value="${IP}"/>
<constructor-arg index="1" value="6380"/>
</bean>
<bean class="redis.clients.jedis.HostAndPort">
<constructor-arg index="0" value="${IP}"/>
<constructor-arg index="1" value="6381"/>
</bean>
<bean class="redis.clients.jedis.HostAndPort">
<constructor-arg index="0" value="${IP}"/>
<constructor-arg index="1" value="6382"/>
</bean>
<bean class="redis.clients.jedis.HostAndPort">
<constructor-arg index="0" value="${IP}"/>
<constructor-arg index="1" value="6383"/>
</bean>
<bean class="redis.clients.jedis.HostAndPort">
<constructor-arg index="0" value="${IP}"/>
<constructor-arg index="1" value="6384"/>
</bean>
</set>
</constructor-arg>
<constructor-arg name="connectionTimeout" value="10000"></constructor-arg>
<constructor-arg name="soTimeout" value="10000"></constructor-arg>
<constructor-arg name="maxAttempts" value="100"></constructor-arg>
<constructor-arg name="password" value="${pwd}"></constructor-arg>
<constructor-arg name="poolConfig" ref="jedisPoolConfig">
</constructor-arg>
</bean>
  <bean id="jedisPoolConfig" class="org.apache.commons.pool2.impl.GenericObjectPoolConfig">
<!--<property name="maxIdle" value="8"></property>-->
<!--<property name="maxTotal" value="8"></property>-->
<!--<property name="minIdle" value="0"></property>-->
  </bean>
<bean class="com.s2s.common.jedis.JedisClientCluster" id="jedisCluster"> <property name="jedisCluster" ref="jedisClusterOrginal"></property> </bean> </beans>

redis4.0 集群,jedis客户端连接配置的更多相关文章

  1. Hadoop-2.6.0 集群的 安装与配置

    1.  配置节点bonnie1 hadoop环境 (1) 下载hadoop- 2.6.0 并解压缩 [root@bonnie1 ~]# wget http://apache.fayea.com/had ...

  2. centos7/rhel7下安装redis4.0集群

    相关介绍:Redis从3.0版本开始支持集群! 集群一般由多个节点组成,节点数量至少6个才能保证组成完整高可用的集群. 每个节点需要开启配置文件中的cluster-enabled yes,让Redis ...

  3. docker redis4.0集群搭建

    一.前言 redis集群对于很多人来说非常熟悉,在前些日子,我也有一位大兄弟也发布过一篇关于在阿里云(centOS7)上搭建redis 集群的文章,虽然集群搭建的文章在网上很多,我比较喜欢这篇文章的地 ...

  4. docker redis4.0 集群(cluster)搭建

    前言 redis集群对于很多人来说非常熟悉,在前些日子,我也有一位大兄弟也发布过一篇关于在阿里云(centOS7)上搭建redis 集群的文章,虽然集群搭建的文章在网上很多,我比较喜欢这篇文章的地方是 ...

  5. Spring集成jedis支持Redis3.0集群

    接着上一节,我们通过spring FactoryBean实现redis 3.0集群JedisCluster与spring集成.  http://www.linuxidc.com/Linux/2016- ...

  6. hadoop 2.2.0集群安装详细步骤(简单配置,无HA)

    安装环境操作系统:CentOS 6.5 i586(32位)java环境:JDK 1.7.0.51hadoop版本:社区版本2.2.0,hadoop-2.2.0.tar.gz 安装准备设置集群的host ...

  7. hadoop-2.6.0集群开发环境配置

    hadoop-2.6.0集群开发环境配置 一.环境说明 1.1安装环境说明 本例中,操作系统为CentOS 6.6, JDK版本号为JDK 1.7,Hadoop版本号为Apache Hadoop 2. ...

  8. redis5.0集群配置

    介绍 redis自3.0版本以来支持主从模式的集群,可用哨兵监控集群健康状态,但这种方式的集群很不成熟,数据备份需要全量拷贝.在之后的版本才真正支持集群分片. 在redis5.0中去除了以redis- ...

  9. Linux基于Hadoop2.8.0集群安装配置Hive2.1.1及基础操作

    前言 安装Apache Hive前提是要先安装hadoop集群,并且hive只需要在hadoop的namenode节点集群里安装即可,安装前需保证Hadoop已启(动文中用到了hadoop的hdfs命 ...

随机推荐

  1. idea和Webstorm上使用git和github,码云

    由于之前一直使用svn,现在项目使用git,顾根据网上找的学习资料,自己梳理了下,收获蛮多,这里做个记录,如果能帮助到您那是最好不过的. 1.大致步骤 使用工具:idea,github,码云 webs ...

  2. 小白的Python之路 day1 数据类型,数据运算

    一.数据类型初识 1.数字 2 是一个整数的例子.长整数 不过是大一些的整数.3.23和52.3E-4是浮点数的例子.E标记表示10的幂.在这里,52.3E-4表示52.3 * 10-4.(-5+4j ...

  3. 【ANT】description元素和属性

    <?xml version="1.0" ?> <project default="test"> <description> ...

  4. 解决IOS iframe不滚动问题

    .frameBox{ position: fixed; top: 0; left: 0; right: 0; bottom: 0; -webkit-overflow-scrolling: touch; ...

  5. APP上传APP Store遇到的各种问题

    内容含敏感话题或对苹果不友好的信息(如苹果婊) 使用了友盟的统计SDK,获取了IDFA但是上传填写无广告 采用友盟IDFA的sdk,并用友盟的默认淘宝页面广告,被告知和产品内容不符(最近) App在i ...

  6. 如何检测mvc性能和sql语句

    mvc中使用linq如何检测sql语句 .net中使用mvc开发已经是一种趋势,不仅仅是.net ,java 等越来越多的开发者更倾向于mvc这种开发模式,在.net mvc 使用linq非常方便,各 ...

  7. Clonezilla SE---克隆linux------转载

    引入: 本博文将会是<学生机房中的虚拟化>专题中的核心内容.因为,通过本篇博文的讲述,大家可以看到用于网络化批量部署Linux系统的Clonezilla SE搭建的全过程.注意,几乎所有命 ...

  8. JMeter常见错误解决方法

    1.Windows 平台,双击 jmeter/bin 目录下 jmeter.bat 文件,jmeter 无法启动且报错如下: 此问题是没有配置 jdk 环境变量所致,配置好 jdk 环境变量即可. 2 ...

  9. Android 7.1 WindowManagerService 屏幕旋转流程分析 (三)

    三.屏幕的绘制 performSurfacePlacement()函数来触发window的绘制,这里最大的循环次数是6,当然一般不会到最大次数就会被Scheduled. final void perf ...

  10. .net 框架

    目录 API 应用框架(Application Frameworks) 应用模板(Application Templates) 人工智能(Artificial Intelligence) 程序集处理( ...