diff --git a/oam/install_scripts/module_installer.sh b/oam/install_scripts/module_installer.sh index cfd52161d..b089e0989 100755 --- a/oam/install_scripts/module_installer.sh +++ b/oam/install_scripts/module_installer.sh @@ -98,6 +98,14 @@ if [ $module = "um" ]; then fi fi fi + + #setup rc.local + RCFILE=/etc/rc.d/rc.local + + if [ $user != "root" ]; then + echo "uncomment runuser in rc.local, amazon AMI" + sudo sed -i -e 's/#runuser/runuser/g' /etc/rc.d/rc.local >/dev/null 2>&1 + fi fi #if pm, create dbroot directories @@ -168,19 +176,6 @@ if [ $user == "root" ]; then fi fi -#setup rc.local -if [ -f /etc/rc.d ]; then - RCFILE=/etc/rc.d/rc.local -else - RCFILE=/etc/rc.local -fi -touch $RCFILE - -if [ $user != "root" ]; then - echo "uncomment runuser in rc.local, amazon AMI" - sudo sed -i -e 's/#runuser/runuser/g' /etc/rc.d/rc.local >/dev/null 2>&1 -fi - echo "!!!Module Installation Successfully Completed!!!" exit 0 diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index 2def8d11b..550741bbe 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -4056,7 +4056,18 @@ int main(int argc, char* argv[]) { if ( oam.checkLogStatus(dbbuilderLog, "System catalog appears to exist") ) { - cout.flush(); + cout << endl << "Run MariaDB Upgrade.. "; + cout.flush(); + + //send message to procmon's to run upgrade script + int status = sendUpgradeRequest(IserverTypeInstall, pmwithum); + + if ( status != 0 ) { + cout << endl << "MariaDB Columnstore Install Failed" << endl << endl; + exit(1); + } + else + cout << " DONE" << endl; } else { diff --git a/procmgr/processmanager.cpp b/procmgr/processmanager.cpp index c218fee46..3fe88d1b2 100644 --- a/procmgr/processmanager.cpp +++ b/procmgr/processmanager.cpp @@ -5107,10 +5107,10 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str } //wait until login is success until continuing or fail if can't login - log.writeLog(__LINE__, "addModule - Successfully Launch of new Instance, retry login test: " + moduleName, LOG_TYPE_DEBUG); + log.writeLog(__LINE__, "addModule - Successfully Launch of new Instance, perform login test: " + moduleName, LOG_TYPE_DEBUG); int retry = 0; - for ( ; retry < 18 ; retry++) + for ( ; retry < 30 ; retry++) { IPAddr = oam.getEC2InstanceIpAddress(hostName); @@ -5123,7 +5123,7 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str if (IPAddr == "stopped") { - sleep(10); + sleep(5); continue; } @@ -5131,11 +5131,6 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str string cmd = installDir + "/bin/remote_command.sh " + IPAddr + " " + password + " 'ls' 1 > " + loginTmp; int rtnCode = system(cmd.c_str()); -log.writeLog(__LINE__, "loginTmp " + loginTmp, LOG_TYPE_DEBUG); -log.writeLog(__LINE__, "cmd " + cmd, LOG_TYPE_DEBUG); -log.writeLog(__LINE__, "rtnCode " + oam.itoa(rtnCode), LOG_TYPE_DEBUG); - - if (!oam.checkLogStatus(loginTmp, "README")) { //check for RSA KEY ISSUE and fix if (oam.checkLogStatus(loginTmp, "Host key verification failed")) @@ -5146,7 +5141,7 @@ log.writeLog(__LINE__, "rtnCode " + oam.itoa(rtnCode), LOG_TYPE_DEBUG); } log.writeLog(__LINE__, "addModule - login failed, retry login test: " + moduleName, LOG_TYPE_DEBUG); - sleep(10); + sleep(5); continue; } @@ -5154,7 +5149,7 @@ log.writeLog(__LINE__, "rtnCode " + oam.itoa(rtnCode), LOG_TYPE_DEBUG); break; } - if ( retry >= 18 ) + if ( retry >= 30 ) { log.writeLog(__LINE__, "addModule - Failed to log in to Instance: " + hostName, LOG_TYPE_ERROR); pthread_mutex_unlock(&THREAD_LOCK); @@ -5546,19 +5541,6 @@ log.writeLog(__LINE__, "rtnCode " + oam.itoa(rtnCode), 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 + "' > " + tmpLogDir + "/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; diff --git a/procmon/processmonitor.cpp b/procmon/processmonitor.cpp index 242df76c1..df72c5c4d 100644 --- a/procmon/processmonitor.cpp +++ b/procmon/processmonitor.cpp @@ -1710,27 +1710,26 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO break; } + case RUNUPGRADE: + { + log.writeLog(__LINE__, "MSG RECEIVED: Run upgrade script "); - /* case RUNUPGRADE: - { - log.writeLog(__LINE__, "MSG RECEIVED: Run upgrade script "); + string mysqlpw; + msg >> mysqlpw; - string mysqlpw; - msg >> mysqlpw; + // run upgrade script + int ret = runUpgrade(mysqlpw); - // run upgrade script - int ret = runUpgrade(mysqlpw); + ackMsg << (ByteStream::byte) ACK; + ackMsg << (ByteStream::byte) RUNUPGRADE; + ackMsg << (ByteStream::byte) ret; + mq.write(ackMsg); - ackMsg << (ByteStream::byte) ACK; - ackMsg << (ByteStream::byte) RUNUPGRADE; - ackMsg << (ByteStream::byte) ret; - mq.write(ackMsg); + log.writeLog(__LINE__, "RUNUPGRADE: ACK back to ProcMgr return status = " + oam.itoa((int) ret)); - log.writeLog(__LINE__, "RUNUPGRADE: ACK back to ProcMgr return status = " + oam.itoa((int) ret)); - - break; - } - */ + break; + } + case PROCUNMOUNT: { string dbrootID; @@ -6578,6 +6577,47 @@ int ProcessMonitor::glusterUnassign(std::string dbrootID) return oam::API_SUCCESS; } +/****************************************************************************************** +* @brief runUpgrade +* +* purpose: run upgrade script +* +******************************************************************************************/ +int ProcessMonitor::runUpgrade(std::string mysqlpw) +{ + Oam oam; + + string tmpLog = tmpLogDir + "/mysql_upgrade.log"; + + for ( int i = 0 ; i < 10 ; i++ ) + { + //run upgrade script + string cmd = startup::StartUp::installDir() + "/mysql/bin/mysql_upgrade --defaults-file=" + startup::StartUp::installDir() + "/mysql/my.cnf --password=" + + mysqlpw + " > " + tmpLog + " 2>&1"; + int retCode = system(cmd.c_str()); + + if ( retCode == 0 ) { + log.writeLog(__LINE__, "mysql_upgrade.sh: Successful return", LOG_TYPE_DEBUG); + return oam::API_SUCCESS; + } + else { + if (oam.checkLogStatus(cmd, "ERROR 1045") ) { + log.writeLog(__LINE__, "mysql_upgrade.sh: Missing Password error, return success", LOG_TYPE_DEBUG); + return oam::API_SUCCESS; + } + + log.writeLog(__LINE__, "mysql_upgrade.sh: Error return, check log " + tmpLog, LOG_TYPE_ERROR); + //restart mysqld and retry + try { + oam.actionMysqlCalpont(MYSQL_RESTART); + } + catch(...) + {} + sleep(1); + } + } + return oam::API_FAILURE; +} } //end of namespace diff --git a/procmon/processmonitor.h b/procmon/processmonitor.h index 5ec131d42..67c30f0a7 100644 --- a/procmon/processmonitor.h +++ b/procmon/processmonitor.h @@ -493,7 +493,7 @@ public: /** *@brief run upgrade script */ -// int runUpgrade(std::string mysqlpw); + int runUpgrade(std::string mysqlpw); /** *@brief change my.cnf