Documentation
¶
Overview ¶
启动,如果是 active 模式,且没有存在虚拟节点,则切换为 standby 模式; 启动,如果是 standby 模式,如果没有存在虚拟节点,则切换为 active 模式; 运行中,active 节点开启心跳服务端,每 5s 广播 arp 地址; 运行中,standby 节点,连接虚拟节点访问 active 服务器,如果连接成功,继续检测 运行中,standby 节点,连接虚拟节点,如果连接失败,重试 3 次,则提升自己为 active 节点,执行 active 运行任务;
Index ¶
- func Broadcast(config *FloatingIPConfig, req *Request)
- func ServeMulticastDiscovery(config *FloatingIPConfig, h func(*net.UDPAddr, int, []byte))
- type EchoConfig
- type FloatingIPConfig
- type FloatingIPPlugin
- func (module FloatingIPPlugin) Deactivate(silence bool)
- func (this FloatingIPPlugin) Name() string
- func (module FloatingIPPlugin) Setup()
- func (module FloatingIPPlugin) Start() error
- func (module FloatingIPPlugin) StateMachine()
- func (module FloatingIPPlugin) Stop() error
- func (module FloatingIPPlugin) SwitchToActiveMode()
- func (module FloatingIPPlugin) SwitchToStandbyMode(latency time.Duration)
- type Request
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Broadcast ¶
func Broadcast(config *FloatingIPConfig, req *Request)
send a Broadcast message to network to discovery the cluster
func ServeMulticastDiscovery ¶
func ServeMulticastDiscovery(config *FloatingIPConfig, h func(*net.UDPAddr, int, []byte))
Types ¶
type EchoConfig ¶
type FloatingIPConfig ¶
type FloatingIPConfig struct {
Enabled bool `config:"enabled"`
IP string `config:"ip"`
Netmask string `config:"netmask"`
Interface string `config:"interface"`
LocalIP string `config:"local_ip"` //local ip address
PeerIP string `config:"peer_ip"` //remote ip to failover
Echo EchoConfig `config:"echo"`
Priority int `config:"priority"`
ForcedSwitchByPriority bool `config:"forced_by_priority"`
BroadcastConfig config.NetworkConfig `config:"broadcast"`
}
type FloatingIPPlugin ¶
type FloatingIPPlugin struct {
}
func (FloatingIPPlugin) Deactivate ¶
func (module FloatingIPPlugin) Deactivate(silence bool)
func (FloatingIPPlugin) Name ¶
func (this FloatingIPPlugin) Name() string
func (FloatingIPPlugin) Setup ¶
func (module FloatingIPPlugin) Setup()
func (FloatingIPPlugin) Start ¶
func (module FloatingIPPlugin) Start() error
func (FloatingIPPlugin) StateMachine ¶
func (module FloatingIPPlugin) StateMachine()
func (FloatingIPPlugin) Stop ¶
func (module FloatingIPPlugin) Stop() error
func (FloatingIPPlugin) SwitchToActiveMode ¶
func (module FloatingIPPlugin) SwitchToActiveMode()
func (FloatingIPPlugin) SwitchToStandbyMode ¶
func (module FloatingIPPlugin) SwitchToStandbyMode(latency time.Duration)
Click to show internal directories.
Click to hide internal directories.