修复集群停止状态下卸载cm无法启动的问题

This commit is contained in:
xue_meng_en 2022-11-13 21:37:38 +08:00
parent 60f18e608a
commit a7ef9ae100
2 changed files with 22 additions and 8 deletions

View File

@ -248,6 +248,10 @@ class InstallImpl:
errorDetail = "\nStatus: %s\nOutput: %s" % (status, output)
self.logger.logExit("Failed to start cluster." + errorDetail)
status, output = InstallImpl.refreshDynamicFile(self.envFile)
if status != 0:
self.logger.error("Failed to refresh dynamic file." + output)
queryCmd = "source %s; cm_ctl query -Cv" % self.envFile
status, output = subprocess.getstatusoutput(queryCmd)
if status != 0:
@ -283,17 +287,11 @@ class InstallImpl:
errorDetail = "\nCommand: %s\nStatus: %s\nOutput: %s" % (refreshDynamicFileCmd, status, output)
return status, errorDetail
def refreshStaticAndDynamicFile(self):
def _refreshStaticFile(self):
self.logger.log("Refreshing static and dynamic file using xml file with cm.")
status, output = InstallImpl.refreshStaticFile(self.envFile, self.xmlFile)
if status != 0:
self.logger.logExit("Failed to refresh static file." + output)
if self.clusterStopped:
self.logger.log("Don't need to refresh dynamic file when the cluster is currently stopped.")
return
status, output = InstallImpl.refreshDynamicFile(self.envFile)
if status != 0:
self.logger.logExit("Failed to refresh dynamic file." + output)
def run(self):
self.logger.log("Start to install cm tool.")
@ -302,6 +300,6 @@ class InstallImpl:
self.createManualStartFile()
self.initCMServer()
self.initCMAgent()
self.refreshStaticAndDynamicFile()
self._refreshStaticFile()
self.setMonitorCrontab()
self.startCluster()

View File

@ -196,6 +196,22 @@ General options:
status, output = InstallImpl.refreshStaticFile(self.envFile, self.xmlFile)
if status != 0:
self.logger.logExit("Failed to refresh static file." + output)
# Remove dynamic file, if the cluster is stopped currently.
removeDynamicCmd = "source %s; rm -f $GAUSSHOME/bin/cluster_dynamic_config" % self.envFile
for host in self.hostnames:
isLocal = False
if host == self.localhostName:
isLocal = True
executeCmdOnHost(host, removeDynamicCmd, isLocal)
clusterStopped = False
checkClusterStoppedCmd = "source %s; ls $GAUSSHOME/bin/cluster_manual_start" % self.envFile
status, output = subprocess.getstatusoutput(checkClusterStoppedCmd)
if status == 0:
clusterStopped = True
self.logger.debug("Command: " + checkClusterStoppedCmd)
self.logger.debug("Status: %s\nOtput: %s" % (status, output))
if clusterStopped:
return
status, output = InstallImpl.refreshDynamicFile(self.envFile)
if status != 0:
self.logger.logExit("Failed to refresh dynamic file." + output)