Distribute cipher file when upgrade and expand.

This commit is contained in:
TotaJ
2021-06-02 10:57:04 +08:00
parent 433fc776d0
commit 104b1601ef
3 changed files with 53 additions and 1 deletions

View File

@ -456,6 +456,7 @@ class ExpansionImpl():
self.setGucConfig()
self.addTrust()
self.generateGRPCCert()
self.distributeCipherFile()
self.buildStandbyHosts()
self.generateClusterStaticFile()
@ -597,6 +598,34 @@ gs_guc set -D {dn} -c "available_zone='{azName}'"
self.context.createGrpcCa(needGRPCHosts)
self.logger.debug("End to generate GRPC cert.")
def distributeCipherFile(self):
"""
distribute cipher file to new host
"""
hostList = []
for host in self.expansionSuccess:
if self.expansionSuccess[host]:
hostList.append(host)
if (len(hostList) == 0):
return
self.logger.debug("Start to distribute cipher file.")
cipherFileList = ["datasource.key.cipher",
"datasource.key.rand",
"usermapping.key.cipher",
"usermapping.key.rand"]
sshTool = SshTool(hostList)
appPath = self.context.clusterInfoDict["appPath"]
filePath = os.path.join(appPath, "bin")
for cipherFile in cipherFileList:
scpFile = os.path.join(filePath, "%s" % cipherFile)
self.logger.debug("try to send file: %s" % scpFile)
if os.path.exists(scpFile):
sshTool.scpFiles(scpFile, filePath, hostList)
self.logger.debug("End to distribute cipher file.")
def reloadPrimaryConf(self, user=""):
"""
"""