-
-
Notifications
You must be signed in to change notification settings - Fork 49
Scale out using redis
Gerasimos (Makis) Maropoulos edited this page Jul 14, 2019
·
1 revision
This section explains aspects of setting up a Redis server for scaling out.
- Download & Run Redis from https://redis.io/download
- or for Windows OS https://github.com/ServiceStack/redis-windows
- In the Go import statements add
github.com/kataras/neffos/stackexchange/redis
and use it.
The first input argument is the optional redis client configuration.
The second one is the redis channel prefix which messages will be published and connections will be subscribed to.
Setting a channel prefix isolates one neffos app from others that use different channel prefixes.
import "github.com/kataras/neffos/stackexchange/redis"
// [server := neffos.New...]
exc, err := redis.NewStackExchange(redis.Config{}, "MyChatApp")
if err != nil {
// [...]
}
server.UseStackExchange(exc)
Options can be set in the Config
structure.
Name | Description | Default |
---|---|---|
Network | Protocol to use | "tcp" |
Addr | Network address of a single redis instance | "127.0.0.1:6379" |
Clusters | A list of network addresses for redis clusters | nil |
Password | A password to connect | empty |
DialTimeout | Max time to connect | 0 |
MaxActive | Keep open at least the given number of connections to the redis instance | 10 |
Redis Clustering is a method for achieving high availability by using multiple Redis servers. Clustering is supported by the Clusters []string
configuration field.
Home | About | Project | Getting Started | Technical Docs | Copyright © 2019-2023 Gerasimos Maropoulos. Documentation terms of use.