可在多台机器上部署SSDB 服务,当作不同节点。
只需配置节点文件:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
"debug":true,
"host":"127.0.0.1", //Proxy listen host
"port":4001,// Proxy listen port
"password":"", //Proxy password
"nodelist":[ //Sharding nodes
{
"id":"current",
"host":"127.0.0.1",
"port":4002,
"password":"ssdbpassword",
"weight":100
},
{
"id":"asia",
"host":"127.0.0.1",
"port":4003,
"password":"ssdbpassword",
"weight":100
}
]
}
实现机制:通过设置节点权重来写数据,优先在第一个节点写入;通过遍历节点来取数据,处理速度降低了,但能作分布式扩展。
项目地址 https://github.com/matishsiao/ssdbproxy
本文网址: https://golangnote.com/topic/71.html 转摘请注明来源