1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Merge pull request #872 from mariadb-corporation/kill-distributed

MCOL-3515 Remove distributed install
This commit is contained in:
benthompson15
2019-09-25 12:07:44 -05:00
committed by GitHub
8 changed files with 18 additions and 990 deletions

View File

@ -472,7 +472,6 @@
<CoreFileFlag>n</CoreFileFlag>
<MySQLPort>3306</MySQLPort>
<AmazonDeviceName>/dev/xvd</AmazonDeviceName>
<DistributedInstall>n</DistributedInstall>
<LockFileDirectory>/var/lock/subsys</LockFileDirectory>
<ProfileFile>unassigned</ProfileFile>
</Installation>

View File

@ -464,7 +464,6 @@
<JavaHome>unassigned</JavaHome>
<JavaPath>unassigned</JavaPath>
<MySQLPort>3306</MySQLPort>
<DistributedInstall>y</DistributedInstall>
<LockFileDirectory>/var/lock/subsys</LockFileDirectory>
</Installation>
<ExtentMap>

View File

@ -5670,7 +5670,6 @@ int processCommand(string* arguments)
int DataRedundancyNetworkType;
int DataRedundancyStorageType;
string AmazonVPCNextPrivateIP;
string DistributedInstall = "n";
try
{
@ -5680,7 +5679,6 @@ int processCommand(string* arguments)
oam.getSystemConfig("DataRedundancyCopies", DataRedundancyCopies);
oam.getSystemConfig("DataRedundancyNetworkType", DataRedundancyNetworkType);
oam.getSystemConfig("DataRedundancyStorageType", DataRedundancyStorageType);
oam.getSystemConfig("DistributedInstall", DistributedInstall);
}
catch (...) {}
@ -5722,9 +5720,6 @@ int processCommand(string* arguments)
if (arguments[3] != "" && (arguments[3][0] == 'y' || arguments[3][0] == 'Y'))
storeHostnames = true;
//check for a non-distrubuted install setup, dont need password
if ( DistributedInstall != "y" )
{
if (arguments[5] != "")
password = arguments[5];
else
@ -5733,7 +5728,6 @@ int processCommand(string* arguments)
string prompt = "Enter the 'User' Password or 'ssh' if configured with ssh-keys";
password = dataPrompt(prompt);
}
}
if (arguments[6] != "")
dbrootPerPM = atoi(arguments[6].c_str());
@ -5757,9 +5751,6 @@ int processCommand(string* arguments)
if (arguments[2] != "" && (arguments[2][0] == 'y' || arguments[2][0] == 'Y'))
storeHostnames = true;
//check for a non-distrubuted install setup, dont need password
if ( DistributedInstall != "y" )
{
if (arguments[4] != "")
password = arguments[4];
else
@ -5768,7 +5759,6 @@ int processCommand(string* arguments)
string prompt = "Enter the 'User' Password or 'ssh' if configured with ssh-keys";
password = dataPrompt(prompt);
}
}
if (arguments[5] != "")
dbrootPerPM = atoi(arguments[5].c_str());
@ -9239,24 +9229,6 @@ void printSystemStatus()
if ( MySQLRep == "y" )
cout << "MariaDB ColumnStore Replication Feature is enabled" << endl;
//display Distributed Install feature
if ( SingleServerInstall == "n" )
{
string DistributedInstall;
try
{
oam.getSystemConfig("DistributedInstall", DistributedInstall);
if ( DistributedInstall == "y" )
cout << "MariaDB ColumnStore set for Distributed Install" << endl;
else
cout << "MariaDB ColumnStore set for Non-Distributed Install" << endl;
}
catch (...) {}
cout << endl;
}
}
catch (exception& e)
{

View File

@ -175,7 +175,6 @@ string glusterInstalled = "n";
string hadoopInstalled = "n";
string mysqlPort = oam::UnassignedName;
string systemName;
string DistributedInstall = "n";
bool noPrompting = false;
bool rootUser = true;
@ -187,8 +186,6 @@ bool mysqlRep = false;
string MySQLRep = "y";
string PMwithUM = "n";
bool amazonInstall = false;
bool nonDistribute = false;
bool nonDistributeFlag = false;
bool single_server_quick_install = false;
bool multi_server_quick_install = false;
bool amazon_quick_install = false;
@ -330,8 +327,6 @@ int main(int argc, char* argv[])
cout << " -qm Quick Install - Multi Server" << endl;
cout << " -port MariaDB ColumnStore Port Address" << endl;
cout << " -i Non-root Install directory, Only use for non-root installs" << endl;
cout << " -n Non-distributed install, meaning postConfigure will not install packages on remote nodes" << endl;
cout << " -d Distributed install, meaning postConfigure will install packages on remote nodes" << endl;
cout << " -sn System Name" << endl;
cout << " -pm-ip-addrs Performance Module IP Addresses xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx" << endl;
cout << " -um-ip-addrs User Module IP Addresses xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx" << endl;
@ -405,16 +400,6 @@ int main(int argc, char* argv[])
else if ( string("-u") == argv[i] )
noPrompting = true;
// for backward compatibility
else if ( string("-n") == argv[i] )
{
nonDistribute = true;
nonDistributeFlag = true;
}
else if( string("-d") == argv[i] )
{
nonDistribute = false;
nonDistributeFlag = true;
}
else if( string("-port") == argv[i] )
{
i++;
@ -813,38 +798,6 @@ int main(int argc, char* argv[])
{}
}
//check for non-Distributed Install
if ( nonDistributeFlag )
{
if ( nonDistribute )
{
try {
oam.setSystemConfig("DistributedInstall", "n");
}
catch(...) {}
}
else
{
try {
oam.setSystemConfig("DistributedInstall", "y");
}
catch(...) {}
}
}
else
{
//get Distributed Install
try
{
DistributedInstall = sysConfig->getConfig(InstallSection, "DistributedInstall");
}
catch (...)
{}
if ( DistributedInstall == "n" )
nonDistribute = true;
}
cout << endl;
if (single_server_quick_install)
@ -1555,9 +1508,6 @@ int main(int argc, char* argv[])
if ( mysqlRep )
cout << endl << "NOTE: MariaDB ColumnStore Replication Feature is enabled" << endl;
if ( nonDistribute )
cout << endl << "NOTE: MariaDB ColumnStore Non-Distributed Install Feature is enabled" << endl;
//Write out Updated System Configuration File
try
{
@ -3701,272 +3651,6 @@ int main(int argc, char* argv[])
pmNumber > 1 )
{
//skip interface with remote servers and perform install
if ( !nonDistribute )
{
//
// perform remote install of other servers in the system
//
cout << endl << "===== System Installation =====" << endl << endl;
cout << "System Configuration is complete." << endl;
cout << "Performing System Installation." << endl;
SystemSoftware systemsoftware;
try
{
oam.getSystemSoftware(systemsoftware);
}
catch (exception& e)
{
cout << " ERROR: reading getSystemSoftware API" << endl;
exit (1);
}
cout << endl;
string version = systemsoftware.Version + "-" + systemsoftware.Release;
string installType = "initial";
if ( EEPackageType == "rpm" )
{
cout << "Performing a MariaDB ColumnStore System install using RPM packages" << endl;
cout << "located in the " + HOME + " directory." << endl;
}
else
{
if ( EEPackageType == "binary" )
{
cout << "Performing a MariaDB ColumnStore System install using a Binary package" << endl;
cout << "located in the " + HOME + " directory." << endl;
}
else
{
cout << "Performing a MariaDB ColumnStore System install using using DEB packages" << endl;
cout << "located in the " + HOME + " directory." << endl;
}
}
//check if pkgs are located in $HOME directory
if ( EEPackageType == "rpm")
columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.rpm";
else if ( EEPackageType == "deb")
columnstorePackage = HOME + "/" + "mariadb-columnstore-*" + systemsoftware.Version + "*.deb";
else
columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.bin.tar.gz";
if ( !pkgCheck(columnstorePackage) )
exit(1);
checkSystemMySQLPort(mysqlPort, sysConfig, USER, password, childmodulelist, IserverTypeInstall, pmwithum);
string AmazonInstall = "0";
if ( amazonInstall )
AmazonInstall = "1";
ChildModuleList::iterator list1 = childmodulelist.begin();
for (; list1 != childmodulelist.end() ; list1++)
{
string remoteModuleName = (*list1).moduleName;
string remoteModuleIP = (*list1).moduleIP;
string remoteHostName = (*list1).hostName;
string remoteModuleType = remoteModuleName.substr(0, MAX_MODULE_TYPE_SIZE);
string debug_logfile;
string logfile;
if ( remote_installer_debug == "1" )
{
logfile = tmpDir + "/";
logfile += remoteModuleName + "_" + EEPackageType + "_install.log";
debug_logfile = " > " + logfile;
}
if ( remoteModuleType == "um" ||
(remoteModuleType == "pm" && IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM) ||
(remoteModuleType == "pm" && pmwithum) )
{
cout << endl << "----- Performing Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl;
if ( remote_installer_debug == "1" )
cout << "Install log file is located here: " + logfile << endl << endl;
if ( EEPackageType != "binary" )
{
string temppwprompt = pwprompt;
if ( pwprompt == " " )
temppwprompt = "none";
//run remote installer script
cmd = installDir + "/bin/package_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + AmazonInstall + " " + EEPackageType + " " + nodeps + " " + remote_installer_debug + " " + debug_logfile;
if ( thread_remote_installer )
{
thr_data[thread_id].command = cmd;
int status = pthread_create (&thr[thread_id], NULL, (void* (*)(void*)) &remoteInstallThread, &thr_data[thread_id]);
if ( status != 0 )
{
cout << "remoteInstallThread failed for " << remoteModuleName << ", exiting" << endl;
exit (1);
}
thread_id++;
}
else
{
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0)
{
cout << endl << "Error returned from package_installer.sh" << endl;
exit(1);
}
}
}
else
{
// do a binary package install
string binservertype = serverTypeInstall;
if ( pmwithum )
binservertype = "pmwithum";
cmd = installDir + "/bin/binary_installer.sh " + remoteModuleName + " " +
remoteModuleIP + " " + password + " " + columnstorePackage + " " + installType + " " + AmazonInstall + " " + remote_installer_debug +
" " + installDir + " " + debug_logfile;
if ( thread_remote_installer )
{
thr_data[thread_id].command = cmd;
int status = pthread_create (&thr[thread_id], NULL, (void* (*)(void*)) &remoteInstallThread, &thr_data[thread_id]);
if ( status != 0 )
{
cout << "remoteInstallThread failed for " << remoteModuleName << ", exiting" << endl;
exit (1);
}
thread_id++;
}
else
{
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0)
{
cout << endl << "Error returned from package_installer.sh" << endl;
exit(1);
}
}
}
}
else
{
if ( (remoteModuleType == "pm" && IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM) ||
(remoteModuleType == "pm" && !pmwithum ) )
{
cout << endl << "----- Performing Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl;
if ( remote_installer_debug == "1" )
cout << "Install log file is located here: " + logfile << endl << endl;
if ( EEPackageType != "binary" )
{
//run remote installer script
cmd = installDir + "/bin/package_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + AmazonInstall + " " + EEPackageType + " " + nodeps + " " + remote_installer_debug + " " + debug_logfile;
if ( thread_remote_installer )
{
thr_data[thread_id].command = cmd;
int status = pthread_create (&thr[thread_id], NULL, (void* (*)(void*)) &remoteInstallThread, &thr_data[thread_id]);
if ( status != 0 )
{
cout << "remoteInstallThread failed for " << remoteModuleName << ", exiting" << endl;
exit (1);
}
thread_id++;
}
else
{
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0)
{
cout << endl << "Error returned from package_installer.sh" << endl;
exit(1);
}
}
}
else
{
// do a binary package install
string binservertype = serverTypeInstall;
if ( pmwithum )
binservertype = "pmwithum";
cmd = installDir + "/bin/binary_installer.sh " + remoteModuleName + " " + remoteModuleIP +
" " + password + " " + columnstorePackage + " " + installType + " " + AmazonInstall + " " +
remote_installer_debug + " " + installDir + " " +
debug_logfile;
if ( thread_remote_installer )
{
thr_data[thread_id].command = cmd;
int status = pthread_create (&thr[thread_id], NULL, (void* (*)(void*)) &remoteInstallThread, &thr_data[thread_id]);
if ( status != 0 )
{
cout << "remoteInstallThread failed for " << remoteModuleName << ", exiting" << endl;
exit (1);
}
thread_id++;
}
else
{
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0)
{
cout << endl << "Error returned from package_installer.sh" << endl;
exit(1);
}
}
}
}
}
}
if ( thread_remote_installer )
{
//wait until remove install Thread Count is at zero or hit timeout
cout << endl << "MariaDB ColumnStore Package being installed, please wait ...";
cout.flush();
/* block until all threads complete */
for (thread_id = 0; thread_id < (int) childmodulelist.size(); ++thread_id)
{
pthread_join(thr[thread_id], NULL);
}
cout << " DONE" << endl;
}
}
//configure data redundancy
if (DataRedundancy)
{
@ -4070,7 +3754,6 @@ int main(int argc, char* argv[])
else
cout << "The MariaDB ColumnStore system logging is setup and working on local server" << endl;
if ( nonDistribute )
cout << endl << "MariaDB ColumnStore System Configuration and Installation is Completed" << endl;
//
@ -4088,21 +3771,6 @@ int main(int argc, char* argv[])
cout << "System Configuration is complete." << endl;
cout << "Performing System Installation." << endl;
if (hdfs && !nonDistribute )
{
string postConfigurePsdhLog = tmpDir + "/postConfigure.pdsh.log";
cout << endl << "----- Starting MariaDB ColumnStore Service on all Modules -----" << endl << endl;
string cmd = "pdsh -a '" + installDir + "/bin/columnstore restart' > " + postConfigurePsdhLog + " 2>&1";
system(cmd.c_str());
if (oam.checkLogStatus(postConfigurePsdhLog, "exit") )
{
cout << endl << "ERROR: Starting MariaDB ColumnStore Service failue, check " + postConfigurePsdhLog + ". exit..." << endl;
exit (1);
}
}
else
{
//start MariaDB ColumnStore on local server
cout << endl << "----- Starting MariaDB ColumnStore on local server -----" << endl << endl;

View File

@ -747,18 +747,6 @@ static void startMgrProcessThread()
log.writeLog(__LINE__, "EXCEPTION ERROR on getSystemConfig: Caught unknown exception!", LOG_TYPE_ERROR);
}
//get Distributed Install
string DistributedInstall = "n";
try
{
oam.getSystemConfig("DistributedInstall", DistributedInstall);
}
catch (...)
{
log.writeLog(__LINE__, "ERROR: get DistributedInstall", LOG_TYPE_ERROR);
}
//Send out a start service just to make sure Columnstore is runing on remote nodes
//note this only works for systems with ssh-keys
/* for( unsigned int i = 0 ; i < systemmoduletypeconfig.moduletypeconfig.size(); i++)

View File

@ -4889,18 +4889,6 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
pthread_mutex_lock(&THREAD_LOCK);
//get Distributed Install
string DistributedInstall = "n";
try
{
oam.getSystemConfig("DistributedInstall", DistributedInstall);
}
catch (...)
{
log.writeLog(__LINE__, "addModule - ERROR: get DistributedInstall", LOG_TYPE_ERROR);
}
int AddModuleCount = devicenetworklist.size();
DeviceNetworkList::iterator listPT = devicenetworklist.begin();
string moduleType = (*listPT).DeviceName.substr(0, MAX_MODULE_TYPE_SIZE);
@ -5020,51 +5008,6 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
else
calpontPackage = homedir + "/mariadb-columnstore*" + columnstore_version + "-" + columnstore_release + "*.bin.tar.gz";
if ( DistributedInstall == "y" )
{
//check if pkgs are located in /root directory
string cmd = "ls " + calpontPackage + " > /dev/null 2>&1";
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0)
{
log.writeLog(__LINE__, "addModule - ERROR: Package not found: " + calpontPackage, LOG_TYPE_ERROR);
pthread_mutex_unlock(&THREAD_LOCK);
return API_FILE_OPEN_ERROR;
}
log.writeLog(__LINE__, "addModule - ColumnStore Package found:" + calpontPackage, LOG_TYPE_DEBUG);
//
// Verify Host IP and Password
//
listPT = devicenetworklist.begin();
for ( ; listPT != devicenetworklist.end() ; listPT++)
{
HostConfigList::iterator pt1 = (*listPT).hostConfigList.begin();
string newHostName = (*pt1).HostName;
if ( newHostName == oam::UnassignedName )
continue;
string newIPAddr = (*pt1).IPAddr;
string cmd = installDir + "/bin/remote_command.sh " + newIPAddr + " " + password + " ls";
log.writeLog(__LINE__, cmd, LOG_TYPE_DEBUG);
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0)
{
log.writeLog(__LINE__, "addModule - ERROR: Remote login test failed, Invalid IP / Password " + newIPAddr, LOG_TYPE_ERROR);
pthread_mutex_unlock(&THREAD_LOCK);
return API_FAILURE;
}
log.writeLog(__LINE__, "addModule - Remote login test successful: " + newIPAddr, LOG_TYPE_DEBUG);
}
}
//
//Get System Configuration file
//
@ -5518,462 +5461,6 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
string cmd = "rm -f " + homedir + "/.ssh/known_hosts > /dev/null 2>&1";
system(cmd.c_str());
if ( DistributedInstall == "y" )
{
//PMwithUM config
string PMwithUM = "n";
try
{
oam.getSystemConfig( "PMwithUM", PMwithUM);
}
catch (...)
{
PMwithUM = "n";
}
string version = systemsoftware.Version + "-" + systemsoftware.Release;
string AmazonInstall = "0";
if ( amazon )
AmazonInstall = "1";
//setup and push custom OS files
listPT = devicenetworklist.begin();
for ( ; listPT != devicenetworklist.end() ; listPT++)
{
string remoteModuleName = (*listPT).DeviceName;
string remoteModuleType = remoteModuleName.substr(0, MAX_MODULE_TYPE_SIZE);
HostConfigList::iterator pt1 = (*listPT).hostConfigList.begin();
string remoteModuleIP = (*pt1).IPAddr;
string remoteHostName = (*pt1).HostName;
//create and copy custom OS
//run remote installer script
string dir = installDir + "/local/etc/" + remoteModuleName;
string cmd = "mkdir " + dir + " > /dev/null 2>&1";
system(cmd.c_str());
if ( remoteModuleType == "um" )
{
cmd = "cp " + installDir + "/local/etc/um1/* " + dir + "/.";
system(cmd.c_str());
}
else
{
if ( remoteModuleType == "pm")
{
cmd = "cp " + installDir + "/local/etc/pm1/* " + dir + "/.";
system(cmd.c_str());
}
}
log.writeLog(__LINE__, "addModule - created directory and custom OS files for " + remoteModuleName, LOG_TYPE_DEBUG);
//create module file
if ( !createModuleFile(remoteModuleName) )
{
log.writeLog(__LINE__, "addModule - ERROR: createModuleFile failed", LOG_TYPE_ERROR);
pthread_mutex_unlock(&THREAD_LOCK);
return API_FAILURE;
}
log.writeLog(__LINE__, "addModule - create module file for " + remoteModuleName, LOG_TYPE_DEBUG);
if ( remoteModuleType == "pm" )
{
//setup Standby OAM Parent, if needed
if ( config.OAMStandbyName() == oam::UnassignedName )
setStandbyModule(remoteModuleName, false);
}
//default
string binaryInstallDir = installDir;
//run installer on remote module
if ( remoteModuleType == "um" ||
( remoteModuleType == "pm" && config.ServerInstallType() == oam::INSTALL_COMBINE_DM_UM_PM ) ||
( remoteModuleType == "pm" && PMwithUM == "y" ) )
{
//run remote installer script
if ( packageType != "binary" )
{
string logFile = tmpLogDir + "/" + remoteModuleName + "_user_installer.log";
log.writeLog(__LINE__, "addModule - user_installer run for " + remoteModuleName, LOG_TYPE_DEBUG);
string cmd = installDir + "/bin/package_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + AmazonInstall + " " + packageType + " --nodeps 1 > " + logFile;
log.writeLog(__LINE__, "addModule cmd: " + cmd, LOG_TYPE_DEBUG);
bool passed = false;
for ( int retry = 0 ; retry < 5 ; retry++ )
{
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0)
{
// if log file size is zero, retry
ifstream in(logFile.c_str());
in.seekg(0, std::ios::end);
int size = in.tellg();
if ( size == 0 )
{
log.writeLog(__LINE__, "addModule - ERROR: " + logFile + " failed, retry", LOG_TYPE_DEBUG);
sleep(5);
continue;
}
else
break;
}
else
{
passed = true;
break;
}
}
if ( !passed )
{
log.writeLog(__LINE__, "addModule - ERROR: " + logFile + " failed", LOG_TYPE_ERROR);
DeviceNetworkList devicenetworklistR;
DeviceNetworkConfig devicenetworkconfigR;
HostConfig hostconfig;
devicenetworkconfigR.DeviceName = remoteModuleName;
if (cloud == "amazon-vpc")
hostconfig.IPAddr = remoteModuleIP;
else
hostconfig.IPAddr = oam::UnassignedName;
hostconfig.HostName = oam::UnassignedName;
hostconfig.NicID = 1;
devicenetworkconfigR.hostConfigList.push_back(hostconfig);
devicenetworklistR.push_back(devicenetworkconfigR);
processManager.removeModule(devicenetworklistR, false);
log.writeLog(__LINE__, "addModule - Remove Module Completed", LOG_TYPE_DEBUG);
pthread_mutex_unlock(&THREAD_LOCK);
cmd = "/bin/cp -f " + logFile + " " + logFile + "failed";
system(cmd.c_str());
processManager.setModuleState(remoteModuleName, oam::FAILED);
return API_FAILURE;
}
}
else
{
// do a binary package install
string logFile = tmpLogDir + "/" + remoteModuleName + "_binary_installer.log";
log.writeLog(__LINE__, "addModule - binary_installer run for " + remoteModuleName, LOG_TYPE_DEBUG);
string binservertype = oam.itoa(config.ServerInstallType());
if ( PMwithUM == "y" )
binservertype = "pmwithum";
string cmd = installDir + "/bin/binary_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + calpontPackage + " initial " + AmazonInstall + " 1 " + binaryInstallDir + " > " + logFile;
log.writeLog(__LINE__, "addModule - " + cmd, LOG_TYPE_DEBUG);
bool passed = false;
for ( int retry = 0 ; retry < 5 ; retry++ )
{
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0)
{
// if log file size is zero, retry
ifstream in(logFile.c_str());
in.seekg(0, std::ios::end);
int size = in.tellg();
if ( size == 0 )
{
log.writeLog(__LINE__, "addModule - ERROR: " + logFile + " failed, retry", LOG_TYPE_DEBUG);
sleep(5);
continue;
}
else
break;
}
else
{
passed = true;
break;
}
}
if ( !passed )
{
log.writeLog(__LINE__, "addModule - ERROR: " + logFile + " failed, retry", LOG_TYPE_DEBUG);
DeviceNetworkList devicenetworklistR;
DeviceNetworkConfig devicenetworkconfigR;
HostConfig hostconfig;
devicenetworkconfigR.DeviceName = remoteModuleName;
if (cloud == "amazon-vpc")
hostconfig.IPAddr = remoteModuleIP;
else
hostconfig.IPAddr = oam::UnassignedName;
hostconfig.HostName = oam::UnassignedName;
hostconfig.NicID = 1;
devicenetworkconfigR.hostConfigList.push_back(hostconfig);
devicenetworklistR.push_back(devicenetworkconfigR);
processManager.removeModule(devicenetworklistR, false);
log.writeLog(__LINE__, "addModule - Remove Module Completed", LOG_TYPE_DEBUG);
pthread_mutex_unlock(&THREAD_LOCK);
cmd = "/bin/cp -f " + logFile + " " + logFile + "failed";
system(cmd.c_str());
processManager.setModuleState(remoteModuleName, oam::FAILED);
return API_FAILURE;
}
}
}
else
{
if ( remoteModuleType == "pm" )
{
if ( packageType != "binary" )
{
string logFile = tmpLogDir + "/" + remoteModuleName + "_package_installer.log";
log.writeLog(__LINE__, "addModule - package_installer run for " + remoteModuleName, LOG_TYPE_DEBUG);
string cmd = installDir + "/bin/package_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + AmazonInstall + " " + packageType + + " --nodeps 1 > " + logFile;
log.writeLog(__LINE__, "addModule cmd: " + cmd, LOG_TYPE_DEBUG);
bool passed = false;
for ( int retry = 0 ; retry < 5 ; retry++ )
{
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0)
{
// if log file size is zero, retry
ifstream in(logFile.c_str());
in.seekg(0, std::ios::end);
int size = in.tellg();
if ( size == 0 )
{
log.writeLog(__LINE__, "addModule - ERROR: " + logFile + " failed, retry", LOG_TYPE_DEBUG);
sleep(5);
continue;
}
else
break;
}
else
{
passed = true;
break;
}
}
if ( !passed )
{
log.writeLog(__LINE__, "addModule - ERROR: " + logFile + " failed, retry", LOG_TYPE_DEBUG);
DeviceNetworkList devicenetworklistR;
DeviceNetworkConfig devicenetworkconfigR;
HostConfig hostconfig;
devicenetworkconfigR.DeviceName = remoteModuleName;
if (cloud == "amazon-vpc")
hostconfig.IPAddr = remoteModuleIP;
else
hostconfig.IPAddr = oam::UnassignedName;
hostconfig.HostName = oam::UnassignedName;
hostconfig.NicID = 1;
devicenetworkconfigR.hostConfigList.push_back(hostconfig);
devicenetworklistR.push_back(devicenetworkconfigR);
processManager.removeModule(devicenetworklistR, false);
log.writeLog(__LINE__, "addModule - Remove Module Completed", LOG_TYPE_DEBUG);
pthread_mutex_unlock(&THREAD_LOCK);
cmd = "/bin/cp -f " + logFile + " " + logFile + "failed";
system(cmd.c_str());
processManager.setModuleState(remoteModuleName, oam::FAILED);
return API_FAILURE;
}
}
else
{
// do a binary package install
string logFile = tmpLogDir + "/" + remoteModuleName + "_binary_installer.log";
log.writeLog(__LINE__, "addModule - binary_installer run for " + remoteModuleName, LOG_TYPE_DEBUG);
string binservertype = oam.itoa(config.ServerInstallType());
if ( PMwithUM == "y" )
binservertype = "pmwithum";
string cmd = installDir + "/bin/binary_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + calpontPackage + " initial " + AmazonInstall + " 1 " + binaryInstallDir + " > " + logFile;
log.writeLog(__LINE__, "addModule - " + cmd, LOG_TYPE_DEBUG);
bool passed = false;
for ( int retry = 0 ; retry < 5 ; retry++ )
{
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0)
{
// if log file size is zero, retry
ifstream in(logFile.c_str());
in.seekg(0, std::ios::end);
int size = in.tellg();
if ( size == 0 )
{
log.writeLog(__LINE__, "addModule - ERROR: " + logFile + " failed, retry", LOG_TYPE_DEBUG);
sleep(5);
continue;
}
else
break;
}
else
{
passed = true;
break;
}
}
if ( !passed )
{
log.writeLog(__LINE__, "addModule - ERROR: " + logFile + " failed, retry", LOG_TYPE_DEBUG);
DeviceNetworkList devicenetworklistR;
DeviceNetworkConfig devicenetworkconfigR;
HostConfig hostconfig;
devicenetworkconfigR.DeviceName = remoteModuleName;
if (cloud == "amazon-vpc")
hostconfig.IPAddr = remoteModuleIP;
else
hostconfig.IPAddr = oam::UnassignedName;
hostconfig.HostName = oam::UnassignedName;
hostconfig.NicID = 1;
devicenetworkconfigR.hostConfigList.push_back(hostconfig);
devicenetworklistR.push_back(devicenetworkconfigR);
processManager.removeModule(devicenetworklistR, false);
log.writeLog(__LINE__, "addModule - Remove Module Completed", LOG_TYPE_DEBUG);
pthread_mutex_unlock(&THREAD_LOCK);
cmd = "/bin/cp -f " + logFile + " " + logFile + "failed";
system(cmd.c_str());
processManager.setModuleState(remoteModuleName, oam::FAILED);
return API_FAILURE;
}
}
}
}
}
//distribute config file
distributeConfigFile("system");
distributeConfigFile("system", "ProcessConfig.xml");
//Start new modules by starting up local Process-Monitor
listPT = devicenetworklist.begin();
for ( ; listPT != devicenetworklist.end() ; listPT++)
{
string remoteModuleName = (*listPT).DeviceName;
if (manualFlag)
//set new module to disable state if manual add
disableModule(remoteModuleName, true);
HostConfigList::iterator pt1 = (*listPT).hostConfigList.begin();
string remoteModuleIP = (*pt1).IPAddr;
string remoteHostName = (*pt1).HostName;
// add to monitor list
moduleInfoList.insert(moduleList::value_type(remoteModuleName, 0));
if (amazon)
{
//check and assign Elastic IP Address
int AmazonElasticIPCount = 0;
try
{
oam.getSystemConfig("AmazonElasticIPCount", AmazonElasticIPCount);
}
catch (...)
{
AmazonElasticIPCount = 0;
}
for ( int id = 1 ; id < AmazonElasticIPCount + 1 ; id++ )
{
string AmazonElasticModule = "AmazonElasticModule" + oam.itoa(id);
string ELmoduleName;
try
{
oam.getSystemConfig(AmazonElasticModule, ELmoduleName);
}
catch (...) {}
if ( ELmoduleName == remoteModuleName )
{
//match found assign Elastic IP Address
string AmazonElasticIPAddr = "AmazonElasticIPAddr" + oam.itoa(id);
string ELIPaddress;
try
{
oam.getSystemConfig(AmazonElasticIPAddr, ELIPaddress);
}
catch (...) {}
try
{
oam.assignElasticIP(remoteHostName, ELIPaddress);
log.writeLog(__LINE__, "addModule - Set Elastic IP Address: " + remoteModuleName + "/" + ELIPaddress, LOG_TYPE_DEBUG);
}
catch (...)
{
log.writeLog(__LINE__, "addModule - Failed to Set Elastic IP Address: " + remoteModuleName + "/" + ELIPaddress, LOG_TYPE_ERROR);
}
break;
}
}
}
}
listPT = devicenetworklist.begin();
for ( ; listPT != devicenetworklist.end() ; listPT++)
@ -5982,18 +5469,6 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
processManager.configureModule(moduleName);
}
}
else
{
listPT = devicenetworklist.begin();
for ( ; listPT != devicenetworklist.end() ; listPT++)
{
string moduleName = (*listPT).DeviceName;
processManager.configureModule(moduleName);
}
}
//delay to give time for ProcMon to start after the config is sent and procmon restarts
log.writeLog(__LINE__, "addModule - sleep 60 - give ProcMon time to CONFIGURE and restart", LOG_TYPE_DEBUG);

View File

@ -1026,59 +1026,6 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
log.writeLog(__LINE__, "STOPALL: ACK back to ProcMgr, return status = " + oam.itoa((int) requestStatus));
//Remove MariaDB ColumnStore PGK on REMOVE option if distubuted install
string DistributedInstall = "n";
try
{
oam.getSystemConfig("DistributedInstall", DistributedInstall);
}
catch (...)
{
log.writeLog(__LINE__, "addModule - ERROR: get DistributedInstall", LOG_TYPE_ERROR);
}
if ( actIndicator == oam::REMOVE && ( DistributedInstall == "y" ))
{
log.writeLog(__LINE__, "STOPALL: uninstall MariaDB ColumnStore PGKs", LOG_TYPE_DEBUG);
if ( config.moduleType() == "um" )
{
system("rpm -e --nodeps $(rpm -qa | grep '^mariadb-columnstore')");
system("dpkg -P $(dpkg --get-selections | grep '^mariadb-columnstore')");
}
else // pm
{
//Flush the cache
cacheutils::flushPrimProcCache();
cacheutils::dropPrimProcFdCache();
flushInodeCache();
try
{
string DBRootStorageType = "internal";
oam.getSystemConfig("DBRootStorageType", DBRootStorageType);
if ( DBRootStorageType == "external" )
{
string cmd = SUDO + "umount " + startup::StartUp::installDir() + "/data* -l > /dev/null 2>&1";
system(cmd.c_str());
sleep(1);
}
}
catch (...) {}
system("rpm -e --nodeps $(rpm -qa | grep '^mariadb-columnstore')");
system("dpkg -P $(dpkg --get-selections | grep '^mariadb-columnstore')");
}
// should get here is packages get removed correctly
string cmd = startup::StartUp::installDir() + "/bin/columnstore stop > /dev/null 2>&1";
system(cmd.c_str());
exit (0);
}
break;
}

View File

@ -2149,26 +2149,6 @@ int main(int argc, char* argv[])
catch (...)
{}
try
{
string DistributedInstall = sysConfigOld->getConfig("Installation", "DistributedInstall");
if ( !DistributedInstall.empty() )
{
try
{
sysConfigNew->setConfig("Installation", "DistributedInstall", DistributedInstall);
}
catch (...)
{
cout << "ERROR: Problem setting DistributedInstall in the Calpont System Configuration file" << endl;
exit(-1);
}
}
}
catch (...)
{}
// add entries from tuning guide