Skip to content
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

Support Redis cluster in Redis data-source extension #1751

Merged
merged 6 commits into from
Mar 9, 2021

Conversation

liqiangz
Copy link
Contributor

@liqiangz liqiangz commented Sep 21, 2020

Describe what this PR does / why we need it

Support Redis cluster in Redis data-source extension.

Does this pull request fix one issue?

Fixes #1749

Describe how you did it

To achieve this :

  • Make RedisDataSource have RedisClusterClient (Redis cluster can be handled by RedisClusterClient defference from Redis standalone and Redis Sentinel)
  • Make RedisConnectionConfig have redisClusters
  • When publishing rules, we need to get the RedisCommands with the rulesKey, because the transaction is not supported by RedisAdvancedClusterCommands. (Transaction can be handled in Redis Cluster when just using the same key. https://redis.io/topics/cluster-tutorial)

Example:

    RedisAdvancedClusterCommands<String, String> subCommands = redisClusterClient .connect().sync();
    int slot = SlotHash.getSlot(ruleKey);
    NodeSelection<String, String> nodes = subCommands.nodes((n)->n.hasSlot(slot));
    RedisCommands<String, String> commands = nodes.commands(0);

Describe how to verify it

Set up Redis Cluster and run ClusterModeRedisDataSourceTest.

Special notes for reviews

@sczyh30 sczyh30 added area/data-source Issues or PRs related to data-source extension to-review To review labels Sep 22, 2020
@sczyh30
Copy link
Member

sczyh30 commented Sep 22, 2020

Cool. Could you please add some details about the PR according to the PR description?

@liqiangz
Copy link
Contributor Author

@sczyh30 I have added some details

Copy link
Member

@sczyh30 sczyh30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sczyh30 sczyh30 added kind/enhancement Category issues or prs related to enhancement. and removed to-review To review labels Mar 9, 2021
@sczyh30 sczyh30 added this to the 1.8.2 milestone Mar 9, 2021
@sczyh30 sczyh30 merged commit 3e438b3 into alibaba:master Mar 9, 2021
@sczyh30
Copy link
Member

sczyh30 commented Mar 9, 2021

Nice work. Thanks for contributing!

@liqiangz liqiangz deleted the Redis-Cluster branch April 9, 2021 06:58
hughpearse pushed a commit to hughpearse/Sentinel that referenced this pull request Jun 2, 2021
linkolen pushed a commit to shivagowda/Sentinel that referenced this pull request Aug 4, 2021
linkolen added a commit to shivagowda/Sentinel that referenced this pull request Aug 4, 2021
Support Redis cluster mode in Redis data-source extension (alibaba#1751)
linkolen pushed a commit to shivagowda/Sentinel that referenced this pull request Aug 14, 2021
linkolen pushed a commit to shivagowda/Sentinel that referenced this pull request Aug 14, 2021
linkolen pushed a commit to shivagowda/Sentinel that referenced this pull request Aug 16, 2021
CST11021 pushed a commit to CST11021/Sentinel that referenced this pull request Nov 3, 2021
* pid 4bytes

* pid is 4 bytes

* alibaba#1751 fix bug and add a unit test

* alibaba#1751 short pid

* 保持原来

* alibaba#1751 remove repeat code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/data-source Issues or PRs related to data-source extension kind/enhancement Category issues or prs related to enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Redis cluster in Redis data-source extension
2 participants