You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/clustering.md
+23Lines changed: 23 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -38,9 +38,32 @@ import { createCluster } from 'redis';
38
38
| defaults || The default configuration values for every client in the cluster. Use this for example when specifying an ACL user to connect with |
39
39
| useReplicas |`false`| When `true`, distribute load by executing readonly commands (such as `GET`, `GEOSEARCH`, etc.) across all cluster nodes. When `false`, only use master nodes |
40
40
| maxCommandRedirections |`16`| The maximum number of times a command will be redirected due to `MOVED` or `ASK` errors |
41
+
| nodeAddressMap || Object defining the [node address mapping](#node-address-map)|
41
42
| modules || Object defining which [Redis Modules](../README.md#modules) to include |
42
43
| scripts || Object defining Lua Scripts to use with this client (see [Lua Scripts](../README.md#lua-scripts)) |
43
44
45
+
## Node Address Map
46
+
47
+
Your cluster might be configured to work within an internal network that your local environment doesn't have access to. For example, your development machine could only have access to external addresses, but the cluster returns its internal addresses. In this scenario, it's useful to provide a map from those internal addresses to the external ones.
48
+
49
+
The configuration for this is a simple mapping. Just provide a `nodeAddressMap` property mapping the internal addresses and ports to the external addresses and ports. Then, any address provided to `rootNodes` or returned from the cluster will be mapped accordingly:
50
+
51
+
```javascript
52
+
createCluster({
53
+
rootNodes: [{
54
+
url:'10.0.0.1:30001'
55
+
}, {
56
+
url:'10.0.0.2:30002'
57
+
}],
58
+
nodeAddressMap: {
59
+
'10.0.0.1:30001':'external-host-1.io:30001',
60
+
'10.0.0.2:30002':'external-host-2.io:30002'
61
+
}
62
+
});
63
+
```
64
+
65
+
> This is a common problem when using ElastiCache. See [Accessing ElastiCache from outside AWS](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/accessing-elasticache.html) for more information on that.
0 commit comments