diff --git a/changes/en-us/2.0.0.md b/changes/en-us/2.0.0.md
index fd0bc3cc0eb..3516f730358 100644
--- a/changes/en-us/2.0.0.md
+++ b/changes/en-us/2.0.0.md
@@ -76,6 +76,7 @@ The version is updated as follows:
- [[#5821](https://github.com/seata/seata/pull/5821)] fix insert executor keywords unescape
- [[#5835](https://github.com/seata/seata/pull/5835)] bugfix: fix TC retry rollback wrongly, after the XA transaction fail and rollback
- [[#5881](https://github.com/seata/seata/pull/5880)] fix delete branch table unlock failed
+- [[#5930](https://github.com/seata/seata/pull/5930)] fix the issue of missing sentinel password in store redis mode
### optimize:
- [[#5208](https://github.com/seata/seata/pull/5208)] optimize throwable getCause once more
diff --git a/changes/zh-cn/2.0.0.md b/changes/zh-cn/2.0.0.md
index be015c16c2f..431606c58ae 100644
--- a/changes/zh-cn/2.0.0.md
+++ b/changes/zh-cn/2.0.0.md
@@ -75,6 +75,7 @@ Seata 是一款开源的分布式事务解决方案,提供高性能和简单
- [[#5821](https://github.com/seata/seata/pull/5821)] 修复insert executor对关键字未转义的问题
- [[#5835](https://github.com/seata/seata/pull/5835)] bugfix: 修复当 XA 事务失败回滚后,TC 还会继续重试回滚的问题
- [[#5881](https://github.com/seata/seata/pull/5880)] 修复事务回滚时锁未删除的问题
+- [[#5930](https://github.com/seata/seata/pull/5930)] 修复存储为redis哨兵模式下哨兵密码缺失的问题
### optimize:
- [[#5208](https://github.com/seata/seata/pull/5208)] 优化多次重复获取Throwable#getCause问题
diff --git a/common/src/main/java/io/seata/common/ConfigurationKeys.java b/common/src/main/java/io/seata/common/ConfigurationKeys.java
index fc102507816..98bb53f388a 100644
--- a/common/src/main/java/io/seata/common/ConfigurationKeys.java
+++ b/common/src/main/java/io/seata/common/ConfigurationKeys.java
@@ -743,6 +743,11 @@ public interface ConfigurationKeys {
*/
String STORE_REDIS_SENTINEL_HOST = STORE_REDIS_SENTINEL_PREFIX + "sentinelHosts";
+ /**
+ * STORE_REDIS_SENTINEL_PASSWORD.
+ */
+ String STORE_REDIS_SENTINEL_PASSWORD = STORE_REDIS_SENTINEL_PREFIX + "sentinelPassword";
+
/**
* The constant CLIENT_DEGRADE_CHECK_PERIOD.
*/
diff --git a/dependencies/pom.xml b/dependencies/pom.xml
index e112d3ef370..e40c967a2ef 100644
--- a/dependencies/pom.xml
+++ b/dependencies/pom.xml
@@ -92,7 +92,7 @@
0.2.0-RC2
- 3.2.0
+ 3.8.0
diff --git a/script/config-center/config.txt b/script/config-center/config.txt
index e4fd24380e9..ee0caa02dcc 100644
--- a/script/config-center/config.txt
+++ b/script/config-center/config.txt
@@ -105,6 +105,7 @@ store.redis.single.host=127.0.0.1
store.redis.single.port=6379
store.redis.sentinel.masterName=
store.redis.sentinel.sentinelHosts=
+store.redis.sentinel.sentinelPassword=
store.redis.maxConn=10
store.redis.minConn=1
store.redis.maxTotal=100
diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreRedisProperties.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreRedisProperties.java
index 54f93887cf0..13090e8c178 100644
--- a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreRedisProperties.java
+++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreRedisProperties.java
@@ -149,6 +149,8 @@ public static class Sentinel {
*/
private String sentinelHosts;
+ private String sentinelPassword;
+
public String getMasterName() {
return masterName;
}
@@ -166,5 +168,14 @@ public Sentinel setSentinelHosts(String sentinelHosts) {
this.sentinelHosts = sentinelHosts;
return this;
}
+
+ public String getSentinelPassword() {
+ return sentinelPassword;
+ }
+
+ public Sentinel setSentinelPassword(String sentinelPassword) {
+ this.sentinelPassword = sentinelPassword;
+ return this;
+ }
}
}
diff --git a/server/src/main/java/io/seata/server/storage/redis/JedisPooledFactory.java b/server/src/main/java/io/seata/server/storage/redis/JedisPooledFactory.java
index d3d1a442eed..6a506df9116 100644
--- a/server/src/main/java/io/seata/server/storage/redis/JedisPooledFactory.java
+++ b/server/src/main/java/io/seata/server/storage/redis/JedisPooledFactory.java
@@ -27,12 +27,12 @@
import io.seata.core.constants.ConfigurationKeys;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolAbstract;
import redis.clients.jedis.JedisPoolConfig;
import redis.clients.jedis.JedisSentinelPool;
-
+import redis.clients.jedis.Protocol;
+import redis.clients.jedis.Jedis;
import static io.seata.common.DefaultValues.DEFAULT_REDIS_MAX_IDLE;
import static io.seata.common.DefaultValues.DEFAULT_REDIS_MAX_TOTAL;
import static io.seata.common.DefaultValues.DEFAULT_REDIS_MIN_IDLE;
@@ -59,7 +59,7 @@ public class JedisPooledFactory {
/**
* get the RedisPool instance (singleton)
- *
+ *
* @return redisPool
*/
public static JedisPoolAbstract getJedisPoolInstance(JedisPoolAbstract... jedisPools) {
@@ -98,7 +98,8 @@ public static JedisPoolAbstract getJedisPoolInstance(JedisPoolAbstract... jedisP
Set sentinels = new HashSet<>(SENTINEL_HOST_NUMBER);
String[] sentinelHosts = CONFIGURATION.getConfig(ConfigurationKeys.STORE_REDIS_SENTINEL_HOST).split(",");
Arrays.asList(sentinelHosts).forEach(sentinelHost -> sentinels.add(sentinelHost));
- tempJedisPool = new JedisSentinelPool(masterName, sentinels, poolConfig, 60000, password, CONFIGURATION.getInt(ConfigurationKeys.STORE_REDIS_DATABASE, DATABASE));
+ tempJedisPool = new JedisSentinelPool(masterName, sentinels, poolConfig, 60000, 60000, password, CONFIGURATION.getInt(ConfigurationKeys.STORE_REDIS_DATABASE, DATABASE),
+ null, Protocol.DEFAULT_TIMEOUT, Protocol.DEFAULT_TIMEOUT, CONFIGURATION.getConfig(ConfigurationKeys.STORE_REDIS_SENTINEL_PASSWORD), null);
} else if (mode.equals(ConfigurationKeys.REDIS_SINGLE_MODE)) {
String host = CONFIGURATION.getConfig(ConfigurationKeys.STORE_REDIS_SINGLE_HOST);
host = StringUtils.isBlank(host) ? CONFIGURATION.getConfig(ConfigurationKeys.STORE_REDIS_HOST, HOST) : host;
@@ -121,7 +122,7 @@ public static JedisPoolAbstract getJedisPoolInstance(JedisPoolAbstract... jedisP
/**
* get an instance of Jedis (connection) from the connection pool
- *
+ *
* @return jedis
*/
public static Jedis getJedisInstance() {
diff --git a/server/src/main/resources/application.example.yml b/server/src/main/resources/application.example.yml
index 459ebd411c6..08705e7a0bd 100644
--- a/server/src/main/resources/application.example.yml
+++ b/server/src/main/resources/application.example.yml
@@ -182,6 +182,7 @@ seata:
sentinel:
master-name:
sentinel-hosts:
+ sentinel-password:
metrics:
enabled: false
registry-type: compact