-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: support redis sentinel mode #3348
Conversation
server/src/main/java/io/seata/server/storage/redis/JedisPooledFactory.java
Outdated
Show resolved
Hide resolved
script/config-center/config.txt 需要修改 |
application.properties, application.yml这些文件也要改一下 |
additional-spring-configuration-metadata.json 这个文件把配置提示加上。 |
import redis.clients.jedis.Jedis; | ||
import redis.clients.jedis.JedisPool; | ||
import redis.clients.jedis.JedisPoolConfig; | ||
import redis.clients.jedis.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
调整一下import顺序和不要用*配置
if (StringUtils.isBlank(masterName)) { | ||
throw new RedisException("The masterName is null in redis sentinel mode"); | ||
} | ||
Set<String> sentinels = new HashSet<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initsize?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以,因为set存sentinel节点信息,节点数量固定是3
server/src/main/resources/file.conf
Outdated
@@ -40,8 +40,19 @@ store { | |||
|
|||
## redis store property | |||
redis { | |||
host = "127.0.0.1" | |||
port = "6379" | |||
## redis mode: single、sentinel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
调整一下缩进
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
jedisPool = new JedisSentinelPool(masterName, sentinels, poolConfig, 60000, password, | ||
CONFIGURATION.getInt(ConfigurationKeys.STORE_REDIS_DATABASE, DATABASE)); | ||
} else if (mode.equals(ConfigurationKeys.REDIS_SINGLE_MODE)) { | ||
String host = StringUtils.isBlank(CONFIGURATION.getConfig(ConfigurationKeys.STORE_REDIS_SINGLE_HOST)) ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CONFIGURATION.getConfig(ConfigurationKeys.STORE_REDIS_SINGLE_HOST) 调了两次,可以用个变量接一下,下面的CONFIGURATION.getInt(ConfigurationKeys.STORE_REDIS_SINGLE_PORT)也是
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,我优化下
@@ -125,3 +125,38 @@ seata.registry.custom.name= | |||
|
|||
seata.registry.load-balance=RandomLoadBalance | |||
seata.registry.load-balance-virtual-nodes=10 | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是不是改错文件了?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已经更改过来了
Codecov Report
@@ Coverage Diff @@
## develop #3348 +/- ##
=============================================
- Coverage 51.72% 51.71% -0.02%
- Complexity 3347 3353 +6
=============================================
Files 617 617
Lines 20256 20271 +15
Branches 2540 2544 +4
=============================================
+ Hits 10478 10483 +5
- Misses 8727 8740 +13
+ Partials 1051 1048 -3
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. please update 'changes' folder 1.5.0.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Ⅰ. Describe what this PR did
supports transaction session storage for redis sentinel mode
Ⅱ. Does this pull request fix one issue?
fixes #3339
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews