You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/10/25 15:26:17 UTC

[GitHub] [incubator-seatunnel] TyrantLucifer opened a new pull request, #3188: [Improve][Connector-V2][Redis] Support redis cluster connection & user authentication

TyrantLucifer opened a new pull request, #3188:
URL: https://github.com/apache/incubator-seatunnel/pull/3188

   <!--
   
   Thank you for contributing to SeaTunnel! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-seatunnel/issues).
   
     - Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
   
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   
   -->
   
   ## Purpose of this pull request
   
   close #3187 
   
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   
   ## Check list
   
   * [x] Code changed are covered with tests, or it does not need tests for reason:
   * [ ] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [x] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] ic4y merged pull request #3188: [Improve][Connector-V2][Redis] Support redis cluster connection & user authentication

Posted by GitBox <gi...@apache.org>.
ic4y merged PR #3188:
URL: https://github.com/apache/incubator-seatunnel/pull/3188


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] EricJoy2048 closed pull request #3188: [Improve][Connector-V2][Redis] Support redis cluster connection & user authentication

Posted by GitBox <gi...@apache.org>.
EricJoy2048 closed pull request #3188: [Improve][Connector-V2][Redis] Support redis cluster connection & user authentication
URL: https://github.com/apache/incubator-seatunnel/pull/3188


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] EricJoy2048 commented on a diff in pull request #3188: [Improve][Connector-V2][Redis] Support redis cluster connection & user authentication

Posted by GitBox <gi...@apache.org>.
EricJoy2048 commented on code in PR #3188:
URL: https://github.com/apache/incubator-seatunnel/pull/3188#discussion_r1007819225


##########
docs/en/connector-v2/sink/Redis.md:
##########
@@ -121,3 +131,7 @@ simple:
 ### 2.2.0-beta 2022-09-26
 
 - Add Redis Sink Connector
+
+### 2.3.0-beta 2022-10-25

Review Comment:
   `### next version`



##########
docs/en/connector-v2/sink/Redis.md:
##########
@@ -121,3 +131,7 @@ simple:
 ### 2.2.0-beta 2022-09-26
 
 - Add Redis Sink Connector
+
+### 2.3.0-beta 2022-10-25
+
+- Support redis cluster mode connection and user authentication

Review Comment:
   `- [Improve/BugFix] xxxxxxxx ([prid](https://github.com/apache/incubator-seatuxxxnnel/pull/prid))`



##########
docs/en/connector-v2/source/Redis.md:
##########
@@ -67,10 +69,18 @@ redis data types, support `key` `hash` `list` `set` `zset`
 > Each element in the sorted set will be sent downstream as a single row of data
 > For example, the value of sorted set is `[tyrantlucier, CalvinKirs]`, the data received downstream are `tyrantlucifer` and `CalvinKirs` and only two message will be received.
 
+### user [String]

Review Comment:
   This doc has the same problem as `sink/Redis.md`



##########
docs/en/connector-v2/sink/Redis.md:
##########
@@ -75,10 +77,18 @@ Redis data types, support `key` `hash` `list` `set` `zset`
 - zset
 > Each data from upstream will be added to the configured zset key with a weight of 1. So the order of data in zset is based on the order of data consumption.
 
+### user [String]

Review Comment:
   `string` is better.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] TaoZex commented on a diff in pull request #3188: [Improve][Connector-V2][Redis] Support redis cluster connection & user authentication

Posted by GitBox <gi...@apache.org>.
TaoZex commented on code in PR #3188:
URL: https://github.com/apache/incubator-seatunnel/pull/3188#discussion_r1008803526


##########
docs/en/connector-v2/sink/Redis.md:
##########
@@ -75,10 +77,18 @@ Redis data types, support `key` `hash` `list` `set` `zset`
 - zset
 > Each data from upstream will be added to the configured zset key with a weight of 1. So the order of data in zset is based on the order of data consumption.
 
+### user [String]
+
+redis authentication user, you need it when you connect to an encrypted cluster
+
 ### auth [String]
 
 Redis authentication password, you need it when you connect to an encrypted cluster
 
+### mode [String]
+
+redis mode, `single` or `cluster`, default is `single`
+
 ### format [String]

Review Comment:
   same as above



##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/JedisWrapper.java:
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.connectors.seatunnel.redis.config;
+
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.JedisCluster;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class JedisWrapper extends Jedis {
+    private final JedisCluster jedisCluster;
+
+    public JedisWrapper(JedisCluster jedisCluster) {
+        this.jedisCluster = jedisCluster;
+    }
+
+    @Override
+    public String set(final String key, final String value) {
+        return jedisCluster.set(key, value);
+    }
+
+    @Override
+    public String get(final String key) {
+        return jedisCluster.get(key);
+    }
+
+    @Override
+    public long hset(final String key, final Map<String, String> hash) {
+        return jedisCluster.hset(key, hash);
+    }
+
+    @Override
+    public Map<String, String> hgetAll(final String key) {
+        return jedisCluster.hgetAll(key);
+    }
+
+    @Override
+    public long lpush(final String key, final String... strings) {
+        return jedisCluster.lpush(key, strings);
+    }
+
+    @Override
+    public List<String> lrange(final String key, final long start, final long stop) {
+        return jedisCluster.lrange(key, start, stop);
+    }
+
+    @Override
+    public long sadd(final String key, final String... members) {
+        return jedisCluster.sadd(key, members);
+    }
+
+    @Override
+    public Set<String> smembers(final String key) {
+        return jedisCluster.smembers(key);
+    }
+
+    @Override
+    public long zadd(final String key, final double score, final String member) {
+        return jedisCluster.zadd(key, score, member);
+    }
+
+    @Override
+    public List<String> zrange(final String key, final long start, final long stop) {
+        return jedisCluster.zrange(key, start, stop);
+    }
+
+    @Override
+    public void close() {
+        jedisCluster.close();
+    }

Review Comment:
   Do we need to check jedisCluster is null?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org