基于serf的数据库同步模块库
zhangzengfei
2023-05-15 8395ef00a651448cc7172c98a36014f98888ac9d
add default role tag
2个文件已修改
4 ■■■ 已修改文件
agent.go 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
config.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
agent.go
@@ -51,6 +51,7 @@
    NodeID              string         `json:"nodeID"`
    NodeAddress         string         `json:"nodeAddress"`
    IsAlive             int            `json:"isAlive"`
    Role                string         `json:"role"`
}
// Create create serf agent with config
@@ -406,6 +407,7 @@
        node.NodeAddress = mb.Addr.String() + ":" + strconv.Itoa(int(mb.Port))
        node.IsAlive = int(mb.Status)
        node.ClusterID = mb.Tags[tagKeyClusterID]
        node.Role = mb.Tags["role"]
        nodes = append(nodes, node)
    }
config.go
@@ -163,7 +163,7 @@
    serfConf.MemberlistConfig.BindPort = bindPort
    serfConf.NodeName = c.NodeName
    serfConf.Tags = map[string]string{TagKeyRPCPort: strconv.Itoa(c.RPCPort)}
    serfConf.Tags = map[string]string{TagKeyRPCPort: strconv.Itoa(c.RPCPort), "role": "slave"}
    if c.ClusterID != "" {
        serfConf.Tags[tagKeyClusterID] = c.ClusterID