Sentinel Support Derived from pr-692 (#1067)
This PR is derived from PR-692 and have been merged with the latest master commit.
Things that have been done:
1. review code for PR-692
2. fixed potential infinite loop in the code
3. Adapt code to success build with the latest master commit
4. Manual testing on 3 Sentinel nodes and 3 Redis nodes (connection and failover)
Usage:
```C#
ConfigurationOptions sentinelConfig = new ConfigurationOptions();
sentinelConfig.ServiceName = "mymaster";
sentinelConfig.EndPoints.Add("192.168.99.102", 26379);
sentinelConfig.EndPoints.Add("192.168.99.102", 26380);
sentinelConfig.EndPoints.Add("192.168.99.102", 26381);
sentinelConfig.TieBreaker = "";
sentinelConfig.DefaultVersion = new Version(4, 0, 11);
// its important to set the Sentinel commands supported
sentinelConfig.CommandMap = CommandMap.Sentinel;
// Get sentinel connection
ConnectionMultiplexer sentinelConnection = ConnectionMultiplexer.Connect(sentinelConfig, Console.Out);
// Create master service configuration
ConfigurationOptions masterConfig = new ConfigurationOptions { ServiceName = "mymaster" };
// Get master Redis connection
var redisMasterConnection = sentinelConnection.GetSentinelMasterConnection(masterConfig);
...
IDatabase db = redisMasterConnection.GetDatabase();
db.StringSet(key, value);
...
string value1 = db.StringGet(key);
```
Showing
This diff is collapsed.
This diff is collapsed.
Please register or sign in to comment