redis4 0 集群,jedis客戶端連線配置

2021-09-07 16:36:53 字數 3975 閱讀 1140

使用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和password組成,害得我還要配置這麼多引數。

<?

xml version="1.0" encoding="utf-8"

?>

<

beans

xmlns

=""xmlns:context

=""xmlns:p

=""xmlns:aop

=""xmlns:tx

=""xmlns:xsi

=""xsi:schemalocation

=" /spring-beans-4.0.xsd

/spring-context-4.0.xsd

/spring-aop-4.0.xsd /spring-tx-4.0.xsd

/spring-util-4.0.xsd"

>

<

context:property-placeholder

location

="classpath:conf/redis.properties"

/>

<

bean

class

="redis.clients.jedis.jediscluster"

id="jedisclusterorginal"

>

<

constructor-arg

name

="jedisclusternode"

>

<

set>

<

bean

class

="redis.clients.jedis.hostandport"

>

<

constructor-arg

index

="0"

value

="$"

/>

<

constructor-arg

index

="1"

value

="6379"

/>

bean

>

<

bean

class

="redis.clients.jedis.hostandport"

>

<

constructor-arg

index

="0"

value

="$"

/>

<

constructor-arg

index

="1"

value

="6380"

/>

bean

>

<

bean

class

="redis.clients.jedis.hostandport"

>

<

constructor-arg

index

="0"

value

="$"

/>

<

constructor-arg

index

="1"

value

="6381"

/>

bean

>

<

bean

class

="redis.clients.jedis.hostandport"

>

<

constructor-arg

index

="0"

value

="$"

/>

<

constructor-arg

index

="1"

value

="6382"

/>

bean

>

<

bean

class

="redis.clients.jedis.hostandport"

>

<

constructor-arg

index

="0"

value

="$"

/>

<

constructor-arg

index

="1"

value

="6383"

/>

bean

>

<

bean

class

="redis.clients.jedis.hostandport"

>

<

constructor-arg

index

="0"

value

="$"

/>

<

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

="$"

>

constructor-arg

>

<

constructor-arg

name

="poolconfig"

ref="jedispoolconfig"

>

constructor-arg

>

bean

>

<

bean

class

="com.s2s.common.jedis.jedisclientcluster"

id="jediscluster"

>

<

property

name

="jediscluster"

ref="jedisclusterorginal"

>

property

>

bean

>

beans

>

redis3 0 0 集群安裝

redis集群部署文件 centos6系統 要讓集群正常工作至少需要3 個主節點,在這裡我們要建立6個 redis 節點,其中三個為主節點,三個為從節點,對應的 redis 節點的ip 和埠對應關係如下 127.0.0.1 7000 127.0.0.1 7001 127.0.0.1 7002 127...

Redis3 0 6集群搭建

建立乙個rediscluster之前,我們需要有一些以cluster模式執行的redis例項,這是因為cluster模式下redis例項將會開啟cluster的特徵和命令。現在我有2臺vbox搭建的centos6虛擬機器 centos1 192.168.56.101 和centos2 192.168...

Redis3 0 集群搭建

redis3.0 部僅提供了哨兵監控,熱切換,還提供了集群解決方案,接下來簡單的搭建redis3.0集群 1 新建三個redis server例項,我們可以將redis.conf分別copy到7001,7002,7003的資料夾中,並修改相應的配置 vi redis3.0 instance 7001...