DATAREDIS-869 - Use changed nomenclature in documentation and readme.
Original Pull Request: #355
This commit is contained in:
committed by
Christoph Strobl
parent
e253d49f4a
commit
a7352f5612
2
Makefile
2
Makefile
@@ -105,7 +105,7 @@ cluster-start: work/cluster-7379.pid work/cluster-7380.pid work/cluster-7381.pid
|
||||
work/meet-%:
|
||||
-work/redis/bin/redis-cli -p $* cluster meet 127.0.0.1 7379
|
||||
|
||||
# Handled separately because this node is a slave
|
||||
# Handled separately because this node is a replica
|
||||
work/meet-7382:
|
||||
-work/redis/bin/redis-cli -p 7382 cluster meet 127.0.0.1 7379
|
||||
sleep 2
|
||||
|
||||
@@ -104,8 +104,8 @@ Running the tests requires you to have a RedisServer running at its default port
|
||||
You can alternatively use the provided `Makefile` which runs the build plus downloads and spins up the following environment:
|
||||
|
||||
* 1 Single Node
|
||||
* HA Redis (1 Master, 2 Slaves, 3 Sentinels).
|
||||
* Redis Cluster (3 Masters, 1 Slave)
|
||||
* HA Redis (1 Master, 2 Replicas, 3 Sentinels).
|
||||
* Redis Cluster (3 Masters, 1 Replica)
|
||||
|
||||
```bash
|
||||
make test
|
||||
|
||||
@@ -7,7 +7,7 @@ This section briefly covers items that are new and noteworthy in the latest rele
|
||||
== New in Spring Data Redis 2.1
|
||||
|
||||
* Unix domain socket connections using <<redis:connectors:lettuce,Lettuce>>.
|
||||
* <<redis:write-to-master-read-from-slave, Write to Master, read from Slave>> support using Lettuce.
|
||||
* <<redis:write-to-master-read-from-replica, Write to Master, read from Replica>> support using Lettuce.
|
||||
* <<query-by-example,Query by Example>> integration.
|
||||
* `@TypeAlias` Support for Redis repositories.
|
||||
* Cluster-wide `SCAN` using Lettuce and `SCAN` execution on a selected node supported by both drivers.
|
||||
|
||||
@@ -67,7 +67,7 @@ NOTE: The initial configuration points driver libraries to an initial set of clu
|
||||
|
||||
== Working With Redis Cluster Connection
|
||||
|
||||
As mentioned earlier, Redis Cluster behaves differently from single-node Redis or even a Sentinel-monitored master-slave environment. This is because the automatic sharding maps a key to one of 16384 slots, which are distributed across the nodes. Therefore, commands that involve more than one key must assert all keys map to the exact same slot to avoid cross-slot execution errors.
|
||||
As mentioned earlier, Redis Cluster behaves differently from single-node Redis or even a Sentinel-monitored master-replica environment. This is because the automatic sharding maps a key to one of 16384 slots, which are distributed across the nodes. Therefore, commands that involve more than one key must assert all keys map to the exact same slot to avoid cross-slot execution errors.
|
||||
A single cluster node serves only a dedicated set of keys. Commands issued against one particular server return results only for those keys served by that server. As a simple example, consider the `KEYS` command. When issued to a server in a cluster environment, it returns only the keys served by the node the request is sent to and not necessarily all keys within the cluster. So, to get all keys in a cluster environment, you must read the keys from all the known master nodes.
|
||||
|
||||
While redirects for specific keys to the corresponding slot-serving node are handled by the driver libraries, higher-level functions, such as collecting information across nodes or sending commands to all nodes in the cluster, are covered by `RedisClusterConnection`. Picking up the keys example from earlier, this means that the `keys(pattern)` method picks up every master node in the cluster and simultaneously executes the `KEYS` command on every master node while picking up the results and returning the cumulated set of keys. To just request the keys of a single node `RedisClusterConnection` provides overloads for those methods (for example, `keys(node, pattern)`).
|
||||
@@ -102,10 +102,10 @@ connection.keys(NODE_7380, "*"); <
|
||||
connection.keys(NODE_7381, "*"); <10>
|
||||
connection.keys(NODE_7382, "*"); <11>
|
||||
----
|
||||
<1> Master node serving slots 0 to 5460 replicated to slave at 7382
|
||||
<1> Master node serving slots 0 to 5460 replicated to replica at 7382
|
||||
<2> Master node serving slots 5461 to 10922
|
||||
<3> Master node serving slots 10923 to 16383
|
||||
<4> Slave node holding replicants of the master at 7379
|
||||
<4> Replica node holding replicants of the master at 7379
|
||||
<5> Request routed to node at 7381 serving slot 12182
|
||||
<6> Request routed to node at 7379 serving slot 5061
|
||||
<7> Request routed to nodes at 7379, 7380, 7381 -> [thing1, thing2]
|
||||
@@ -166,5 +166,5 @@ The following example shows how to access `RedisClusterConnection` with `RedisTe
|
||||
ClusterOperations clusterOps = redisTemplate.opsForCluster();
|
||||
clusterOps.shutdown(NODE_7379); <1>
|
||||
----
|
||||
<1> Shut down node at 7379 and cross fingers there is a slave in place that can take over.
|
||||
<1> Shut down node at 7379 and cross fingers there is a replica in place that can take over.
|
||||
====
|
||||
|
||||
@@ -109,15 +109,15 @@ class RedisConfiguration {
|
||||
}
|
||||
----
|
||||
|
||||
[[redis:write-to-master-read-from-slave]]
|
||||
=== Write to Master, Read from Slave
|
||||
[[redis:write-to-master-read-from-replica]]
|
||||
=== Write to Master, Read from Replica
|
||||
|
||||
The Redis Master/Slave setup -- without automatic failover (for automatic failover see: <<redis:sentinel, Sentinel>>) -- not only allows data to be safely stored at more nodes. It also allows, by using <<redis:connectors:lettuce, Lettuce>>, reading data from slaves while pushing writes to the master. You can set the read/write strategy to be used by using `LettuceClientConfiguration`, as shown in the following example:
|
||||
The Redis Master/Replica setup -- without automatic failover (for automatic failover see: <<redis:sentinel, Sentinel>>) -- not only allows data to be safely stored at more nodes. It also allows, by using <<redis:connectors:lettuce, Lettuce>>, reading data from replicas while pushing writes to the master. You can set the read/write strategy to be used by using `LettuceClientConfiguration`, as shown in the following example:
|
||||
|
||||
[source,java]
|
||||
----
|
||||
@Configuration
|
||||
class WriteToMasterReadFromSlaveConfiguration {
|
||||
class WriteToMasterReadFromReplicaConfiguration {
|
||||
|
||||
@Bean
|
||||
public LettuceConnectionFactory redisConnectionFactory() {
|
||||
@@ -133,7 +133,7 @@ class WriteToMasterReadFromSlaveConfiguration {
|
||||
}
|
||||
----
|
||||
|
||||
TIP: For environments reporting non-public addresses through the `INFO` command (for example, when using AWS), use `RedisStaticMasterSlaveConfiguration` instead of `RedisStandaloneConfiguration`.
|
||||
TIP: For environments reporting non-public addresses through the `INFO` command (for example, when using AWS), use `RedisStaticMasterReplicaConfiguration` instead of `RedisStandaloneConfiguration`.
|
||||
|
||||
[[redis:sentinel]]
|
||||
== Redis Sentinel Support
|
||||
|
||||
Reference in New Issue
Block a user