Skip to content

Commit 064bd80

Browse files
committed
docs: add standalone with replicas to README
Signed-off-by: Rueian <[email protected]>
1 parent 5cb5d89 commit 064bd80

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,19 @@ client, err := rueidis.NewClient(rueidis.ClientOption{
382382
InitAddress: []string{"127.0.0.1:6379"},
383383
})
384384

385+
// Connect to a standalone redis with replicas
386+
client, err := rueidis.NewClient(rueidis.ClientOption{
387+
InitAddress: []string{"127.0.0.1:6379"},
388+
Standalone: rueidis.StandaloneOption{
389+
// Note that these addresses must be online and can not be promoted.
390+
// An example use case is the reader endpoint provided by cloud vendors.
391+
ReplicaAddress: []string{"reader_endpoint:port"},
392+
},
393+
SendToReplicas: func(cmd rueidis.Completed) bool {
394+
return cmd.IsReadOnly()
395+
},
396+
})
397+
385398
// Connect to a redis cluster
386399
client, err := rueidis.NewClient(rueidis.ClientOption{
387400
InitAddress: []string{"127.0.0.1:7001", "127.0.0.1:7002", "127.0.0.1:7003"},

0 commit comments

Comments
 (0)