ManateePostgres 自动故障转移
Manatee 是一个基于ZooKeeper的系统能够管理Postgres的备份和自动故障转移,Manatee和Moray共同提供高可用的键值服务。
客户端代码:
var manatee = require('node-manatee'); var client = manatee.createClient({ "path": "/manatee/1", "zk": { "connectTimeout": 2000, "servers": [{ "host": "172.27.10.97", "port": 2181 }, { "host": "172.27.10.90", "port": 2181 }, { "host": "172.27.10.101", "port": 2181 }], "timeout": 20000 } }); client.once('ready', function () { console.log('manatee client ready'); }); client.on('topology', function (urls) { console.log({urls: urls}, 'topology changed'); }); client.on('error', function (err) { console.error({err: err}, 'got client error'); });
评论