Skip to content

Commit 8ea1c2d

Browse files
vipoxinrueian
andcommitted
Updated README to remove ambiguity about connecting to valkey on unix (redis#91)
* Updated README to remove ambiguitey about connecting to valkey on unix socket * Update README.md Signed-off-by: Rueian <[email protected]> --------- Signed-off-by: Rueian <[email protected]> Co-authored-by: vipox <nobody> Co-authored-by: Rueian <[email protected]> Signed-off-by: Rueian <[email protected]>
1 parent 43e30da commit 8ea1c2d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,13 @@ client, err := rueidis.NewClient(rueidis.ClientOption{
480480
MasterSet: "my_master",
481481
},
482482
})
483+
// connect to redis node through unix socket
484+
client, err := rueidis.NewClient(rueidis.ClientOption{
485+
InitAddress: []string{"/run/valkey.sock"},
486+
DialCtxFn: func(ctx context.Context, s string, d *net.Dialer, c *tls.Config) (conn net.Conn, err error) {
487+
return d.DialContext(ctx, "unix", s)
488+
},
489+
})
483490
```
484491

485492
### Redis URL
@@ -497,6 +504,8 @@ client, err = rueidis.NewClient(rueidis.MustParseURL("redis://127.0.0.1:7001?add
497504
client, err = rueidis.NewClient(rueidis.MustParseURL("redis://127.0.0.1:6379/0"))
498505
// connect to a redis sentinel
499506
client, err = rueidis.NewClient(rueidis.MustParseURL("redis://127.0.0.1:26379/0?master_set=my_master"))
507+
// connecting to redis node using unix socket
508+
client, err = rueidis.NewClient(rueidis.MustParseURL("unix:///run/redis.conf?db=0"))
500509
```
501510

502511
### Availability Zone Affinity Routing

0 commit comments

Comments
 (0)