diff --git a/Makefile b/Makefile
index cda10c460..11decf20a 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-REDIS_VERSION:=4.0.9
+REDIS_VERSION:=4.0.11
SPRING_PROFILE?=ci
#######
diff --git a/src/main/java/org/springframework/data/redis/connection/RedisClusterCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisClusterCommands.java
index c07f13e4b..7a6174ede 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisClusterCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisClusterCommands.java
@@ -174,10 +174,10 @@ public interface RedisClusterCommands {
* Assign a {@literal slave} to given {@literal master}.
*
* @param master must not be {@literal null}.
- * @param slave must not be {@literal null}.
+ * @param replica must not be {@literal null}.
* @see Redis Documentation: CLUSTER REPLICATE
*/
- void clusterReplicate(RedisClusterNode master, RedisClusterNode slave);
+ void clusterReplicate(RedisClusterNode master, RedisClusterNode replica);
enum AddSlots {
MIGRATING, IMPORTING, STABLE, NODE
diff --git a/src/main/java/org/springframework/data/redis/connection/RedisClusterNode.java b/src/main/java/org/springframework/data/redis/connection/RedisClusterNode.java
index 37295ee7d..b36becbf2 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisClusterNode.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisClusterNode.java
@@ -326,6 +326,16 @@ public class RedisClusterNode extends RedisNode {
return this;
}
+ /*
+ * (non-Javadoc)
+ * @see org.springframework.data.redis.connection.RedisNode.RedisNodeBuilder#replicaOf(java.lang.String)
+ */
+ @Override
+ public RedisClusterNodeBuilder replicaOf(String masterId) {
+ super.replicaOf(masterId);
+ return this;
+ }
+
/**
* Set flags for node.
*
diff --git a/src/main/java/org/springframework/data/redis/connection/RedisNode.java b/src/main/java/org/springframework/data/redis/connection/RedisNode.java
index ace9756ac..7326bc39c 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisNode.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisNode.java
@@ -128,6 +128,14 @@ public class RedisNode implements NamedNode {
* @since 1.7
*/
public boolean isSlave() {
+ return isReplica();
+ }
+
+ /**
+ * @return
+ * @since 2.1
+ */
+ public boolean isReplica() {
return ObjectUtils.nullSafeEquals(NodeType.SLAVE, getType());
}
@@ -242,7 +250,7 @@ public class RedisNode implements NamedNode {
/**
* Set server role.
*
- * @param nodeType
+ * @param type
* @return
* @since 1.7
*/
@@ -260,6 +268,17 @@ public class RedisNode implements NamedNode {
* @since 1.7
*/
public RedisNodeBuilder slaveOf(String masterId) {
+ return replicaOf(masterId);
+ }
+
+ /**
+ * Set the id of the master node.
+ *
+ * @param masterId
+ * @return this.
+ * @since 2.1
+ */
+ public RedisNodeBuilder replicaOf(String masterId) {
node.masterId = masterId;
return this;
diff --git a/src/main/java/org/springframework/data/redis/connection/RedisServer.java b/src/main/java/org/springframework/data/redis/connection/RedisServer.java
index fe745dfb2..53ce292dc 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisServer.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisServer.java
@@ -166,6 +166,16 @@ public class RedisServer extends RedisNode {
}
public Long getNumberSlaves() {
+ return getNumberReplicas();
+ }
+
+ /**
+ * Get the number of connected replicas.
+ *
+ * @return
+ * @since 2.1
+ */
+ public Long getNumberReplicas() {
return getLongValueOf(INFO.NUMBER_SLAVES);
}
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java
index f19600035..81e53258a 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java
@@ -641,12 +641,12 @@ public class JedisClusterConnection implements DefaultedRedisClusterConnection {
* @see org.springframework.data.redis.connection.RedisClusterCommands#clusterReplicate(org.springframework.data.redis.connection.RedisClusterNode, org.springframework.data.redis.connection.RedisClusterNode)
*/
@Override
- public void clusterReplicate(RedisClusterNode master, RedisClusterNode slave) {
+ public void clusterReplicate(RedisClusterNode master, RedisClusterNode replica) {
RedisClusterNode masterNode = topologyProvider.getTopology().lookup(master);
clusterCommandExecutor.executeCommandOnSingleNode(
- (JedisClusterCommandCallback) client -> client.clusterReplicate(masterNode.getId()), slave);
+ (JedisClusterCommandCallback) client -> client.clusterReplicate(masterNode.getId()), replica);
}
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnection.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnection.java
index 16cfc36b5..bca1c94b3 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnection.java
@@ -490,11 +490,11 @@ public class LettuceClusterConnection extends LettuceConnection implements Defau
* @see org.springframework.data.redis.connection.RedisClusterCommands#clusterReplicate(org.springframework.data.redis.connection.RedisClusterNode, org.springframework.data.redis.connection.RedisClusterNode)
*/
@Override
- public void clusterReplicate(RedisClusterNode master, RedisClusterNode slave) {
+ public void clusterReplicate(RedisClusterNode master, RedisClusterNode replica) {
RedisClusterNode masterNode = topologyProvider.getTopology().lookup(master);
clusterCommandExecutor.executeCommandOnSingleNode(
- (LettuceClusterCommandCallback) client -> client.clusterReplicate(masterNode.getId()), slave);
+ (LettuceClusterCommandCallback) client -> client.clusterReplicate(masterNode.getId()), replica);
}
/*