From d1e021d72751dfbaf98a9e8b502782e68a3daa52 Mon Sep 17 00:00:00 2001 From: Wind <573966@qq.com> Date: Wed, 31 Jul 2024 22:51:00 +0800 Subject: [PATCH] Update agent.go --- cluster/agent.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cluster/agent.go b/cluster/agent.go index b25e32f..89fae22 100644 --- a/cluster/agent.go +++ b/cluster/agent.go @@ -73,12 +73,9 @@ func NewAgent(conf *config.Cluster) *Agent { func (a *Agent) Start() (err error) { // setup raft - if a.Config.DiscoveryWay == config.DiscoveryWayMemberlist { + if a.Config.RaftPort == 0 || a.Config.DiscoveryWay == config.DiscoveryWayMemberlist { a.Config.RaftPort = mlist.GetRaftPortFromBindPort(a.Config.BindPort) } - if a.Config.RaftPort == 0 { - a.Config.RaftPort = 8946 - } if a.Config.RaftDir == "" { a.Config.RaftDir = path.Join("data", a.Config.NodeName) }