redis-multi-server
v1.0.0
Published
This module was designed to mange multiple redis servers and do not let you think how information and on witch server is stored. Module will choose the server with more free information and memory
Downloads
1
Maintainers
Readme
docker run -d -h redis -e REDIS_PASSWORD=pass -v redis-data:/data -p 5020:6379 --name redis --restart always redis:5.0.5-alpine3.9 /bin/sh -c 'redis-server --appendonly yes --requirepass ${REDIS_PASSWORD}'
const RC = require("redis-multi-server");
let redis_list = [
{
name: "REDIS 1",
username: "",
password: "my_secure_password",
host: "myredis1.com",
port: 5020,
},
{
name: "REDIS 2",
username: "",
password: "my_secure_password2",
host: "myredis2.com",
port: 5021
},
]
let rc = new RC(redis_list,{
onAllConnected : async ()=>{
//Save information to redis server
await rc.set("a", "MyInfo");
//Save information to custom redis server
await rc.set("test", "MyInfo2", "TIVIMIVI");
//Get saved information from redis
await rc.get("b");
//Get saved information from redis
await rc.remove("b");
}
})