From 0599b7c3e972c18bbc980abd54f4a3014d07d80c Mon Sep 17 00:00:00 2001 From: david hill Date: Mon, 19 Jun 2017 15:32:48 -0500 Subject: [PATCH] mcol770 --- oam/etc/Columnstore.xml | 2 +- oamapps/postConfigure/postConfigure.cpp | 563 +++++++++----------- procmgr/processmanager.cpp | 671 ++++++++++++------------ procmon/main.cpp | 7 +- 4 files changed, 590 insertions(+), 653 deletions(-) diff --git a/oam/etc/Columnstore.xml b/oam/etc/Columnstore.xml index e87b0b90c..262edc802 100644 --- a/oam/etc/Columnstore.xml +++ b/oam/etc/Columnstore.xml @@ -226,7 +226,7 @@ C columnstore-1 - pm1 + unassigned unassigned unassigned 1 diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index 44fa3517c..ab8f0f7b6 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -2737,7 +2737,7 @@ int main(int argc, char *argv[]) // determine package type string EEPackageType; - if (!rootUser || nonDistribute) + if (!rootUser) EEPackageType = "binary"; else { @@ -2798,7 +2798,10 @@ int main(int argc, char *argv[]) if ( install == "y" ) { - SystemSoftware systemsoftware; + //skip interface with remote servers and perform install + if ( !nonDistribute ) + { + SystemSoftware systemsoftware; try { @@ -2815,46 +2818,38 @@ int main(int argc, char *argv[]) string version = systemsoftware.Version + "-" + systemsoftware.Release; 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; - } - 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); + cout << "Performing an MariaDB ColumnStore System install using RPM packages" << endl; + cout << "located in the " + HOME + " directory." << endl << endl; } else { - EEPackageType = "binary"; - installType = "nonDistribute"; - columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.bin.tar.gz"; + 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); if ( password.empty() ) { @@ -2935,10 +2930,7 @@ int main(int argc, char *argv[]) string logfile; if ( remote_installer_debug == "1" ) { logfile = "/tmp/"; - if ( nonDistribute ) - logfile += remoteModuleName + "_nondistributed_install.log"; - else - logfile += remoteModuleName + "_" + EEPackageType + "_install.log"; + logfile += remoteModuleName + "_" + EEPackageType + "_install.log"; debug_logfile = " > " + logfile; } @@ -2946,277 +2938,219 @@ int main(int argc, char *argv[]) (remoteModuleType == "pm" && IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM) || (remoteModuleType == "pm" && pmwithum) ) { - if ( nonDistribute ) - { - cout << endl << "----- Performing Non-Distrubuted Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl; + cout << endl << "----- Performing Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl; - //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) { - cout << "Error: MariaDB ColumnStore not installed on " + remoteModuleName + " / " + remoteHostName << endl; - cout << "Install and re-run postConfigure. Exiting..." << endl << endl; - exit(1); - } - //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) { - cout << "Error: MariaDB ColumnStore not installed on " + remoteModuleName + " / " + remoteHostName << endl; - cout << "Install and re-run postConfigure. Exiting..." << endl << endl; - exit(1); - } - cmd = "diff " + installDir + "/releasenum releasenum > /dev/null 2>&1"; - rtnCode = system(cmd.c_str()); - if (WEXITSTATUS(rtnCode) != 0) { - 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; - exit(1); - } + 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/user_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + EEPackageType + " " + nodeps + " " + temppwprompt + " " + mysqlPort + " " + 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 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 - 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" ) - cout << "Install log file is located here: " + logfile << endl << endl; + 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; - if ( EEPackageType != "binary" ) { - string temppwprompt = pwprompt; - if ( pwprompt == " " ) - temppwprompt = "none"; - - //run remote installer script - cmd = installDir + "/bin/user_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + EEPackageType + " " + nodeps + " " + temppwprompt + " " + mysqlPort + " " + 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 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); - } - } - } + 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 { if ( (remoteModuleType == "pm" && IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM) || (remoteModuleType == "pm" && !pmwithum ) ) { - if ( nonDistribute ) - { - cout << endl << "----- Performing Non-Distrubuted Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl; + cout << endl << "----- Performing Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl; - //check of releasenum 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) { - cout << endl << "Error: MariaDB ColumnStore not installed on " + remoteModuleName + " / " + remoteHostName << endl; - cout << "Install and re-run postConfigure. Exiting..." << endl << endl; - exit(1); - } - //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) { - cout << "Error: MariaDB ColumnStore not installed on " + remoteModuleName + " / " + remoteHostName << endl; - cout << "Install and re-run postConfigure. Exiting..." << endl << endl; - exit(1); - } - cmd = "diff " + installDir + "/releasenum releasenum > /dev/null 2>&1"; - rtnCode = system(cmd.c_str()); - if (WEXITSTATUS(rtnCode) != 0) { - 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; - exit(1); - } + 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/performance_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + 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 performance_installer.sh" << endl; + exit(1); + } + } } - else - cout << endl << "----- Performing Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << 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 ( remote_installer_debug == "1" ) - cout << "Install log file is located here: " + logfile << endl << endl; + if ( thread_remote_installer ) { + thr_data[thread_id].command = cmd; - if ( EEPackageType != "binary" ) { - //run remote installer script - cmd = installDir + "/bin/performance_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + 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 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); - } - } - } + 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; } + } } } @@ -3301,7 +3236,8 @@ int main(int argc, char *argv[]) else 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 @@ -3336,7 +3272,7 @@ int main(int argc, char *argv[]) if ( start == "y" ) { - if (hdfs) + if (hdfs && !nonDistribute ) { cout << endl << "----- Starting MariaDB ColumnStore Service on all Modules -----" << endl << endl; string cmd = "pdsh -a '" + installDir + "/bin/columnstore restart' > /tmp/postConfigure.pdsh 2>&1"; @@ -3348,6 +3284,8 @@ int main(int argc, char *argv[]) } else { + if ( !nonDistribute ) + { if ( password.empty() ) { while(true) { @@ -3415,19 +3353,20 @@ int main(int argc, char *argv[]) else cout << "MariaDB ColumnStore successfully started" << endl; } - - //start MariaDB ColumnStore on local server - cout << endl << "----- Starting MariaDB ColumnStore on local server -----" << endl << endl; - cmd = installDir + "/bin/columnstore restart > /dev/null 2>&1"; - int rtnCode = system(cmd.c_str()); - if (WEXITSTATUS(rtnCode) != 0) { - cout << "Error Starting MariaDB ColumnStore local module" << endl; - cout << "Installation Failed, exiting" << endl; - exit (1); - } - else - cout << "MariaDB ColumnStore successfully started" << endl; - } + } + + //start MariaDB ColumnStore on local server + cout << endl << "----- Starting MariaDB ColumnStore on local server -----" << endl << endl; + cmd = installDir + "/bin/columnstore restart > /dev/null 2>&1"; + int rtnCode = system(cmd.c_str()); + if (WEXITSTATUS(rtnCode) != 0) { + cout << "Error Starting MariaDB ColumnStore local module" << endl; + cout << "Installation Failed, exiting" << endl; + exit (1); + } + else + cout << "MariaDB ColumnStore successfully started" << endl; + } } else { diff --git a/procmgr/processmanager.cpp b/procmgr/processmanager.cpp index ae45ecb42..0d178a919 100644 --- a/procmgr/processmanager.cpp +++ b/procmgr/processmanager.cpp @@ -4983,371 +4983,374 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str } } - //PMwithUM config - string PMwithUM = "n"; - try { - oam.getSystemConfig( "PMwithUM", PMwithUM); - } - catch(...) { - PMwithUM = "n"; - } + if ( DistributedInstall == "y" ) { - //check mysql port changes - string MySQLPort; - try { - oam.getSystemConfig( "MySQLPort", MySQLPort); - } - catch(...) - {} + //PMwithUM config + string PMwithUM = "n"; + try { + oam.getSystemConfig( "PMwithUM", PMwithUM); + } + catch(...) { + PMwithUM = "n"; + } - if ( MySQLPort.empty() || MySQLPort == "" || MySQLPort == oam::UnassignedName ) - MySQLPort = "3306"; + //check mysql port changes + 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 - 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; + string version = systemsoftware.Version + "-" + systemsoftware.Release; - //create and copy custom OS - //run remote installer script - string dir = installDir + "/local/etc/" + remoteModuleName; + //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; - string cmd = "mkdir " + dir + " > /dev/null 2>&1"; - system(cmd.c_str()); + //create and copy custom OS + //run remote installer script + string dir = installDir + "/local/etc/" + remoteModuleName; - 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); + string cmd = "mkdir " + dir + " > /dev/null 2>&1"; + system(cmd.c_str()); - //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 == "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); - if ( remoteModuleType == "pm" ) { - //setup Standby OAM Parent, if needed - if ( config.OAMStandbyName() == oam::UnassignedName ) - setStandbyModule(remoteModuleName, false); - } + //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); - //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); + if ( remoteModuleType == "pm" ) { + //setup Standby OAM Parent, if needed + if ( config.OAMStandbyName() == oam::UnassignedName ) + 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()); - 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); - } + 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; + } - //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 - 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"; - 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; - 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; - } - } + if ( !passed ) + { + log.writeLog(__LINE__, "addModule - ERROR: user_installer.sh failed", LOG_TYPE_ERROR); + pthread_mutex_unlock(&THREAD_LOCK); + 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); - if ( !passed ) - { - log.writeLog(__LINE__, "addModule - ERROR: user_installer.sh failed", LOG_TYPE_ERROR); - pthread_mutex_unlock(&THREAD_LOCK); - 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()); + 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"; - string binservertype = oam.itoa(config.ServerInstallType()); - 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; + } + } - 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; + } + } + } + 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); - 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; - } - } - } - 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()); - 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; - 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); + string binservertype = oam.itoa(config.ServerInstallType()); + if ( PMwithUM == "y" ) + binservertype = "pmwithum"; - string binservertype = oam.itoa(config.ServerInstallType()); - 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"; - 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; - 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; - } - } - } - } + //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); + } } - - //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 distributeConfigFile("system"); diff --git a/procmon/main.cpp b/procmon/main.cpp index c13adb819..ff3db765f 100644 --- a/procmon/main.cpp +++ b/procmon/main.cpp @@ -169,13 +169,7 @@ int main(int argc, char **argv) int moduleStatus = oam::ACTIVE; //check if currently configured as Parent OAM Module on startup - string DBRootStorageType; if ( gOAMParentModuleFlag ) { - try { - oam.getSystemConfig( "DBRootStorageType", DBRootStorageType); - } - catch(...) {} - if ( ( config.OAMStandbyName() != oam::UnassignedName ) && DBRootStorageType != "internal" ) { //try for 20 minutes checking if the standby node is up @@ -405,6 +399,7 @@ int main(int argc, char **argv) } //hdfs / hadoop config + string DBRootStorageType; try { oam.getSystemConfig( "DBRootStorageType", DBRootStorageType); }