CAP as the base of Cluster System. Cnsistency: all node see the same data at the same time. Availability: read and write always succeed. P: the system continues to operate despite arbitrary message loss or failure of part of the system.
以上是CAP的概念。 场景与动作如下: 1) 注册中心的作用是作为一个“公共电话薄”作用,每个“worker”可以把“电话薄”在本地留存一份副本; 2) 每个“woker”上线(up)或下线(down)的动作,最好同步感知,以免因节点路由引发错误,导致更上一层做处理。 3) 多个注册中心中其一下线,不应当影响“worker”的执行,并且worker中保存了副本数据。
基于以上动作,要保证业务间(处于上层)通讯被正确路由;C 很重要,用于保存实时数据。 基于以上动作,注册中心异常不应影响业务,P 很重要。 并且,worker注册下线的异常应由服务启动或关闭时自行重试选择节点。A 不是很重要。
所以,注册中心应实现为 CP ;推荐使用 ETCD