1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-05 16:15:50 +03:00
This commit is contained in:
david hill
2017-06-19 15:32:48 -05:00
parent 95008d1c13
commit 0599b7c3e9
4 changed files with 590 additions and 653 deletions

View File

@@ -226,7 +226,7 @@
<SystemConfig> <SystemConfig>
<SystemLang>C</SystemLang> <SystemLang>C</SystemLang>
<SystemName>columnstore-1</SystemName> <SystemName>columnstore-1</SystemName>
<ParentOAMModuleName>pm1</ParentOAMModuleName> <ParentOAMModuleName>unassigned</ParentOAMModuleName>
<StandbyOAMModuleName>unassigned</StandbyOAMModuleName> <StandbyOAMModuleName>unassigned</StandbyOAMModuleName>
<PrimaryUMModuleName>unassigned</PrimaryUMModuleName> <PrimaryUMModuleName>unassigned</PrimaryUMModuleName>
<ModuleHeartbeatPeriod>1</ModuleHeartbeatPeriod> <ModuleHeartbeatPeriod>1</ModuleHeartbeatPeriod>

View File

@@ -2737,7 +2737,7 @@ int main(int argc, char *argv[])
// determine package type // determine package type
string EEPackageType; string EEPackageType;
if (!rootUser || nonDistribute) if (!rootUser)
EEPackageType = "binary"; EEPackageType = "binary";
else else
{ {
@@ -2798,7 +2798,10 @@ int main(int argc, char *argv[])
if ( install == "y" ) { if ( install == "y" ) {
SystemSoftware systemsoftware; //skip interface with remote servers and perform install
if ( !nonDistribute )
{
SystemSoftware systemsoftware;
try try
{ {
@@ -2815,46 +2818,38 @@ int main(int argc, char *argv[])
string version = systemsoftware.Version + "-" + systemsoftware.Release; string version = systemsoftware.Version + "-" + systemsoftware.Release;
string installType = "initial"; string installType = "initial";
if ( !nonDistribute )
if ( EEPackageType == "rpm" )
{ {
if ( EEPackageType == "rpm" ) cout << "Performing an MariaDB ColumnStore System install using RPM packages" << endl;
{ cout << "located in the " + HOME + " directory." << endl << endl;
cout << "Performing an MariaDB ColumnStore System install using RPM packages" << endl;
cout << "located in the " + HOME + " directory." << endl << endl;
}
else
{
if ( EEPackageType == "binary" )
{
cout << "Performing an MariaDB ColumnStore System install using a Binary package" << endl;
cout << "located in the " + HOME + " directory." << endl << endl;
}
else
{
cout << "Performing an 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.tar.gz";
else
if ( EEPackageType == "deb")
columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.deb.tar.gz";
else
columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.bin.tar.gz";
if( !pkgCheck(columnstorePackage) )
exit(1);
} }
else else
{ {
EEPackageType = "binary"; if ( EEPackageType == "binary" )
installType = "nonDistribute"; {
columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.bin.tar.gz"; cout << "Performing an MariaDB ColumnStore System install using a Binary package" << endl;
cout << "located in the " + HOME + " directory." << endl << endl;
}
else
{
cout << "Performing an 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.tar.gz";
else
if ( EEPackageType == "deb")
columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.deb.tar.gz";
else
columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.bin.tar.gz";
if( !pkgCheck(columnstorePackage) )
exit(1);
if ( password.empty() ) if ( password.empty() )
{ {
@@ -2935,10 +2930,7 @@ int main(int argc, char *argv[])
string logfile; string logfile;
if ( remote_installer_debug == "1" ) { if ( remote_installer_debug == "1" ) {
logfile = "/tmp/"; logfile = "/tmp/";
if ( nonDistribute ) logfile += remoteModuleName + "_" + EEPackageType + "_install.log";
logfile += remoteModuleName + "_nondistributed_install.log";
else
logfile += remoteModuleName + "_" + EEPackageType + "_install.log";
debug_logfile = " > " + logfile; debug_logfile = " > " + logfile;
} }
@@ -2946,277 +2938,219 @@ int main(int argc, char *argv[])
(remoteModuleType == "pm" && IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM) || (remoteModuleType == "pm" && IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM) ||
(remoteModuleType == "pm" && pmwithum) ) (remoteModuleType == "pm" && pmwithum) )
{ {
if ( nonDistribute ) cout << endl << "----- Performing Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl;
{
cout << endl << "----- Performing Non-Distrubuted Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl;
//check of post-install file exist, which shows package is installed if ( remote_installer_debug == "1" )
string cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " 'ls " + installDir + "/bin/post-install' > /tmp/install_check.log"; cout << "Install log file is located here: " + logfile << endl << endl;
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) { if ( EEPackageType != "binary" ) {
cout << "Error: MariaDB ColumnStore not installed on " + remoteModuleName + " / " + remoteHostName << endl; string temppwprompt = pwprompt;
cout << "Install and re-run postConfigure. Exiting..." << endl << endl; if ( pwprompt == " " )
exit(1); temppwprompt = "none";
}
//check version that is installed //run remote installer script
cmd = installDir + "/bin/remote_scp_get.sh " + remoteModuleIP + " " + password + " " + installDir + "/releasenum > /dev/null 2>&1"; cmd = installDir + "/bin/user_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + EEPackageType + " " + nodeps + " " + temppwprompt + " " + mysqlPort + " " + remote_installer_debug + " " + debug_logfile;
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) { if ( thread_remote_installer ) {
cout << "Error: MariaDB ColumnStore not installed on " + remoteModuleName + " / " + remoteHostName << endl; thr_data[thread_id].command = cmd;
cout << "Install and re-run postConfigure. Exiting..." << endl << endl;
exit(1); int status = pthread_create (&thr[thread_id], NULL, (void*(*)(void*)) &remoteInstallThread, &thr_data[thread_id]);
}
cmd = "diff " + installDir + "/releasenum releasenum > /dev/null 2>&1"; if ( status != 0 )
rtnCode = system(cmd.c_str()); {
if (WEXITSTATUS(rtnCode) != 0) { cout << "remoteInstallThread failed for " << remoteModuleName << ", exiting" << endl;
cout << "Error: Local version of MariaDB ColumnStore doesn't match installed version on " + remoteModuleName + " / " + remoteHostName << endl; exit (1);
cout << "Install matching version and re-run postConfigure. Exiting..." << endl << endl; }
exit(1); thread_id++;
} }
else
{
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "Error returned from user_installer.sh" << endl;
exit(1);
}
//check for mysql password on remote UM
if ( pwprompt == " " ) {
//start mysqld
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/mysql/mysql-Columnstore start'";
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "Error returned from mysql-Columnstore start" << endl;
exit(1);
}
//try to login
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/mysql/bin/mysql --defaults-file=" + installDir + "/mysql/my.cnf -u root " + pwprompt + " -e status' 1 > /tmp/idbmysql.log 2>&1";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "Error returned from remote_command.sh" << endl;
exit(1);
}
if (oam.checkLogStatus("/tmp/idbmysql.log", "ERROR .my.cnf") ) {
// password needed check and get password from remote UM
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "bin/getMySQLpw > /tmp/mysqlpw.log 2>&1";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "MariaDB ColumnStore login failure, MySQL Root password is set." << endl;
cout << "Need MariaDB ColumnStore password configuration file " + HOME + "/.my.cnf on " << remoteModuleName << endl;
exit(1);
}
//get password from local tmp file
mysqlpw = getmysqlpw("/tmp/mysqlpw.log");
if ( mysqlpw != oam::UnassignedName )
{
mysqlpw = "'" + mysqlpw + "'";
pwprompt = "--password=" + mysqlpw;
}
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/mysql/bin/mysql --defaults-file=" + installDir + "/mysql/my.cnf -u root " + pwprompt + " -e status' 1 > /tmp/idbmysql.log 2>&1";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "MariaDB ColumnStore login failure, password mismatch in " + HOME + ".my.cnf on " << remoteModuleName << endl;
exit(1);
}
}
else
{
if (!oam.checkLogStatus("/tmp/idbmysql.log", "Columnstore") ) {
cout << endl << "ERROR: MariaDB ColumnStore runtime error, exit..." << endl << endl;
system("cat /tmp/idbmysql.log");
exit (1);
}
else
{
cout << endl << "Additional MariaDB ColumnStore Installation steps Successfully Completed on '" + remoteModuleName + "'" << endl << endl;
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/mysql/mysql-Columnstore stop'";
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "Error returned from mysql-Columnstore stop" << endl;
exit(1);
}
unlink("/tmp/idbmysql.log");
break;
}
}
//re-run post-mysql-install with password
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/bin/post-mysql-install " + pwprompt + "' < /tmp/post-mysql-install.log";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "Error returned from post-mysql-install, check /tmp/post-mysql-install.log" << endl;
exit(1);
}
else
cout << endl << "post-mysql-install Successfully Completed" << endl;
}
}
} }
else else
cout << endl << "----- Performing Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl; { // do a binary package install
string binservertype = serverTypeInstall;
if ( pmwithum )
binservertype = "pmwithum";
if ( remote_installer_debug == "1" ) cmd = installDir + "/bin/binary_installer.sh " + remoteModuleName + " " +
cout << "Install log file is located here: " + logfile << endl << endl; remoteModuleIP + " " + password + " " + columnstorePackage + " " + remoteModuleType +
" " + installType + " " + binservertype + " " + mysqlPort + " " + remote_installer_debug +
" " + installDir + " " + debug_logfile;
if ( thread_remote_installer ) {
thr_data[thread_id].command = cmd;
if ( EEPackageType != "binary" ) { int status = pthread_create (&thr[thread_id], NULL, (void*(*)(void*)) &remoteInstallThread, &thr_data[thread_id]);
string temppwprompt = pwprompt;
if ( pwprompt == " " ) if ( status != 0 )
temppwprompt = "none"; {
cout << "remoteInstallThread failed for " << remoteModuleName << ", exiting" << endl;
//run remote installer script exit (1);
cmd = installDir + "/bin/user_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + EEPackageType + " " + nodeps + " " + temppwprompt + " " + mysqlPort + " " + remote_installer_debug + " " + debug_logfile; }
if ( thread_remote_installer ) { thread_id++;
thr_data[thread_id].command = cmd; }
else
int status = pthread_create (&thr[thread_id], NULL, (void*(*)(void*)) &remoteInstallThread, &thr_data[thread_id]); {
int rtnCode = system(cmd.c_str());
if ( status != 0 ) if (WEXITSTATUS(rtnCode) != 0) {
{ cout << endl << "Error returned from user_installer.sh" << endl;
cout << "remoteInstallThread failed for " << remoteModuleName << ", exiting" << endl; exit(1);
exit (1); }
} }
thread_id++; }
}
else
{
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "Error returned from user_installer.sh" << endl;
exit(1);
}
//check for mysql password on remote UM
if ( pwprompt == " " ) {
//start mysqld
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/mysql/mysql-Columnstore start'";
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "Error returned from mysql-Columnstore start" << endl;
exit(1);
}
//try to login
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/mysql/bin/mysql --defaults-file=" + installDir + "/mysql/my.cnf -u root " + pwprompt + " -e status' 1 > /tmp/idbmysql.log 2>&1";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "Error returned from remote_command.sh" << endl;
exit(1);
}
if (oam.checkLogStatus("/tmp/idbmysql.log", "ERROR .my.cnf") ) {
// password needed check and get password from remote UM
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "bin/getMySQLpw > /tmp/mysqlpw.log 2>&1";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "MariaDB ColumnStore login failure, MySQL Root password is set." << endl;
cout << "Need MariaDB ColumnStore password configuration file " + HOME + "/.my.cnf on " << remoteModuleName << endl;
exit(1);
}
//get password from local tmp file
mysqlpw = getmysqlpw("/tmp/mysqlpw.log");
if ( mysqlpw != oam::UnassignedName )
{
mysqlpw = "'" + mysqlpw + "'";
pwprompt = "--password=" + mysqlpw;
}
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/mysql/bin/mysql --defaults-file=" + installDir + "/mysql/my.cnf -u root " + pwprompt + " -e status' 1 > /tmp/idbmysql.log 2>&1";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "MariaDB ColumnStore login failure, password mismatch in " + HOME + ".my.cnf on " << remoteModuleName << endl;
exit(1);
}
}
else
{
if (!oam.checkLogStatus("/tmp/idbmysql.log", "Columnstore") ) {
cout << endl << "ERROR: MariaDB ColumnStore runtime error, exit..." << endl << endl;
system("cat /tmp/idbmysql.log");
exit (1);
}
else
{
cout << endl << "Additional MariaDB ColumnStore Installation steps Successfully Completed on '" + remoteModuleName + "'" << endl << endl;
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/mysql/mysql-Columnstore stop'";
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "Error returned from mysql-Columnstore stop" << endl;
exit(1);
}
unlink("/tmp/idbmysql.log");
break;
}
}
//re-run post-mysql-install with password
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/bin/post-mysql-install " + pwprompt + "' < /tmp/post-mysql-install.log";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "Error returned from post-mysql-install, check /tmp/post-mysql-install.log" << endl;
exit(1);
}
else
cout << endl << "post-mysql-install Successfully Completed" << endl;
}
}
}
else
{ // do a binary package install
string binservertype = serverTypeInstall;
if ( pmwithum )
binservertype = "pmwithum";
cmd = installDir + "/bin/binary_installer.sh " + remoteModuleName + " " +
remoteModuleIP + " " + password + " " + columnstorePackage + " " + remoteModuleType +
" " + installType + " " + binservertype + " " + mysqlPort + " " + 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 user_installer.sh" << endl;
exit(1);
}
}
}
} }
else else
{ {
if ( (remoteModuleType == "pm" && IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM) || if ( (remoteModuleType == "pm" && IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM) ||
(remoteModuleType == "pm" && !pmwithum ) ) (remoteModuleType == "pm" && !pmwithum ) )
{ {
if ( nonDistribute ) cout << endl << "----- Performing Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl;
{
cout << endl << "----- Performing Non-Distrubuted Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl;
//check of releasenum file exist, which shows package is installed if ( remote_installer_debug == "1" )
string cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " 'ls " + installDir + "/bin/post-install' > /tmp/install_check.log"; cout << "Install log file is located here: " + logfile << endl << endl;
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) { if ( EEPackageType != "binary" ) {
cout << endl << "Error: MariaDB ColumnStore not installed on " + remoteModuleName + " / " + remoteHostName << endl; //run remote installer script
cout << "Install and re-run postConfigure. Exiting..." << endl << endl; cmd = installDir + "/bin/performance_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + EEPackageType + " " + nodeps + " " + remote_installer_debug + " " + debug_logfile;
exit(1);
} if ( thread_remote_installer ) {
//check version that is installed thr_data[thread_id].command = cmd;
cmd = installDir + "/bin/remote_scp_get.sh " + remoteModuleIP + " " + password + " " + installDir + "/releasenum > /dev/null 2>&1";
rtnCode = system(cmd.c_str()); int status = pthread_create (&thr[thread_id], NULL, (void*(*)(void*)) &remoteInstallThread, &thr_data[thread_id]);
if (WEXITSTATUS(rtnCode) != 0) {
cout << "Error: MariaDB ColumnStore not installed on " + remoteModuleName + " / " + remoteHostName << endl; if ( status != 0 )
cout << "Install and re-run postConfigure. Exiting..." << endl << endl; {
exit(1); cout << "remoteInstallThread failed for " << remoteModuleName << ", exiting" << endl;
} exit (1);
cmd = "diff " + installDir + "/releasenum releasenum > /dev/null 2>&1"; }
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) { thread_id++;
cout << "Error: Local version of MariaDB ColumnStore doesn't match installed version on " + remoteModuleName + " / " + remoteHostName << endl; }
cout << "Install matching version and re-run postConfigure. Exiting..." << endl << endl; else
exit(1); {
} int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "Error returned from performance_installer.sh" << endl;
exit(1);
}
}
} }
else else
cout << endl << "----- Performing Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl; { // do a binary package install
string binservertype = serverTypeInstall;
if ( pmwithum )
binservertype = "pmwithum";
cmd = installDir + "/bin/binary_installer.sh " + remoteModuleName + " " + remoteModuleIP +
" " + password + " " + columnstorePackage + " " + remoteModuleType + " " + installType + " " +
binservertype + " " + mysqlPort + " " + remote_installer_debug + " " + installDir + " " +
debug_logfile;
if ( remote_installer_debug == "1" ) if ( thread_remote_installer ) {
cout << "Install log file is located here: " + logfile << endl << endl; thr_data[thread_id].command = cmd;
if ( EEPackageType != "binary" ) { int status = pthread_create (&thr[thread_id], NULL, (void*(*)(void*)) &remoteInstallThread, &thr_data[thread_id]);
//run remote installer script
cmd = installDir + "/bin/performance_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + EEPackageType + " " + nodeps + " " + remote_installer_debug + " " + debug_logfile; if ( status != 0 )
{
if ( thread_remote_installer ) { cout << "remoteInstallThread failed for " << remoteModuleName << ", exiting" << endl;
thr_data[thread_id].command = cmd; exit (1);
}
int status = pthread_create (&thr[thread_id], NULL, (void*(*)(void*)) &remoteInstallThread, &thr_data[thread_id]);
thread_id++;
if ( status != 0 ) }
{ else
cout << "remoteInstallThread failed for " << remoteModuleName << ", exiting" << endl; {
exit (1); int rtnCode = system(cmd.c_str());
} if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "Error returned from user_installer.sh" << endl;
thread_id++; exit(1);
} }
else }
{ }
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "Error returned from performance_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 + " " + remoteModuleType + " " + installType + " " +
binservertype + " " + mysqlPort + " " + 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 user_installer.sh" << endl;
exit(1);
}
}
}
} }
} }
} }
@@ -3234,6 +3168,7 @@ int main(int argc, char *argv[])
cout << " DONE" << endl; cout << " DONE" << endl;
} }
}
} }
} }
@@ -3301,7 +3236,8 @@ int main(int argc, char *argv[])
else else
cout << "The MariaDB ColumnStore system logging is setup and working on local server" << endl; cout << "The MariaDB ColumnStore system logging is setup and working on local server" << endl;
cout << endl << "MariaDB ColumnStore System Configuration and Installation is Completed" << endl; if ( nonDistribute )
cout << endl << "MariaDB ColumnStore System Configuration and Installation is Completed" << endl;
// //
// startup MariaDB ColumnStore // startup MariaDB ColumnStore
@@ -3336,7 +3272,7 @@ int main(int argc, char *argv[])
if ( start == "y" ) { if ( start == "y" ) {
if (hdfs) if (hdfs && !nonDistribute )
{ {
cout << endl << "----- Starting MariaDB ColumnStore Service on all Modules -----" << endl << endl; cout << endl << "----- Starting MariaDB ColumnStore Service on all Modules -----" << endl << endl;
string cmd = "pdsh -a '" + installDir + "/bin/columnstore restart' > /tmp/postConfigure.pdsh 2>&1"; string cmd = "pdsh -a '" + installDir + "/bin/columnstore restart' > /tmp/postConfigure.pdsh 2>&1";
@@ -3348,6 +3284,8 @@ int main(int argc, char *argv[])
} }
else else
{ {
if ( !nonDistribute )
{
if ( password.empty() ) { if ( password.empty() ) {
while(true) while(true)
{ {
@@ -3415,19 +3353,20 @@ int main(int argc, char *argv[])
else else
cout << "MariaDB ColumnStore successfully started" << endl; cout << "MariaDB ColumnStore successfully started" << endl;
} }
}
//start MariaDB ColumnStore on local server
cout << endl << "----- Starting MariaDB ColumnStore on local server -----" << endl << endl; //start MariaDB ColumnStore on local server
cmd = installDir + "/bin/columnstore restart > /dev/null 2>&1"; cout << endl << "----- Starting MariaDB ColumnStore on local server -----" << endl << endl;
int rtnCode = system(cmd.c_str()); cmd = installDir + "/bin/columnstore restart > /dev/null 2>&1";
if (WEXITSTATUS(rtnCode) != 0) { int rtnCode = system(cmd.c_str());
cout << "Error Starting MariaDB ColumnStore local module" << endl; if (WEXITSTATUS(rtnCode) != 0) {
cout << "Installation Failed, exiting" << endl; cout << "Error Starting MariaDB ColumnStore local module" << endl;
exit (1); cout << "Installation Failed, exiting" << endl;
} exit (1);
else }
cout << "MariaDB ColumnStore successfully started" << endl; else
} cout << "MariaDB ColumnStore successfully started" << endl;
}
} }
else else
{ {

View File

@@ -4983,371 +4983,374 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
} }
} }
//PMwithUM config if ( DistributedInstall == "y" ) {
string PMwithUM = "n";
try {
oam.getSystemConfig( "PMwithUM", PMwithUM);
}
catch(...) {
PMwithUM = "n";
}
//check mysql port changes //PMwithUM config
string MySQLPort; string PMwithUM = "n";
try { try {
oam.getSystemConfig( "MySQLPort", MySQLPort); oam.getSystemConfig( "PMwithUM", PMwithUM);
} }
catch(...) catch(...) {
{} PMwithUM = "n";
}
if ( MySQLPort.empty() || MySQLPort == "" || MySQLPort == oam::UnassignedName ) //check mysql port changes
MySQLPort = "3306"; string MySQLPort;
try {
oam.getSystemConfig( "MySQLPort", MySQLPort);
}
catch(...)
{}
string version = systemsoftware.Version + "-" + systemsoftware.Release; if ( MySQLPort.empty() || MySQLPort == "" || MySQLPort == oam::UnassignedName )
MySQLPort = "3306";
//setup and push custom OS files string version = systemsoftware.Version + "-" + systemsoftware.Release;
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 //setup and push custom OS files
//run remote installer script listPT = devicenetworklist.begin();
string dir = installDir + "/local/etc/" + remoteModuleName; 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;
string cmd = "mkdir " + dir + " > /dev/null 2>&1"; //create and copy custom OS
system(cmd.c_str()); //run remote installer script
string dir = installDir + "/local/etc/" + remoteModuleName;
if ( remoteModuleType == "um" ) { string cmd = "mkdir " + dir + " > /dev/null 2>&1";
cmd = "cp " + installDir + "/local/etc/um1/* " + dir + "/."; system(cmd.c_str());
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 ( remoteModuleType == "um" ) {
if( !createModuleFile(remoteModuleName) ) { cmd = "cp " + installDir + "/local/etc/um1/* " + dir + "/.";
log.writeLog(__LINE__, "addModule - ERROR: createModuleFile failed", LOG_TYPE_ERROR); system(cmd.c_str());
pthread_mutex_unlock(&THREAD_LOCK); }
return API_FAILURE; else
} {
log.writeLog(__LINE__, "addModule - create module file for " + remoteModuleName, LOG_TYPE_DEBUG); 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);
if ( remoteModuleType == "pm" ) { //create module file
//setup Standby OAM Parent, if needed if( !createModuleFile(remoteModuleName) ) {
if ( config.OAMStandbyName() == oam::UnassignedName ) log.writeLog(__LINE__, "addModule - ERROR: createModuleFile failed", LOG_TYPE_ERROR);
setStandbyModule(remoteModuleName, false); pthread_mutex_unlock(&THREAD_LOCK);
} return API_FAILURE;
}
log.writeLog(__LINE__, "addModule - create module file for " + remoteModuleName, LOG_TYPE_DEBUG);
//set root password if ( remoteModuleType == "pm" ) {
if (amazon) { //setup Standby OAM Parent, if needed
cmd = startup::StartUp::installDir() + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '/root/.scripts/updatePassword.sh " + password + "' > /tmp/password_change.log"; if ( config.OAMStandbyName() == oam::UnassignedName )
log.writeLog(__LINE__, "addModule - cmd: " + cmd, LOG_TYPE_DEBUG); setStandbyModule(remoteModuleName, false);
}
//set root password
if (amazon) {
cmd = startup::StartUp::installDir() + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '/root/.scripts/updatePassword.sh " + password + "' > /tmp/password_change.log";
log.writeLog(__LINE__, "addModule - cmd: " + cmd, LOG_TYPE_DEBUG);
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) == 0)
log.writeLog(__LINE__, "addModule - update root password: " + remoteModuleName, LOG_TYPE_DEBUG);
else
log.writeLog(__LINE__, "addModule - ERROR: update root password: " + remoteModuleName, LOG_TYPE_DEBUG);
}
//default
string binaryInstallDir = installDir;
string installType = "initial";
if ( DistributedInstall == "n" ) {
installType = "nonDistribute";
//check of post-install file exist, which shows package is installed
string cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " 'ls " + installDir + "/bin/post-install' > /tmp/install_check.log";
int rtnCode = system(cmd.c_str()); int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) == 0) if (WEXITSTATUS(rtnCode) != 0) {
log.writeLog(__LINE__, "addModule - update root password: " + remoteModuleName, LOG_TYPE_DEBUG); log.writeLog(__LINE__, "addModule - ERROR: MariaDB ColumnStore not installed on " + remoteModuleName + " / " + remoteHostName , LOG_TYPE_ERROR);
else pthread_mutex_unlock(&THREAD_LOCK);
log.writeLog(__LINE__, "addModule - ERROR: update root password: " + remoteModuleName, LOG_TYPE_DEBUG); return API_FAILURE;
} }
//check version that is installed
cmd = installDir + "/bin/remote_scp_get.sh " + remoteModuleIP + " " + password + " " + installDir + "/releasenum > /dev/null 2>&1";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
log.writeLog(__LINE__, "addModule - ERROR: MariaDB ColumnStore not installed on " + remoteModuleName + " / " + remoteHostName , LOG_TYPE_ERROR);
pthread_mutex_unlock(&THREAD_LOCK);
return API_FAILURE;
}
cmd = "diff " + installDir + "/releasenum releasenum > /dev/null 2>&1";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
log.writeLog(__LINE__, "addModule - ERROR: Local version of MariaDB ColumnStore doesn't match installed version on " + remoteModuleName + " / " + remoteHostName , LOG_TYPE_ERROR);
pthread_mutex_unlock(&THREAD_LOCK);
return API_FAILURE;
}
//default
string binaryInstallDir = installDir;
string installType = "initial";
if ( DistributedInstall == "n" ) {
installType = "nonDistribute";
//check of post-install file exist, which shows package is installed
string cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " 'ls " + installDir + "/bin/post-install' > /tmp/install_check.log";
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
log.writeLog(__LINE__, "addModule - ERROR: MariaDB ColumnStore not installed on " + remoteModuleName + " / " + remoteHostName , LOG_TYPE_ERROR);
pthread_mutex_unlock(&THREAD_LOCK);
return API_FAILURE;
}
//check version that is installed
cmd = installDir + "/bin/remote_scp_get.sh " + remoteModuleIP + " " + password + " " + installDir + "/releasenum > /dev/null 2>&1";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
log.writeLog(__LINE__, "addModule - ERROR: MariaDB ColumnStore not installed on " + remoteModuleName + " / " + remoteHostName , LOG_TYPE_ERROR);
pthread_mutex_unlock(&THREAD_LOCK);
return API_FAILURE;
}
cmd = "diff " + installDir + "/releasenum releasenum > /dev/null 2>&1";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
log.writeLog(__LINE__, "addModule - ERROR: Local version of MariaDB ColumnStore doesn't match installed version on " + remoteModuleName + " / " + remoteHostName , LOG_TYPE_ERROR);
pthread_mutex_unlock(&THREAD_LOCK);
return API_FAILURE;
} }
} //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" ) {
log.writeLog(__LINE__, "addModule - user_installer run for " + remoteModuleName, LOG_TYPE_DEBUG);
//run installer on remote module string cmd = installDir + "/bin/user_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + packageType + " --nodeps none " + MySQLPort + " 1 > /tmp/user_installer.log";
if ( remoteModuleType == "um" ||
( remoteModuleType == "pm" && config.ServerInstallType() == oam::INSTALL_COMBINE_DM_UM_PM ) ||
( remoteModuleType == "pm" && PMwithUM == "y" ) ) {
//run remote installer script
if ( packageType != "binary" ) {
log.writeLog(__LINE__, "addModule - user_installer run for " + remoteModuleName, LOG_TYPE_DEBUG);
string cmd = installDir + "/bin/user_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + packageType + " --nodeps none " + MySQLPort + " 1 > /tmp/user_installer.log"; log.writeLog(__LINE__, "addModule cmd: " + cmd, LOG_TYPE_DEBUG);
log.writeLog(__LINE__, "addModule cmd: " + cmd, LOG_TYPE_DEBUG); bool passed = false;
for ( int retry = 0 ; retry < 20 ; retry++ )
{
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
// if log file size is zero, retry
ifstream in("/tmp/user_installer.log");
in.seekg(0, std::ios::end);
int size = in.tellg();
if ( size == 0 )
{
log.writeLog(__LINE__, "addModule - ERROR: user_installer.sh failed, retry", LOG_TYPE_DEBUG);
sleep(5);
continue;
}
else
break;
}
else
{
passed = true;
break;
}
}
bool passed = false; if ( !passed )
for ( int retry = 0 ; retry < 20 ; retry++ ) {
{ log.writeLog(__LINE__, "addModule - ERROR: user_installer.sh failed", LOG_TYPE_ERROR);
int rtnCode = system(cmd.c_str()); pthread_mutex_unlock(&THREAD_LOCK);
if (WEXITSTATUS(rtnCode) != 0) { system("/bin/cp -f /tmp/user_installer.log /tmp/user_installer.log.failed");
// if log file size is zero, retry processManager.setModuleState(remoteModuleName, oam::FAILED);
ifstream in("/tmp/user_installer.log"); return API_FAILURE;
in.seekg(0, std::ios::end); }
int size = in.tellg(); }
if ( size == 0 ) else
{ { // do a binary package install
log.writeLog(__LINE__, "addModule - ERROR: user_installer.sh failed, retry", LOG_TYPE_DEBUG); log.writeLog(__LINE__, "addModule - binary_installer run for " + remoteModuleName, LOG_TYPE_DEBUG);
sleep(5);
continue;
}
else
break;
}
else
{
passed = true;
break;
}
}
if ( !passed ) string binservertype = oam.itoa(config.ServerInstallType());
{ if ( PMwithUM == "y" )
log.writeLog(__LINE__, "addModule - ERROR: user_installer.sh failed", LOG_TYPE_ERROR); binservertype = "pmwithum";
pthread_mutex_unlock(&THREAD_LOCK); string cmd = installDir + "/bin/binary_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + calpontPackage + " " + remoteModuleType + " " + installType + " " + binservertype + " " + MySQLPort + " 1 " + binaryInstallDir + " > /tmp/binary_installer.log";
system("/bin/cp -f /tmp/user_installer.log /tmp/user_installer.log.failed");
processManager.setModuleState(remoteModuleName, oam::FAILED);
return API_FAILURE;
}
}
else
{ // do a binary package install
log.writeLog(__LINE__, "addModule - binary_installer run for " + remoteModuleName, LOG_TYPE_DEBUG);
string binservertype = oam.itoa(config.ServerInstallType()); log.writeLog(__LINE__, "addModule - " + cmd, LOG_TYPE_DEBUG);
if ( PMwithUM == "y" )
binservertype = "pmwithum";
string cmd = installDir + "/bin/binary_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + calpontPackage + " " + remoteModuleType + " " + installType + " " + binservertype + " " + MySQLPort + " 1 " + binaryInstallDir + " > /tmp/binary_installer.log";
log.writeLog(__LINE__, "addModule - " + cmd, LOG_TYPE_DEBUG); bool passed = false;
for ( int retry = 0 ; retry < 20 ; retry++ )
{
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
// if log file size is zero, retry
ifstream in("/tmp/binary_installer.log");
in.seekg(0, std::ios::end);
int size = in.tellg();
if ( size == 0 )
{
log.writeLog(__LINE__, "addModule - ERROR: binary_installer.sh failed, retry", LOG_TYPE_DEBUG);
sleep(5);
continue;
}
else
break;
}
else
{
passed = true;
break;
}
}
bool passed = false; if ( !passed )
for ( int retry = 0 ; retry < 20 ; retry++ ) {
{ log.writeLog(__LINE__, "addModule - ERROR: binary_installer.sh failed", LOG_TYPE_ERROR);
int rtnCode = system(cmd.c_str()); pthread_mutex_unlock(&THREAD_LOCK);
if (WEXITSTATUS(rtnCode) != 0) { system("/bin/cp -f /tmp/binary_installer.log /tmp/binary_installer.log.failed");
// if log file size is zero, retry processManager.setModuleState(remoteModuleName, oam::FAILED);
ifstream in("/tmp/binary_installer.log"); return API_FAILURE;
in.seekg(0, std::ios::end); }
int size = in.tellg(); }
if ( size == 0 ) }
{ else
log.writeLog(__LINE__, "addModule - ERROR: binary_installer.sh failed, retry", LOG_TYPE_DEBUG); {
sleep(5); if ( remoteModuleType == "pm" ) {
continue; if ( packageType != "binary" ) {
} log.writeLog(__LINE__, "addModule - performance_installer run for " + remoteModuleName, LOG_TYPE_DEBUG);
else string cmd = installDir + "/bin/performance_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + packageType + + " --nodeps 1 > /tmp/performance_installer.log";
break; log.writeLog(__LINE__, "addModule cmd: " + cmd, LOG_TYPE_DEBUG);
}
else
{
passed = true;
break;
}
}
if ( !passed ) system(cmd.c_str());
{
log.writeLog(__LINE__, "addModule - ERROR: binary_installer.sh failed", LOG_TYPE_ERROR);
pthread_mutex_unlock(&THREAD_LOCK);
system("/bin/cp -f /tmp/binary_installer.log /tmp/binary_installer.log.failed");
processManager.setModuleState(remoteModuleName, oam::FAILED);
return API_FAILURE;
}
}
}
else
{
if ( remoteModuleType == "pm" ) {
if ( packageType != "binary" ) {
log.writeLog(__LINE__, "addModule - performance_installer run for " + remoteModuleName, LOG_TYPE_DEBUG);
string cmd = installDir + "/bin/performance_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + packageType + + " --nodeps 1 > /tmp/performance_installer.log";
log.writeLog(__LINE__, "addModule cmd: " + cmd, LOG_TYPE_DEBUG);
system(cmd.c_str()); bool passed = false;
for ( int retry = 0 ; retry < 20 ; retry++ )
{
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
// if log file size is zero, retry
ifstream in("/tmp/performance_installer.log");
in.seekg(0, std::ios::end);
int size = in.tellg();
if ( size == 0 )
{
log.writeLog(__LINE__, "addModule - ERROR: performance_installer.sh failed, retry", LOG_TYPE_DEBUG);
sleep(5);
continue;
}
else
break;
}
else
{
passed = true;
break;
}
}
if ( !passed )
{
log.writeLog(__LINE__, "addModule - ERROR: performance_installer.sh failed", LOG_TYPE_ERROR);
pthread_mutex_unlock(&THREAD_LOCK);
system("/bin/cp -f /tmp/performance_installer.log /tmp/performance_installer.log.failed");
processManager.setModuleState(remoteModuleName, oam::FAILED);
return API_FAILURE;
}
}
else
{ // do a binary package install
log.writeLog(__LINE__, "addModule - binary_installer run for " + remoteModuleName, LOG_TYPE_DEBUG);
bool passed = false; string binservertype = oam.itoa(config.ServerInstallType());
for ( int retry = 0 ; retry < 20 ; retry++ ) if ( PMwithUM == "y" )
{ binservertype = "pmwithum";
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
// if log file size is zero, retry
ifstream in("/tmp/performance_installer.log");
in.seekg(0, std::ios::end);
int size = in.tellg();
if ( size == 0 )
{
log.writeLog(__LINE__, "addModule - ERROR: performance_installer.sh failed, retry", LOG_TYPE_DEBUG);
sleep(5);
continue;
}
else
break;
}
else
{
passed = true;
break;
}
}
if ( !passed )
{
log.writeLog(__LINE__, "addModule - ERROR: performance_installer.sh failed", LOG_TYPE_ERROR);
pthread_mutex_unlock(&THREAD_LOCK);
system("/bin/cp -f /tmp/performance_installer.log /tmp/performance_installer.log.failed");
processManager.setModuleState(remoteModuleName, oam::FAILED);
return API_FAILURE;
}
}
else
{ // do a binary package install
log.writeLog(__LINE__, "addModule - binary_installer run for " + remoteModuleName, LOG_TYPE_DEBUG);
string binservertype = oam.itoa(config.ServerInstallType()); string cmd = installDir + "/bin/binary_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + calpontPackage + " " + remoteModuleType + " " + installType + " " + binservertype + " " + MySQLPort + " 1 " + binaryInstallDir + " > /tmp/binary_installer.log";
if ( PMwithUM == "y" )
binservertype = "pmwithum";
string cmd = installDir + "/bin/binary_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + calpontPackage + " " + remoteModuleType + " " + installType + " " + binservertype + " " + MySQLPort + " 1 " + binaryInstallDir + " > /tmp/binary_installer.log"; log.writeLog(__LINE__, "addModule - " + cmd, LOG_TYPE_DEBUG);
log.writeLog(__LINE__, "addModule - " + cmd, LOG_TYPE_DEBUG); bool passed = false;
for ( int retry = 0 ; retry < 20 ; retry++ )
{
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
// if log file size is zero, retry
ifstream in("/tmp/binary_installer.log");
in.seekg(0, std::ios::end);
int size = in.tellg();
if ( size == 0 )
{
log.writeLog(__LINE__, "addModule - ERROR: binary_installer.sh failed, retry", LOG_TYPE_DEBUG);
sleep(5);
continue;
}
else
break;
}
else
{
passed = true;
break;
}
}
if ( !passed )
{
log.writeLog(__LINE__, "addModule - ERROR: binary_installer.sh failed", LOG_TYPE_ERROR);
pthread_mutex_unlock(&THREAD_LOCK);
system("/bin/cp -f /tmp/binary_installer.log /tmp/binary_installer.log.failed");
processManager.setModuleState(remoteModuleName, oam::FAILED);
return API_FAILURE;
}
}
}
}
}
bool passed = false; //Start new modules by starting up local Process-Monitor
for ( int retry = 0 ; retry < 20 ; retry++ ) listPT = devicenetworklist.begin();
{ for( ; listPT != devicenetworklist.end() ; listPT++)
int rtnCode = system(cmd.c_str()); {
if (WEXITSTATUS(rtnCode) != 0) { string remoteModuleName = (*listPT).DeviceName;
// if log file size is zero, retry
ifstream in("/tmp/binary_installer.log"); if (manualFlag)
in.seekg(0, std::ios::end); //set new module to disable state if manual add
int size = in.tellg(); disableModule(remoteModuleName, true);
if ( size == 0 )
{ HostConfigList::iterator pt1 = (*listPT).hostConfigList.begin();
log.writeLog(__LINE__, "addModule - ERROR: binary_installer.sh failed, retry", LOG_TYPE_DEBUG); string remoteModuleIP = (*pt1).IPAddr;
sleep(5); string remoteHostName = (*pt1).HostName;
continue;
} //send start service commands
else string cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/bin/columnstore restart;" + installDir + "/mysql/mysqld-Calpont restart' 0";
break; system(cmd.c_str());
} log.writeLog(__LINE__, "addModule - restart columnstore service " + remoteModuleName, LOG_TYPE_DEBUG);
else
{ // add to monitor list
passed = true; moduleInfoList.insert(moduleList::value_type(remoteModuleName, 0));
break; if (amazon) {
} //check and assign Elastic IP Address
} int AmazonElasticIPCount = 0;
try{
if ( !passed ) oam.getSystemConfig("AmazonElasticIPCount", AmazonElasticIPCount);
{ }
log.writeLog(__LINE__, "addModule - ERROR: binary_installer.sh failed", LOG_TYPE_ERROR); catch(...) {
pthread_mutex_unlock(&THREAD_LOCK); AmazonElasticIPCount = 0;
system("/bin/cp -f /tmp/binary_installer.log /tmp/binary_installer.log.failed"); }
processManager.setModuleState(remoteModuleName, oam::FAILED);
return API_FAILURE; 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;
}
}
}
}
//if amazon, delay to give time for ProcMon to start
if (amazon) {
log.writeLog(__LINE__, "addModule - sleep 30 - give ProcMon time to start on new Instance", LOG_TYPE_DEBUG);
sleep(30);
}
} }
//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;
//send start service commands
string cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/bin/columnstore restart;" + installDir + "/mysql/mysqld-Calpont restart' 0";
system(cmd.c_str());
log.writeLog(__LINE__, "addModule - restart columnstore service " + remoteModuleName, LOG_TYPE_DEBUG);
// 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;
}
}
}
}
//if amazon, delay to give time for ProcMon to start
if (amazon) {
log.writeLog(__LINE__, "addModule - sleep 30 - give ProcMon time to start on new Instance", LOG_TYPE_DEBUG);
sleep(30);
}
//distribute config file //distribute config file
distributeConfigFile("system"); distributeConfigFile("system");

View File

@@ -169,13 +169,7 @@ int main(int argc, char **argv)
int moduleStatus = oam::ACTIVE; int moduleStatus = oam::ACTIVE;
//check if currently configured as Parent OAM Module on startup //check if currently configured as Parent OAM Module on startup
string DBRootStorageType;
if ( gOAMParentModuleFlag ) { if ( gOAMParentModuleFlag ) {
try {
oam.getSystemConfig( "DBRootStorageType", DBRootStorageType);
}
catch(...) {}
if ( ( config.OAMStandbyName() != oam::UnassignedName ) && if ( ( config.OAMStandbyName() != oam::UnassignedName ) &&
DBRootStorageType != "internal" ) { DBRootStorageType != "internal" ) {
//try for 20 minutes checking if the standby node is up //try for 20 minutes checking if the standby node is up
@@ -405,6 +399,7 @@ int main(int argc, char **argv)
} }
//hdfs / hadoop config //hdfs / hadoop config
string DBRootStorageType;
try { try {
oam.getSystemConfig( "DBRootStorageType", DBRootStorageType); oam.getSystemConfig( "DBRootStorageType", DBRootStorageType);
} }