From 1707e5a60d1864005a8b80a0048737f31ab6de26 Mon Sep 17 00:00:00 2001 From: zhang_xubo <2578876417@qq.com> Date: Sun, 13 Sep 2020 16:48:12 +0800 Subject: [PATCH] =?UTF-8?q?I1UY6C=20=E4=B8=80=E4=B8=BB=E4=B8=80=E5=A4=87?= =?UTF-8?q?=E4=B8=8B=E6=89=A9=E5=AE=B9=E5=AE=8C=E6=88=90=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E5=A4=87=E6=9C=BA=E7=BC=BA=E5=B0=91replconninfo=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../om/script/impl/expansion/ExpansionImpl.py | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/manager/om/script/impl/expansion/ExpansionImpl.py b/src/manager/om/script/impl/expansion/ExpansionImpl.py index 7806ae473..939da41a0 100644 --- a/src/manager/om/script/impl/expansion/ExpansionImpl.py +++ b/src/manager/om/script/impl/expansion/ExpansionImpl.py @@ -355,6 +355,7 @@ class ExpansionImpl(): self.queryPrimaryClusterDetail() self.setPrimaryGUCConfig() self.setStandbyGUCConfig() + self.restartSingleDbWithPrimaryMode() self.buildStandbyHosts() self.generateClusterStaticFile() @@ -378,10 +379,27 @@ class ExpansionImpl(): """ self.logger.debug("Start to set primary node GUC config.\n") primaryHost = self.getPrimaryHostName() - dataNode = self.context.clusterInfoDict[primaryHost]["dataNode"] self.setGUCOnClusterHosts([primaryHost]) self.addStandbyIpInPrimaryConf() + + + def setStandbyGUCConfig(self): + """ + set the expansion standby node db guc config + """ + self.logger.debug("Stat to set standby node GUC config.\n") + nodeList = self.context.nodeNameList + primaryHost = self.getPrimaryHostName() + standbyHostNames = list(set(nodeList).difference(set([primaryHost]))) + self.setGUCOnClusterHosts(standbyHostNames) + + def restartSingleDbWithPrimaryMode(self): + """ + """ + primaryHost = self.getPrimaryHostName() + dataNode = self.context.clusterInfoDict[primaryHost]["dataNode"] + insType, dbStat = self.commonGsCtl.queryInstanceStatus(primaryHost, dataNode,self.envFile) if insType != MODE_PRIMARY: @@ -401,17 +419,6 @@ retry for %s times" % start_retry_num) self.commonGsCtl.startInstanceWithMode(primaryHost, dataNode, MODE_PRIMARY, self.envFile) start_retry_num = start_retry_num + 1 - - def setStandbyGUCConfig(self): - """ - """ - self.logger.debug("Start to set standby node GUC config.\n") - standbyHosts = self.context.newHostList - standbyHostNames = [] - for host in standbyHosts: - hostName = self.context.backIpNameMap[host] - standbyHostNames.append(hostName) - self.setGUCOnClusterHosts(standbyHostNames) def addStandbyIpInPrimaryConf(self): """ @@ -463,7 +470,7 @@ retry for %s times" % start_retry_num) stop the new standby host`s database and build it as standby mode """ self.logger.debug("start to build standby node...\n") - + standbyHosts = self.context.newHostList for host in standbyHosts: @@ -484,9 +491,6 @@ retry for %s times" % start_retry_num) if insType != MODE_STANDBY: self.logger.debug("Start database as Standby mode failed, \ retry for %s times" % start_retry_num) - self.setGUCOnClusterHosts([]) - self.addStandbyIpInPrimaryConf() - self.reloadPrimaryConf() self.commonGsCtl.startInstanceWithMode(hostName, dataNode, MODE_STANDBY, self.envFile) start_retry_num = start_retry_num + 1 @@ -586,7 +590,7 @@ retry for %s times" % start_retry_num) if dbStat != STAT_NORMAL: self.commonGsCtl.startInstanceWithMode(hostName, dataNode, MODE_STANDBY, self.envFile) - + self.commonGsCtl.startOmCluster(primaryHosts, self.envFile) def setGUCOnClusterHosts(self, hostNames=[]):