增加第一个简版的轮询负载均衡
This commit is contained in:
19
balance/define/base.go
Normal file
19
balance/define/base.go
Normal file
@ -0,0 +1,19 @@
|
||||
// Package define...
|
||||
//
|
||||
// Description : define...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2021-10-19 12:43 下午
|
||||
package define
|
||||
|
||||
const (
|
||||
// ServerNodeStatusNormal 服务节点状态正常
|
||||
ServerNodeStatusNormal = 0
|
||||
// ServerNodeStatusLoss 探活逻辑无法和服务建立连接
|
||||
ServerNodeStatusLoss = 1
|
||||
// ServerNodeStatusException 指定时间区间内出现过多 5xx
|
||||
ServerNodeStatusException = 2
|
||||
// ServerNodeStatusRemove 通过调用函数的方法,将节点移除
|
||||
ServerNodeStatusRemove = 3
|
||||
)
|
20
balance/define/node.go
Normal file
20
balance/define/node.go
Normal file
@ -0,0 +1,20 @@
|
||||
// Package define...
|
||||
//
|
||||
// Description : define...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2021-10-19 12:36 下午
|
||||
package define
|
||||
|
||||
// ServerNode 服务器节点的定义
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 12:36 下午 2021/10/19
|
||||
type ServerNode struct {
|
||||
HostIP string `json:"host_ip"` // 机器IP
|
||||
Port int `json:"port"` // 机器端口
|
||||
Status int `json:"status"` // 机器状态
|
||||
Weight int `json:"weight"` // 机器权重
|
||||
}
|
Reference in New Issue
Block a user