From f709a00b81b026e32ee33deb2e314d0dced309e8 Mon Sep 17 00:00:00 2001 From: david hill Date: Thu, 22 Jun 2017 14:37:28 -0500 Subject: [PATCH] MCOL-770 - change the distubute install --- oam/install_scripts/binary_installer.sh | 30 ++++++++++++++++ oam/install_scripts/performance_installer.sh | 31 ++++++++++++++++ oam/install_scripts/user_installer.sh | 30 ++++++++++++++++ oamapps/postConfigure/postConfigure.cpp | 37 +++++--------------- procmgr/main.cpp | 2 +- procmgr/processmanager.cpp | 18 ++++++++-- procmon/main.cpp | 24 ++++++------- 7 files changed, 127 insertions(+), 45 deletions(-) diff --git a/oam/install_scripts/binary_installer.sh b/oam/install_scripts/binary_installer.sh index 9cd50ccb3..51a76df0f 100644 --- a/oam/install_scripts/binary_installer.sh +++ b/oam/install_scripts/binary_installer.sh @@ -168,6 +168,36 @@ expect { "postConfigure" { send_user "DONE" } } send_user "\n" + +# start service +if { $INSTALLTYPE == "initial" } { + send_user "\n" + send_user "Start columnstore service script " + send " \n" + send date\n + send "ssh $USERNAME@$SERVER '$INSTALLDIR/bin/columnstore start'\n" + set timeout 10 + expect { + "word: " { send "$PASSWORD\n" } + "passphrase" { send "$PASSWORD\n" } + } + set timeout 60 + # check return + expect { + "No such file" { send_user "ERROR: post-install Not Found\n" ; exit 1 } + "MariaDB Columnstore syslog logging not working" { send_user "ERROR: MariaDB Columnstore System logging not setup\n" ; exit 1 } + "Permission denied, please try again" { send_user "ERROR: Invalid password\n" ; exit 1 } + "Read-only file system" { send_user "ERROR: local disk - Read-only file system\n" ; exit 1} + "Connection refused" { send_user "ERROR: Connection refused\n" ; exit 1 } + "Connection closed" { send_user "ERROR: Connection closed\n" ; exit 1 } + "No route to host" { send_user "ERROR: No route to host\n" ; exit 1 } + "Starting MariaDB" { send_user "DONE" } + } +} + +send_user "\nInstallation Successfully Completed on '$MODULE'\n" +exit 0 + sleep 10 # if { $INSTALLTYPE == "initial" || $INSTALLTYPE == "nonDistribute" } { diff --git a/oam/install_scripts/performance_installer.sh b/oam/install_scripts/performance_installer.sh index 9a78592f7..ba373f92d 100644 --- a/oam/install_scripts/performance_installer.sh +++ b/oam/install_scripts/performance_installer.sh @@ -202,6 +202,37 @@ if { $INSTALLTYPE == "initial"} { send_user "\n" #sleep to make sure it's finished sleep 5 + +# start service +if { $INSTALLTYPE == "initial" } { + send_user "\n" + send_user "Start columnstore service script " + send " \n" + send date\n + send "ssh $USERNAME@$SERVER '$INSTALLDIR/bin/columnstore start'\n" + set timeout 10 + expect { + "word: " { send "$PASSWORD\n" } + "passphrase" { send "$PASSWORD\n" } + } + set timeout 60 + # check return + expect { + "No such file" { send_user "ERROR: post-install Not Found\n" ; exit 1 } + "MariaDB Columnstore syslog logging not working" { send_user "ERROR: MariaDB Columnstore System logging not setup\n" ; exit 1 } + "Permission denied, please try again" { send_user "ERROR: Invalid password\n" ; exit 1 } + "Read-only file system" { send_user "ERROR: local disk - Read-only file system\n" ; exit 1} + "Connection refused" { send_user "ERROR: Connection refused\n" ; exit 1 } + "Connection closed" { send_user "ERROR: Connection closed\n" ; exit 1 } + "No route to host" { send_user "ERROR: No route to host\n" ; exit 1 } + "Starting MariaDB" { send_user "DONE" } + } +} + +send_user "\nInstallation Successfully Completed on '$MODULE'\n" +exit 0 + + set timeout 30 #expect -re {[$#] } if { $INSTALLTYPE == "initial"} { diff --git a/oam/install_scripts/user_installer.sh b/oam/install_scripts/user_installer.sh index d4d94abf0..3b18b9c62 100644 --- a/oam/install_scripts/user_installer.sh +++ b/oam/install_scripts/user_installer.sh @@ -206,6 +206,36 @@ if { $INSTALLTYPE == "initial"} { } #sleep to make sure it's finished sleep 5 + +# start service +if { $INSTALLTYPE == "initial" } { + send_user "\n" + send_user "Start columnstore service script " + send " \n" + send date\n + send "ssh $USERNAME@$SERVER '$INSTALLDIR/bin/columnstore start'\n" + set timeout 10 + expect { + "word: " { send "$PASSWORD\n" } + "passphrase" { send "$PASSWORD\n" } + } + set timeout 60 + # check return + expect { + "No such file" { send_user "ERROR: post-install Not Found\n" ; exit 1 } + "MariaDB Columnstore syslog logging not working" { send_user "ERROR: MariaDB Columnstore System logging not setup\n" ; exit 1 } + "Permission denied, please try again" { send_user "ERROR: Invalid password\n" ; exit 1 } + "Read-only file system" { send_user "ERROR: local disk - Read-only file system\n" ; exit 1} + "Connection refused" { send_user "ERROR: Connection refused\n" ; exit 1 } + "Connection closed" { send_user "ERROR: Connection closed\n" ; exit 1 } + "No route to host" { send_user "ERROR: No route to host\n" ; exit 1 } + "Starting MariaDB" { send_user "DONE" } + } +} + +send_user "\nInstallation Successfully Completed on '$MODULE'\n" +exit 0 + # if { $INSTALLTYPE == "initial"} { # diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index 19b8fee51..804686e9b 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -2076,7 +2076,7 @@ int main(int argc, char *argv[]) system(cmd.c_str()); if ( newModuleName != parentOAMModuleName) { - //make module file in local/etc/"modulename" + //make module file in local/module if( !makeModuleFile(newModuleName, parentOAMModuleName) ) cout << "makeModuleFile error" << endl; } @@ -3301,7 +3301,7 @@ int main(int argc, char *argv[]) } else { - if ( !nonDistribute ) +/* if ( !nonDistribute ) { if ( password.empty() ) { while(true) @@ -3371,7 +3371,7 @@ int main(int argc, char *argv[]) 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"; @@ -3767,7 +3767,7 @@ bool setOSFiles(string parentOAMModuleName, int serverTypeInstall) //check and do the amazon credentials file string fileName = HOME + "/.aws/credentials"; ifstream oldFile (fileName.c_str()); - if (!oldFile) + if (!oldFile) return allfound; string cmd = "cp " + fileName + " " + installDir + "/local/etc/. > /dev/null 2>&1"; @@ -3951,7 +3951,7 @@ bool makeRClocal(string moduleType, string moduleName, int IserverTypeInstall) mount1 = "/mnt\\/tmp/"; else if ( moduleType == "pm" ) - mount1 = "/Calpont\\/data/"; + mount1 = "/columnstore\\/data/"; else return true; break; @@ -3960,28 +3960,7 @@ bool makeRClocal(string moduleType, string moduleName, int IserverTypeInstall) { if ( moduleType == "pm" ) { mount1 = "/mnt\\/tmp/"; - mount2 = "/Calpont\\/data/"; - } - else - return true; - break; - } - case (oam::INSTALL_COMBINE_DM_UM): // combined #2 dm/um on a same server - { - if ( moduleType == "um" ) - mount1 = "/mnt\\/tmp/"; - else - if ( moduleType == "pm" ) - mount1 = "/Calpont\\/data/"; - else - return true; - break; - } - case (oam::INSTALL_COMBINE_PM_UM): // combined #3 um/pm on a same server - { - if ( moduleType == "pm" ) { - mount1 = "/mnt\\/tmp/"; - mount2 = "/Calpont\\/data/"; + mount2 = "/columnstore\\/data/"; } else return true; @@ -5002,8 +4981,8 @@ bool makeModuleFile(string moduleName, string parentOAMModuleName) if ( moduleName == parentOAMModuleName) fileName = installDir + "/local/module"; else - fileName = installDir + "/local/etc/" + moduleName + "/module"; - + return true; + unlink (fileName.c_str()); ofstream newFile (fileName.c_str()); diff --git a/procmgr/main.cpp b/procmgr/main.cpp index 3485626f5..e3d0ebf71 100644 --- a/procmgr/main.cpp +++ b/procmgr/main.cpp @@ -565,7 +565,7 @@ static void startMgrProcessThread() } //send out moduleName to remote nodes on non-distrubuted install - if ( DistributedInstall == "n" ) +// if ( DistributedInstall == "n" ) { int status = API_SUCCESS; int k = 0; diff --git a/procmgr/processmanager.cpp b/procmgr/processmanager.cpp index a563f3a48..9df519bb9 100644 --- a/procmgr/processmanager.cpp +++ b/procmgr/processmanager.cpp @@ -5285,6 +5285,9 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str } } + //distribute config file + distributeConfigFile("system"); + //Start new modules by starting up local Process-Monitor listPT = devicenetworklist.begin(); for( ; listPT != devicenetworklist.end() ; listPT++) @@ -5300,9 +5303,9 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str 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); +// 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)); @@ -5347,6 +5350,15 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str } } + listPT = devicenetworklist.begin(); + for( ; listPT != devicenetworklist.end() ; listPT++) + { + string moduleName = (*listPT).DeviceName; + + processManager.configureModule(moduleName); + sleep(10); + } + //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); diff --git a/procmon/main.cpp b/procmon/main.cpp index 76e72d42e..97bef69dd 100644 --- a/procmon/main.cpp +++ b/procmon/main.cpp @@ -166,20 +166,20 @@ int main(int argc, char **argv) MonitorConfig config; //get Distributed Install - string DistributedInstall = "y"; +// string DistributedInstall = "y"; - try - { - oam.getSystemConfig("DistributedInstall", DistributedInstall); - } - catch (...) - { - log.writeLog(__LINE__, "addModule - ERROR: get DistributedInstall", LOG_TYPE_ERROR); - } +// try +// { +// oam.getSystemConfig("DistributedInstall", DistributedInstall); +// } +// catch (...) +// { +// log.writeLog(__LINE__, "addModule - ERROR: get DistributedInstall", LOG_TYPE_ERROR); +// } //check for a non-distrubuted install setup - if ( DistributedInstall == "n" ) - { +// if ( DistributedInstall == "n" ) +// { //PMwithUM config try { oam.getSystemConfig( "PMwithUM", PMwithUM); @@ -204,7 +204,7 @@ int main(int argc, char **argv) log.writeLog(__LINE__, "restarting for a non-distrubuted install", LOG_TYPE_DEBUG); exit (0); - } +// } } //define entry if missing