From ffccdeffd49fa2d016d4dc7557a9a9813dbdb927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Mon, 22 Nov 2021 16:52:08 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B4=9F=E8=BD=BD?= =?UTF-8?q?=E7=AE=97=E6=B3=95=E7=9A=84=E6=8E=A5=E5=8F=A3=E7=BA=A6=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- balance/abstract.go | 30 ++++++++++++++++++++++++++++++ balance/poll.go | 3 ++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 balance/abstract.go diff --git a/balance/abstract.go b/balance/abstract.go new file mode 100644 index 0000000..1275f69 --- /dev/null +++ b/balance/abstract.go @@ -0,0 +1,30 @@ +// Package balance... +// +// Description : balance... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 2021-11-22 4:45 下午 +package balance + +import ( + "net/http" + + "git.zhangdeman.cn/zhangdeman/gopkg/balance/define" +) + +// IBalance 负载算法接口约束 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 4:45 下午 2021/11/22 +type IBalance interface { + // GetServerNode 获取一个服务器节点 + GetServerNode(req *http.Request) (*define.ServerNode, error) + // AddServerNode 新增一个服务器节点 + AddServerNode(hostIP string, port int) error + // Remove 移除一个节点 + Remove(hostIP string, port int, force bool) + // GetServerNodeList 获取服务节点列表 + GetServerNodeList() []*define.ServerNode +} diff --git a/balance/poll.go b/balance/poll.go index c89eac8..62337d7 100644 --- a/balance/poll.go +++ b/balance/poll.go @@ -8,6 +8,7 @@ package balance import ( + "net/http" "sync" "git.zhangdeman.cn/zhangdeman/gopkg/balance/define" @@ -48,7 +49,7 @@ type Poll struct { // Author : go_developer@163.com<白茶清欢> // // Date : 12:43 下午 2021/10/19 -func (p *Poll) GetServerNode() (*define.ServerNode, error) { +func (p *Poll) GetServerNode(req *http.Request) (*define.ServerNode, error) { if len(p.serverList) == 0 { return nil, errors.New("server list is empty") } From 275e52a1085f4141b23064131d46ff5d7487668a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Mon, 22 Nov 2021 17:21:05 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=A4=8D=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- balance/base.go | 64 ++++++++++++++++++++++++++++++++++++++++++++-- balance/poll.go | 67 +++++-------------------------------------------- 2 files changed, 68 insertions(+), 63 deletions(-) diff --git a/balance/base.go b/balance/base.go index b82618a..39cc2d3 100644 --- a/balance/base.go +++ b/balance/base.go @@ -7,7 +7,12 @@ // Date : 2021-10-19 2:26 下午 package balance -import "sync" +import ( + "errors" + "sync" + + "git.zhangdeman.cn/zhangdeman/gopkg/balance/define" +) // base ... // @@ -15,7 +20,8 @@ import "sync" // // Date : 2:26 下午 2021/10/19 type base struct { - lock *sync.RWMutex + lock *sync.RWMutex + severList []*define.ServerNode } // Lock ... @@ -53,3 +59,57 @@ func (b *base) RLock() { func (b *base) RUnlock() { b.lock.RUnlock() } + +// AddServerNode 新添加一个服务器节点 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 10:07 下午 2021/10/20 +func (b *base) AddServerNode(hostIP string, port int) error { + if len(hostIP) == 0 || port <= 0 { + return errors.New("host ip or port is invalid") + } + b.Lock() + defer b.Unlock() + for _, item := range b.severList { + if item.HostIP == hostIP && item.Port == port { + return errors.New("host config is already exist") + } + } + b.severList = append(b.severList, &define.ServerNode{ + HostIP: hostIP, + Port: port, + Status: define.ServerNodeStatusNormal, + }) + return nil +} + +// Remove 移除一个节点, force = true , 强制删除, force = false 逻辑删除, 设置状态 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 10:19 下午 2021/10/20 +func (b *base) Remove(hostIP string, port int, force bool) { + b.Lock() + defer b.Unlock() + tmpServerNode := make([]*define.ServerNode, 0) + for _, item := range b.severList { + if item.HostIP == hostIP && item.Port == port { + if force { + continue + } + item.Status = define.ServerNodeStatusRemove + } + tmpServerNode = append(tmpServerNode, item) + } + b.severList = tmpServerNode +} + +// GetServerNodeList 获取服务器节点 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 10:33 下午 2021/10/20 +func (b *base) GetServerNodeList() []*define.ServerNode { + return b.severList +} diff --git a/balance/poll.go b/balance/poll.go index 62337d7..17368c3 100644 --- a/balance/poll.go +++ b/balance/poll.go @@ -20,7 +20,7 @@ import ( // Author : go_developer@163.com<白茶清欢> // // Date : 12:40 下午 2021/10/19 -func NewPoll(serverList []*define.ServerNode) (*Poll, error) { +func NewPoll(serverList []*define.ServerNode) (IBalance, error) { if nil == serverList || len(serverList) == 0 { return nil, errors.New("server list is empty") } @@ -28,7 +28,6 @@ func NewPoll(serverList []*define.ServerNode) (*Poll, error) { base: base{ lock: &sync.RWMutex{}, }, - serverList: serverList, currentServerIndex: 0, }, nil } @@ -40,7 +39,6 @@ func NewPoll(serverList []*define.ServerNode) (*Poll, error) { // Date : 12:41 下午 2021/10/19 type Poll struct { base - serverList []*define.ServerNode currentServerIndex int } @@ -50,7 +48,8 @@ type Poll struct { // // Date : 12:43 下午 2021/10/19 func (p *Poll) GetServerNode(req *http.Request) (*define.ServerNode, error) { - if len(p.serverList) == 0 { + severList := p.GetServerNodeList() + if len(severList) == 0 { return nil, errors.New("server list is empty") } p.Lock() @@ -60,10 +59,10 @@ func (p *Poll) GetServerNode(req *http.Request) (*define.ServerNode, error) { ) // 循环次数 loopTimes := 0 - for loopTimes < len(p.serverList) { + for loopTimes < len(severList) { loopTimes++ - p.currentServerIndex = (p.currentServerIndex + 1) % len(p.serverList) - if serverNode = p.serverList[p.currentServerIndex]; serverNode.Status != define.ServerNodeStatusNormal { + p.currentServerIndex = (p.currentServerIndex + 1) % len(severList) + if serverNode = severList[p.currentServerIndex]; serverNode.Status != define.ServerNodeStatusNormal { continue } break @@ -75,57 +74,3 @@ func (p *Poll) GetServerNode(req *http.Request) (*define.ServerNode, error) { return serverNode, nil } - -// AddServerNode 新添加一个服务器节点 -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:07 下午 2021/10/20 -func (p *Poll) AddServerNode(hostIP string, port int) error { - if len(hostIP) == 0 || port <= 0 { - return errors.New("host ip or port is invalid") - } - p.Lock() - defer p.Unlock() - for _, item := range p.serverList { - if item.HostIP == hostIP && item.Port == port { - return errors.New("host config is already exist") - } - } - p.serverList = append(p.serverList, &define.ServerNode{ - HostIP: hostIP, - Port: port, - Status: define.ServerNodeStatusNormal, - }) - return nil -} - -// Remove 移除一个节点, force = true , 强制删除, force = false 逻辑删除, 设置状态 -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:19 下午 2021/10/20 -func (p *Poll) Remove(hostIP string, port int, force bool) { - p.Lock() - defer p.Unlock() - tmpServerNode := make([]*define.ServerNode, 0) - for _, item := range p.serverList { - if item.HostIP == hostIP && item.Port == port { - if force { - continue - } - item.Status = define.ServerNodeStatusRemove - } - tmpServerNode = append(tmpServerNode, item) - } - p.serverList = tmpServerNode -} - -// GetServerNodeList 获取服务器节点 -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:33 下午 2021/10/20 -func (p *Poll) GetServerNodeList() []*define.ServerNode { - return p.serverList -} From 376f3dfb23233c47bcd1e0f433a4c5b5fa2aeef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Mon, 22 Nov 2021 17:21:41 +0800 Subject: [PATCH 3/7] update --- balance/poll.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/balance/poll.go b/balance/poll.go index 17368c3..aea081a 100644 --- a/balance/poll.go +++ b/balance/poll.go @@ -26,7 +26,8 @@ func NewPoll(serverList []*define.ServerNode) (IBalance, error) { } return &Poll{ base: base{ - lock: &sync.RWMutex{}, + lock: &sync.RWMutex{}, + severList: serverList, }, currentServerIndex: 0, }, nil From 42282e2001609e7ba150274b6293480ab8856b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Mon, 22 Nov 2021 17:35:57 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E8=BF=9C=E7=AB=AFIP=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- util/ip.go | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/util/ip.go b/util/ip.go index ef534be..9ae7966 100644 --- a/util/ip.go +++ b/util/ip.go @@ -7,7 +7,10 @@ // Date : 2021-03-09 5:56 下午 package util -import "net" +import ( + "net" + "net/http" +) // GetHostIP 获取本机IP地址 // @@ -27,3 +30,24 @@ func GetHostIP() string { } return hostIP } + +// GetRemoteIp 获取远端IP +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 5:35 下午 2021/11/22 +func GetRemoteIp(req *http.Request) string { + + // Try via request + + ip, _, err := net.SplitHostPort(req.RemoteAddr) + + if err != nil { + return "::1" + } + userIP := net.ParseIP(ip) + if userIP == nil { + return "::1" + } + return userIP.String() +} From ad8c3dc47ddb506e53b96bb56d92807e6766fbc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Mon, 22 Nov 2021 17:37:05 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0iphash=E8=B4=9F=E8=BD=BD?= =?UTF-8?q?=E7=AE=97=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- balance/ip_hash.go | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 balance/ip_hash.go diff --git a/balance/ip_hash.go b/balance/ip_hash.go new file mode 100644 index 0000000..8f0284c --- /dev/null +++ b/balance/ip_hash.go @@ -0,0 +1,62 @@ +// Package balance... +// +// Description : balance... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 2021-11-22 4:39 下午 +package balance + +import ( + "net/http" + "sync" + + "git.zhangdeman.cn/zhangdeman/gopkg/util" + + "github.com/pkg/errors" + + "git.zhangdeman.cn/zhangdeman/gopkg/balance/define" +) + +// NewIPHash ip hash 负载均衡 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 4:53 下午 2021/11/22 +func NewIPHash(severList []*define.ServerNode) (IBalance, error) { + if nil == severList || len(severList) == 0 { + return nil, errors.New("sever list is empty") + } + return &IPHash{ + base: base{ + lock: &sync.RWMutex{}, + severList: severList, + }, + serverList: severList, + }, nil +} + +// IPHash ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 4:57 下午 2021/11/22 +type IPHash struct { + base + serverList []*define.ServerNode +} + +// GetServerNode ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 4:53 下午 2021/11/22 +func (ih *IPHash) GetServerNode(req *http.Request) (*define.ServerNode, error) { + clintIPHashID := util.GetHashID(util.GetRemoteIp(req)) + ih.RLock() + defer ih.RUnlock() + if len(ih.serverList) == 0 { + return nil, errors.New("sever list is empty") + } + return ih.serverList[int(clintIPHashID%uint64(len(ih.serverList)))], nil +} From 39e3cdef9181b9eaa0c21acd5ed52afd17b7eb49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Mon, 22 Nov 2021 18:34:37 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=9A=8F=E6=9C=BA?= =?UTF-8?q?=E8=B4=9F=E8=BD=BD=E5=9D=87=E8=A1=A1=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- balance/poll.go | 14 ++++------- balance/random.go | 59 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 9 deletions(-) create mode 100644 balance/random.go diff --git a/balance/poll.go b/balance/poll.go index aea081a..b4b2a51 100644 --- a/balance/poll.go +++ b/balance/poll.go @@ -49,21 +49,17 @@ type Poll struct { // // Date : 12:43 下午 2021/10/19 func (p *Poll) GetServerNode(req *http.Request) (*define.ServerNode, error) { - severList := p.GetServerNodeList() - if len(severList) == 0 { - return nil, errors.New("server list is empty") - } - p.Lock() - defer p.Unlock() + p.RLock() + defer p.RUnlock() var ( serverNode *define.ServerNode ) // 循环次数 loopTimes := 0 - for loopTimes < len(severList) { + for loopTimes < len(p.severList) { loopTimes++ - p.currentServerIndex = (p.currentServerIndex + 1) % len(severList) - if serverNode = severList[p.currentServerIndex]; serverNode.Status != define.ServerNodeStatusNormal { + p.currentServerIndex = (p.currentServerIndex + 1) % len(p.severList) + if serverNode = p.severList[p.currentServerIndex]; serverNode.Status != define.ServerNodeStatusNormal { continue } break diff --git a/balance/random.go b/balance/random.go new file mode 100644 index 0000000..7f75658 --- /dev/null +++ b/balance/random.go @@ -0,0 +1,59 @@ +// Package balance... +// +// Description : balance... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 2021-11-22 6:27 下午 +package balance + +import ( + "errors" + "net/http" + "sync" + + "git.zhangdeman.cn/zhangdeman/gopkg/util" + + "git.zhangdeman.cn/zhangdeman/gopkg/balance/define" +) + +// NewRandom ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 6:29 下午 2021/11/22 +func NewRandom(severList []*define.ServerNode) (IBalance, error) { + if nil == severList || len(severList) == 0 { + return nil, errors.New("sever list is empty") + } + return &Random{ + base{ + lock: &sync.RWMutex{}, + severList: make([]*define.ServerNode, 0), + }, + }, nil +} + +// Random 随机负载均衡 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 6:27 下午 2021/11/22 +type Random struct { + base +} + +// GetServerNode ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 6:31 下午 2021/11/22 +func (r *Random) GetServerNode(req *http.Request) (*define.ServerNode, error) { + r.RLock() + defer r.RUnlock() + if len(r.severList) == 0 { + return nil, errors.New("sever list is empty") + } + randomID := util.GetHashID(util.GenRandomString("", 128)) % uint64(len(r.severList)) + return r.severList[int(randomID)], nil +} From fa426ae90c05dad6b0a99c13bb33120499ee4e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Mon, 22 Nov 2021 19:12:49 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8A=A0=E6=9D=83?= =?UTF-8?q?=E8=B4=9F=E8=BD=BD=E8=BD=AE=E8=AF=A2=E7=9A=84=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- balance/abstract.go | 2 +- balance/base.go | 12 +-- balance/define/node.go | 9 ++- balance/weight_serverRound_robin.go | 114 ++++++++++++++++++++++++++++ 4 files changed, 124 insertions(+), 13 deletions(-) create mode 100644 balance/weight_serverRound_robin.go diff --git a/balance/abstract.go b/balance/abstract.go index 1275f69..c8caebc 100644 --- a/balance/abstract.go +++ b/balance/abstract.go @@ -22,7 +22,7 @@ type IBalance interface { // GetServerNode 获取一个服务器节点 GetServerNode(req *http.Request) (*define.ServerNode, error) // AddServerNode 新增一个服务器节点 - AddServerNode(hostIP string, port int) error + AddServerNode(node *define.ServerNode) error // Remove 移除一个节点 Remove(hostIP string, port int, force bool) // GetServerNodeList 获取服务节点列表 diff --git a/balance/base.go b/balance/base.go index 39cc2d3..a9115d2 100644 --- a/balance/base.go +++ b/balance/base.go @@ -65,22 +65,18 @@ func (b *base) RUnlock() { // Author : go_developer@163.com<白茶清欢> // // Date : 10:07 下午 2021/10/20 -func (b *base) AddServerNode(hostIP string, port int) error { - if len(hostIP) == 0 || port <= 0 { +func (b *base) AddServerNode(node *define.ServerNode) error { + if len(node.HostIP) == 0 || node.Port <= 0 { return errors.New("host ip or port is invalid") } b.Lock() defer b.Unlock() for _, item := range b.severList { - if item.HostIP == hostIP && item.Port == port { + if item.HostIP == node.HostIP && item.Port == node.Port { return errors.New("host config is already exist") } } - b.severList = append(b.severList, &define.ServerNode{ - HostIP: hostIP, - Port: port, - Status: define.ServerNodeStatusNormal, - }) + b.severList = append(b.severList, node) return nil } diff --git a/balance/define/node.go b/balance/define/node.go index 9da4418..d6ff5c9 100644 --- a/balance/define/node.go +++ b/balance/define/node.go @@ -13,8 +13,9 @@ package define // // 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"` // 机器权重 + HostIP string `json:"host_ip"` // 机器IP + Port int `json:"port"` // 机器端口 + Status int `json:"status"` // 机器状态 + Weight float64 `json:"weight"` // 机器权重 + CurrentWeight float64 `json:"current_weight"` // 当前权重 } diff --git a/balance/weight_serverRound_robin.go b/balance/weight_serverRound_robin.go new file mode 100644 index 0000000..0f3aa4b --- /dev/null +++ b/balance/weight_serverRound_robin.go @@ -0,0 +1,114 @@ +// Package balance... +// +// Description : balance... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 2021-11-22 6:58 下午 +package balance + +import ( + "net/http" + "sync" + + "github.com/pkg/errors" + + "git.zhangdeman.cn/zhangdeman/gopkg/balance/define" +) + +// NewWeightServerRoundRobin ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 6:58 下午 2021/11/22 +func NewWeightServerRoundRobin(severList []*define.ServerNode) (IBalance, error) { + if nil == severList || len(severList) == 0 { + return nil, errors.New("sever list is empty") + } + return &WeightServerRoundRobin{ + base: base{ + lock: &sync.RWMutex{}, + severList: severList, + }, + effectiveWeight: 0, + }, nil +} + +// WeightServerRoundRobin 加权轮询 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 6:58 下午 2021/11/22 +type WeightServerRoundRobin struct { + base + effectiveWeight float64 +} + +// GetServerNode ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 7:00 下午 2021/11/22 +func (w *WeightServerRoundRobin) GetServerNode(req *http.Request) (*define.ServerNode, error) { + w.RLock() + defer w.RUnlock() + if len(w.severList) == 0 { + return nil, errors.New("sever list is empty") + } + var expectBackendServer *define.ServerNode + for _, backendServer := range w.severList { + // 给每个后端服务增加自身权重 + backendServer.CurrentWeight += backendServer.Weight + if expectBackendServer == nil { + expectBackendServer = backendServer + } + if backendServer.CurrentWeight > expectBackendServer.CurrentWeight { + expectBackendServer = backendServer + } + } + // 把选择的后端服务权重减掉总权重 + expectBackendServer.CurrentWeight -= w.effectiveWeight + return expectBackendServer, nil +} + +// AddServerNode 新添加一个服务器节点 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 10:07 下午 2021/10/20 +func (w *WeightServerRoundRobin) AddServerNode(node *define.ServerNode) error { + if len(node.HostIP) == 0 || node.Port <= 0 { + return errors.New("host ip or port is invalid") + } + w.Lock() + defer w.Unlock() + for _, item := range w.severList { + if item.HostIP == node.HostIP && item.Port == node.Port { + return errors.New("host config is already exist") + } + } + w.effectiveWeight += node.Weight + w.severList = append(w.severList, node) + return nil +} + +// Remove 移除一个节点, force = true , 强制删除, force = false 逻辑删除, 设置状态 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 10:19 下午 2021/10/20 +func (w *WeightServerRoundRobin) Remove(hostIP string, port int, force bool) { + w.Lock() + defer w.Unlock() + tmpServerNode := make([]*define.ServerNode, 0) + for _, item := range w.severList { + if item.HostIP == hostIP && item.Port == port { + if force { + continue + } + item.Status = define.ServerNodeStatusRemove + } + tmpServerNode = append(tmpServerNode, item) + } + w.severList = tmpServerNode +}