diff --git a/cpackEngineRPM.cmake b/cpackEngineRPM.cmake index be5df3462..d2b240029 100644 --- a/cpackEngineRPM.cmake +++ b/cpackEngineRPM.cmake @@ -181,7 +181,6 @@ SET(CPACK_RPM_platform_USER_FILELIST "/usr/local/mariadb/columnstore/bin/resourceReport.sh" "/usr/local/mariadb/columnstore/bin/hadoopReport.sh" "/usr/local/mariadb/columnstore/bin/alarmReport.sh" -"/usr/local/mariadb/columnstore/bin/amazonInstaller" "/usr/local/mariadb/columnstore/bin/remote_command_verify.sh" "/usr/local/mariadb/columnstore/bin/disable-rep-columnstore.sh" "/usr/local/mariadb/columnstore/bin/columnstore.service" @@ -217,6 +216,9 @@ SET(CPACK_RPM_platform_USER_FILELIST "/usr/local/mariadb/columnstore/bin/os_detect.sh" "/usr/local/mariadb/columnstore/bin/columnstoreClusterTester.sh" "/usr/local/mariadb/columnstore/bin/mariadb-command-line.sh" +"/usr/local/mariadb/columnstore/bin/quick_installer_single_server.sh" +"/usr/local/mariadb/columnstore/bin/quick_installer_multi_server.sh" +"/usr/local/mariadb/columnstore/bin/quick_installer_amazon.sh" ${ignored}) SET(CPACK_RPM_libs_USER_FILELIST diff --git a/oam/etc/Columnstore.xml b/oam/etc/Columnstore.xml index ec985028f..d083cf60c 100644 --- a/oam/etc/Columnstore.xml +++ b/oam/etc/Columnstore.xml @@ -438,7 +438,7 @@ n n n - 2 + 1 n n internal diff --git a/oamapps/postConfigure/CMakeLists.txt b/oamapps/postConfigure/CMakeLists.txt index 60f761e25..4bdbadd1a 100644 --- a/oamapps/postConfigure/CMakeLists.txt +++ b/oamapps/postConfigure/CMakeLists.txt @@ -37,13 +37,13 @@ install(TARGETS getMySQLpw DESTINATION ${ENGINE_BINDIR} COMPONENT platform) ########### next target ############### -set(amazonInstaller_SRCS amazonInstaller.cpp helpers.cpp) +#set(amazonInstaller_SRCS amazonInstaller.cpp helpers.cpp) -add_executable(amazonInstaller ${amazonInstaller_SRCS}) +#add_executable(amazonInstaller ${amazonInstaller_SRCS}) -target_link_libraries(amazonInstaller ${ENGINE_LDFLAGS} readline ncurses ${SNMP_LIBRARIES} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS}) +#target_link_libraries(amazonInstaller ${ENGINE_LDFLAGS} readline ncurses ${SNMP_LIBRARIES} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS}) -install(TARGETS amazonInstaller DESTINATION ${ENGINE_BINDIR} COMPONENT platform) +#install(TARGETS amazonInstaller DESTINATION ${ENGINE_BINDIR} COMPONENT platform) ########### next target ############### @@ -59,5 +59,5 @@ install(TARGETS mycnfUpgrade DESTINATION ${ENGINE_BINDIR} COMPONENT platform) ########### next target ############### -install(PROGRAMS quick_installer_single_server.sh +install(PROGRAMS quick_installer_single_server.sh quick_installer_multi_server.sh quick_installer_amazon.sh DESTINATION ${ENGINE_BINDIR} COMPONENT platform) diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index e7670ce99..98227da9d 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -99,6 +99,14 @@ typedef struct Performance_Module_struct typedef std::vector PerformanceModuleList; +typedef struct ModuleIP_struct +{ + std::string IPaddress; + std::string moduleName; +} ModuleIP; + +typedef std::vector ModuleIpList; + void offLineAppCheck(); bool setOSFiles(string parentOAMModuleName, int serverTypeInstall); bool checkSaveConfigFile(); @@ -112,7 +120,7 @@ bool makeRClocal(string moduleType, string moduleName, int IserverTypeInstall); bool createDbrootDirs(string DBRootStorageType); bool pkgCheck(std::string columnstorePackage); bool storageSetup(bool amazonInstall); -void setSystemName(bool single_server_quick_install = false); +void setSystemName(); bool singleServerDBrootSetup(); bool copyFstab(string moduleName); bool attachVolume(string instanceName, string volumeName, string deviceName, string dbrootPath); @@ -121,12 +129,6 @@ void remoteInstallThread(void *); bool glusterSetup(string password); -typedef struct ModuleIP_struct -{ - std::string IPaddress; - std::string moduleName; -} ModuleIP; - std::string launchInstance(ModuleIP moduleip); string columnstorePackage; @@ -150,7 +152,6 @@ string PMVolumeType = "standard"; string PMVolumeIOPS = oam::UnassignedName; string UMVolumeIOPS = oam::UnassignedName; - int DBRootCount; string deviceName; @@ -185,6 +186,10 @@ string MySQLRep = "y"; string PMwithUM = "n"; bool amazonInstall = false; bool nonDistribute = false; +bool nonDistributeFlag = false; +bool single_server_quick_install = false; +bool multi_server_quick_install = false; +bool amazon_quick_install = false; string DataFileEnvFile; @@ -219,8 +224,9 @@ int main(int argc, char *argv[]) noPrompting = false; string password; string cmd; - bool single_server_quick_install = false; - + string pmIpAddrs = ""; + string umIpAddrs = ""; + // struct sysinfo myinfo; // hidden options @@ -272,10 +278,12 @@ int main(int argc, char *argv[]) if (p && *p) HOME = p; } + for( int i = 1; i < argc; i++ ) { - if( string("-h") == argv[i] ) { + if( string("-h") == argv[i] ) + { cout << endl; cout << "This is the MariaDB ColumnStore System Configuration and Installation tool." << endl; cout << "It will Configure the MariaDB ColumnStore System based on Operator inputs and" << endl; @@ -289,48 +297,68 @@ int main(int argc, char *argv[]) cout << " Enter one of the options within [], if available, or" << endl; cout << " Enter a new value" << endl << endl; cout << endl; - cout << "Usage: postConfigure [-h][-c][-u][-p][-qs][-port][-i][-n][-sn]" << endl; + cout << "Usage: postConfigure [-h][-c][-u][-p][-qs][-qm][-qa][-port][-i][-n][-d][-sn][-pm-ip-addrs][-um-ip-addrs][-pm-count][-um-count]" << endl; cout << " -h Help" << endl; cout << " -c Config File to use to extract configuration data, default is Columnstore.xml.rpmsave" << endl; cout << " -u Upgrade, Install using the Config File from -c, default to Columnstore.xml.rpmsave" << endl; cout << " If ssh-keys aren't setup, you should provide passwords as command line arguments" << endl; cout << " -p Unix Password, used with no-prompting option" << endl; - cout << " -qs Single Server Quick Install" << endl; + cout << " -qs Quick Install - Single Server" << endl; + cout << " -qm Quick Install - Multi Server" << endl; cout << " -port MariaDB ColumnStore Port Address" << endl; cout << " -i Non-root Install directory, Only use for non-root installs" << endl; - cout << " -n Non-distributed install, meaning it will not install the remote nodes" << endl; + cout << " -n Non-distributed install, meaning postConfigure will not install packages on remote nodes" << endl; + cout << " -d Distributed install, meaning postConfigure will install packages on remote nodes" << endl; cout << " -sn System Name" << endl; + cout << " -pm-ip-addrs Performance Module IP Addresses xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx" << endl; + cout << " -um-ip-addrs User Module IP Addresses xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx" << endl; exit (0); } - else if( string("-qs") == argv[i] ) - { - single_server_quick_install = true; - noPrompting = true; - } - else if( string("-f") == argv[i] ) - nodeps = "--nodeps"; - else if( string("-o") == argv[i] ) - startOfflinePrompt = true; - else if( string("-c") == argv[i] ) { + else if( string("-qs") == argv[i] ) + { + single_server_quick_install = true; + noPrompting = true; + } + else if( string("-qm") == argv[i] ) + { + multi_server_quick_install = true; + noPrompting = true; + } + else if( string("-qa") == argv[i] ) + { + amazon_quick_install = true; + noPrompting = true; + } + else if( string("-f") == argv[i] ) + nodeps = "--nodeps"; + else if( string("-o") == argv[i] ) + startOfflinePrompt = true; + else if( string("-c") == argv[i] ) + { i++; - if (i >= argc ) { + if (i >= argc ) + { cout << " ERROR: Config File not provided" << endl; exit (1); } oldFileName = argv[i]; - if ( oldFileName.find("Columnstore.xml") == string::npos ) { + if ( oldFileName.find("Columnstore.xml") == string::npos ) + { cout << " ERROR: Config File is not a Columnstore.xml file name" << endl; exit (1); } } - else if( string("-p") == argv[i] ) { + else if( string("-p") == argv[i] ) + { i++; - if (i >= argc ) { + if (i >= argc ) + { cout << " ERROR: Password not provided" << endl; exit (1); } password = argv[i]; - if ( password.find("-") != string::npos ) { + if ( password.find("-") != string::npos ) + { cout << " ERROR: Valid Password not provided" << endl; exit (1); } @@ -339,10 +367,20 @@ int main(int argc, char *argv[]) noPrompting = true; // for backward compatibility else if( string("-n") == argv[i] ) + { nonDistribute = true; - else if( string("-port") == argv[i] ) { + nonDistributeFlag = true; + } + else if( string("-d") == argv[i] ) + { + nonDistribute = false; + nonDistributeFlag = true; + } + else if( string("-port") == argv[i] ) + { i++; - if (i >= argc ) { + if (i >= argc ) + { cout << " ERROR: MariaDB ColumnStore Port ID not supplied" << endl; exit (1); } @@ -353,29 +391,95 @@ int main(int argc, char *argv[]) exit (1); } } - else if( string("-i") == argv[i] ) { + else if( string("-i") == argv[i] ) + { i++; - if (i >= argc ) { + if (i >= argc ) + { cout << " ERROR: Path not provided" << endl; exit (1); } installDir = argv[i]; } - else if( string("-sn") == argv[i] ) { + else if( string("-sn") == argv[i] ) + { i++; - if (i >= argc ) { + if (i >= argc ) + { cout << " ERROR: System-name not provided" << endl; exit (1); } systemName = argv[i]; + } + else if( string("-pm-ip-addrs") == argv[i] ) + { + i++; + if (i >= argc ) + { + cout << " ERROR: PM-IP-ADRESSES not provided" << endl; + exit (1); + } + pmIpAddrs = argv[i]; + } + else if( string("-um-ip-addrs") == argv[i] ) + { + i++; + if (i >= argc ) + { + cout << " ERROR: UM-IP-ADRESSES not provided" << endl; + exit (1); + } + umIpAddrs = argv[i]; + } + else if( string("-pm-count") == argv[i] ) + { + i++; + if (i >= argc ) + { + cout << " ERROR: PM-COUNT not provided" << endl; + exit (1); + } + pmNumber = atoi(argv[i]); + } + else if( string("-um-count") == argv[i] ) + { + i++; + if (i >= argc ) + { + cout << " ERROR: UM-COUNT not provided" << endl; + exit (1); + } + umNumber = atoi(argv[i]); } else { cout << " ERROR: Invalid Argument = " << argv[i] << endl; - cout << " Usage: postConfigure [-h][-c][-u][-p][-qs][-port][-i][-n][-sn]" << endl; + cout << " Usage: postConfigure [-h][-c][-u][-p][-qs][-qm][-qa][-port][-i][-n][-d][-sn][-pm-ip-addrs][-um-ip-addrs][-pm-count][-um-count]" << endl; exit (1); } } + + //check if quick install multi-server has been given ip address + if (multi_server_quick_install) + { + if ( ( umIpAddrs.empty() && pmIpAddrs.empty() ) || + ( !umIpAddrs.empty() && pmIpAddrs.empty() )) + { + cout << " ERROR: Multi-Server option entered, but invalid UM/PM IP addresses were provided, exiting" << endl; + exit(1); + } + } + + //check if quick install multi-server has been given ip address + if (amazon_quick_install) + { + if ( ( umNumber == 0 && pmNumber == 0 ) || + ( umNumber != 0 && pmNumber == 0 ) ) + { + cout << " ERROR: Amazon option entered, but invalid UM/PM Counts were provided, exiting" << endl; + exit(1); + } + } if (installDir[0] != '/') { @@ -395,7 +499,7 @@ int main(int argc, char *argv[]) cout << "IMPORTANT: This tool requires to run on the Performance Module #1" << endl; cout << endl; - if (!single_server_quick_install) + if (!single_server_quick_install || !multi_server_quick_install || !amazon_quick_install) { if (!noPrompting) { cout << "Prompting instructions:" << endl << endl; @@ -436,49 +540,43 @@ int main(int argc, char *argv[]) } //check Config saved files - if (!single_server_quick_install) + if ( !checkSaveConfigFile()) { - if ( !checkSaveConfigFile()) - { - cout << "ERROR: Configuration File not setup" << endl; - exit(1); - } + cout << "ERROR: Configuration File not setup" << endl; + exit(1); } //determine package type string EEPackageType; - if (single_server_quick_install) + if (!rootUser) + EEPackageType = "binary"; + else { - if (!rootUser) - EEPackageType = "binary"; - else - { - int rtnCode = system("rpm -qi mariadb-columnstore-platform > /tmp/columnstore.txt 2>&1"); - if (WEXITSTATUS(rtnCode) == 0) - EEPackageType = "rpm"; - else { - rtnCode = system("dpkg -s mariadb-columnstore-platform > /tmp/columnstore.txt 2>&1"); - if (WEXITSTATUS(rtnCode) == 0) - EEPackageType = "deb"; - else - EEPackageType = "binary"; - } + int rtnCode = system("rpm -qi mariadb-columnstore-platform > /tmp/columnstore.txt 2>&1"); + if (WEXITSTATUS(rtnCode) == 0) + EEPackageType = "rpm"; + else { + rtnCode = system("dpkg -s mariadb-columnstore-platform > /tmp/columnstore.txt 2>&1"); + if (WEXITSTATUS(rtnCode) == 0) + EEPackageType = "deb"; + else + EEPackageType = "binary"; } + } - try { - sysConfig->setConfig(InstallSection, "EEPackageType", EEPackageType); - } - catch(...) - { - cout << "ERROR: Problem setting EEPackageType from the MariaDB ColumnStore System Configuration file" << endl; - exit(1); - } + try { + sysConfig->setConfig(InstallSection, "EEPackageType", EEPackageType); + } + catch(...) + { + cout << "ERROR: Problem setting EEPackageType from the MariaDB ColumnStore System Configuration file" << endl; + exit(1); + } - if ( !writeConfig(sysConfig) ) { - cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; - exit(1); - } + if ( !writeConfig(sysConfig) ) { + cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; + exit(1); } //check for local ip address as pm1 @@ -614,12 +712,22 @@ int main(int argc, char *argv[]) } //check for non-Distributed Install - if ( nonDistribute ) + if ( nonDistributeFlag ) { - try { - oam.setSystemConfig("DistributedInstall", "n"); - } - catch(...) {} + if ( nonDistribute ) + { + try { + oam.setSystemConfig("DistributedInstall", "n"); + } + catch(...) {} + } + else + { + try { + oam.setSystemConfig("DistributedInstall", "y"); + } + catch(...) {} + } } else { @@ -638,7 +746,7 @@ int main(int argc, char *argv[]) if (single_server_quick_install) { - cout << "===== Quick Single-Server Install Configuration =====" << endl << endl; + cout << "===== Quick Install Single-Server Configuration =====" << endl << endl; cout << "Single-Server install is used when there will only be 1 server configured" << endl; cout << "on the system. It can also be used for production systems, if the plan is" << endl; @@ -646,6 +754,18 @@ int main(int argc, char *argv[]) singleServerInstall = "1"; } + else if (multi_server_quick_install) + { + cout << "===== Quick Install Multi-Server Configuration =====" << endl << endl; + + singleServerInstall = "2"; + } + else if (amazon_quick_install) + { + cout << "===== Quick Install Amazon Configuration =====" << endl << endl; + + singleServerInstall = "2"; + } else { cout << "===== Setup System Server Type Configuration =====" << endl << endl; @@ -724,7 +844,7 @@ int main(int argc, char *argv[]) system(cmd.c_str()); } - setSystemName(single_server_quick_install); + setSystemName(); if (!single_server_quick_install) { @@ -796,6 +916,112 @@ int main(int argc, char *argv[]) // // Multi-server install // + + ModuleIP InputModuleIP; + ModuleIpList InputModuleIPList; + + int MaxNicID = oam::MAX_NIC; + + if (multi_server_quick_install) + { + //set configuarion settings for default setup + try { + sysConfig->setConfig(InstallSection, "MySQLRep", "y"); + } + catch(...) + {} + + if (umIpAddrs == "" ) + { + // set Server Type Installation to combined + try { + sysConfig->setConfig(InstallSection, "ServerTypeInstall", "2"); + } + catch(...) + {} + } + else + { + int id = 1; + boost::char_separator sep(","); + boost::tokenizer< boost::char_separator > tokens(umIpAddrs, sep); + for ( boost::tokenizer< boost::char_separator >::iterator it = tokens.begin(); + it != tokens.end(); + ++it, ++id) + { + string module = "um" + oam.itoa(id); + + InputModuleIP.IPaddress = *it; + InputModuleIP.moduleName = module; + InputModuleIPList.push_back(InputModuleIP); + } + + umNumber = id-1; + } + + if (pmIpAddrs != "" ) + { + int id = 1; + boost::char_separator sep(","); + boost::tokenizer< boost::char_separator > tokens(pmIpAddrs, sep); + for ( boost::tokenizer< boost::char_separator >::iterator it = tokens.begin(); + it != tokens.end(); + ++it, ++id) + { + string module = "pm" + oam.itoa(id); + + InputModuleIP.IPaddress = *it; + InputModuleIP.moduleName = module; + InputModuleIPList.push_back(InputModuleIP); + } + + pmNumber = id-1; + } + + if ( !writeConfig(sysConfig) ) + { + cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; + exit(1); + } + + MaxNicID = 1; + } + else + { + if (amazon_quick_install) + { + //set configuarion settings for default setup + try { + sysConfig->setConfig(InstallSection, "MySQLRep", "y"); + } + catch(...) + {} + + try { + sysConfig->setConfig(InstallSection, "Cloud", "amazon-vpc"); + } + catch(...) + {} + + if (umNumber == 0 ) + { + // set Server Type Installation to combined + try { + sysConfig->setConfig(InstallSection, "ServerTypeInstall", "2"); + } + catch(...) + {} + } + + if ( !writeConfig(sysConfig) ) + { + cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; + exit(1); + } + + MaxNicID = 1; + } + } cout << endl; //cleanup/create local/etc directory @@ -851,7 +1077,7 @@ int main(int argc, char *argv[]) } switch ( IserverTypeInstall ) { - case (oam::INSTALL_COMBINE_DM_UM_PM): // combined #1 - dm/um/pm on a single server + case (oam::INSTALL_COMBINE_DM_UM_PM): // combined #1 - um/pm on a single server { cout << "Combined Server Installation will be performed." << endl; cout << "The Server will be configured as a Performance Module." << endl; @@ -986,8 +1212,8 @@ int main(int argc, char *argv[]) } if ( answer == "y" ) { - mysqlRep = true; - MySQLRep = "y"; + mysqlRep = true; + MySQLRep = "y"; } else { @@ -1027,13 +1253,30 @@ int main(int argc, char *argv[]) in.seekg(0, std::ios::end); int size = in.tellg(); - if ( size == 0 || oam.checkLogStatus("/tmp/amazon.log", "not found")) - // not running on amazon with ec2-api-tools + if ( size == 0 || oam.checkLogStatus("/tmp/amazon.log", "not found")) + { + // not running on amazon with ec2-api-tools + if (amazon_quick_install) + { + cout << "ERROR: Amazon Quick Installer was specified, bu the AMazon CLI API packages isnt installed, exiting" << endl; + exit(1); + } + amazonInstall = false; + } else { - if ( size == 0 || oam.checkLogStatus("/tmp/amazon.log", "not installed")) + if ( size == 0 || oam.checkLogStatus("/tmp/amazon.log", "not installed")) + { + // not running on amazon with ec2-api-tools + if (amazon_quick_install) + { + cout << "ERROR: Amazon Quick Installer was specified, bu the AMazon CLI API packages isnt installed, exiting" << endl; + exit(1); + } + amazonInstall = false; + } else amazonInstall = true; } @@ -1069,7 +1312,7 @@ int main(int argc, char *argv[]) amazonInstall = false; try { - sysConfig->setConfig(InstallSection, "Cloud", "disable"); + sysConfig->setConfig(InstallSection, "Cloud", "disable"); } catch(...) {}; @@ -1463,6 +1706,14 @@ int main(int argc, char *argv[]) catch(...) {} } + + if ( moduleType == "um") + if ( umNumber != 0 ) + moduleCount = umNumber; + + if ( moduleType == "pm") + if ( pmNumber != 0 ) + moduleCount = pmNumber; //verify and setup of modules count switch ( IserverTypeInstall ) { @@ -1519,6 +1770,7 @@ int main(int argc, char *argv[]) exit(1); continue; } + //update count try { string ModuleCountParm = "ModuleCount" + oam.itoa(i+1); @@ -1545,7 +1797,7 @@ int main(int argc, char *argv[]) //clear any Equipped Module IP addresses that aren't in current ID range for ( int j = 0 ; j < listSize ; j++ ) { - for ( unsigned int k = 1 ; k < MAX_NIC+1 ; k++) + for ( unsigned int k = 1 ; k < MaxNicID+1 ; k++) { string ModuleIPAddr = "ModuleIPAddr" + oam.itoa(j+1) + "-" + oam.itoa(k) + "-" + oam.itoa(i+1); if ( !(sysConfig->getConfig(ModuleSection, ModuleIPAddr).empty()) ) { @@ -1594,36 +1846,65 @@ int main(int argc, char *argv[]) moduleDisableState = oam::ENABLEDSTATE; //setup HostName/IPAddress for each NIC - for( unsigned int nicID=1 ; nicID < MAX_NIC+1 ; nicID++ ) + + string moduleHostName = oam::UnassignedName; + string moduleIPAddr = oam::UnassignedIpAddr; + + bool found = false; + if (multi_server_quick_install) { - string moduleHostName = oam::UnassignedName; - string moduleIPAddr = oam::UnassignedIpAddr; - - DeviceNetworkList::iterator listPT = sysModuleTypeConfig.moduletypeconfig[i].ModuleNetworkList.begin(); - for( ; listPT != sysModuleTypeConfig.moduletypeconfig[i].ModuleNetworkList.end() ; listPT++) + ModuleIpList::iterator pt2 = InputModuleIPList.begin(); + for( ; pt2 != InputModuleIPList.end() ; pt2++) { - if (newModuleName == (*listPT).DeviceName) { - if ( nicID == 1 ) { - moduleDisableState = (*listPT).DisableState; - if ( moduleDisableState.empty() || - moduleDisableState == oam::UnassignedName || - moduleDisableState == oam::AUTODISABLEDSTATE ) - moduleDisableState = oam::ENABLEDSTATE; - } - - HostConfigList::iterator pt1 = (*listPT).hostConfigList.begin(); - for( ; pt1 != (*listPT).hostConfigList.end() ; pt1++) + if ( (*pt2).moduleName == newModuleName ) + { + moduleHostName = (*pt2).IPaddress; + moduleIPAddr = (*pt2).IPaddress; + found = true; + break; + } + } + } + + unsigned int nicID=1; + for( ; nicID < MaxNicID +1 ; nicID++ ) + { + if ( !found ) + { + moduleHostName = oam::UnassignedName; + moduleIPAddr = oam::UnassignedIpAddr; + + DeviceNetworkList::iterator listPT = sysModuleTypeConfig.moduletypeconfig[i].ModuleNetworkList.begin(); + for( ; listPT != sysModuleTypeConfig.moduletypeconfig[i].ModuleNetworkList.end() ; listPT++) + { + if (newModuleName == (*listPT).DeviceName) { - if ((*pt1).NicID == nicID) { - moduleHostName = (*pt1).HostName; - moduleIPAddr = (*pt1).IPAddr; - break; + if ( nicID == 1 ) + { + moduleDisableState = (*listPT).DisableState; + if ( moduleDisableState.empty() || + moduleDisableState == oam::UnassignedName || + moduleDisableState == oam::AUTODISABLEDSTATE ) + moduleDisableState = oam::ENABLEDSTATE; + { + HostConfigList::iterator pt1 = (*listPT).hostConfigList.begin(); + for( ; pt1 != (*listPT).hostConfigList.end() ; pt1++) + { + if ((*pt1).NicID == nicID) + { + moduleHostName = (*pt1).HostName; + moduleIPAddr = (*pt1).IPAddr; + break; + } + } + } } } } } - - if ( nicID == 1 ) { + + if ( nicID == 1 ) + { if ( moduleDisableState != oam::ENABLEDSTATE ) { string disabled = "y"; while (true) @@ -1705,6 +1986,7 @@ int main(int argc, char *argv[]) break; } + bool moduleHostNameFound = true; if (moduleHostName.empty()) { moduleHostNameFound = true; @@ -1744,23 +2026,25 @@ int main(int argc, char *argv[]) //check if need to create instance or user enter ID string create = "y"; - while(true) + if ( !amazon_quick_install ) { - pcommand = callReadline("Create Instance for " + newModuleName + " [y,n] (y) > "); - if (pcommand) + while(true) { - if (strlen(pcommand) > 0) create = pcommand; - callFree(pcommand); + pcommand = callReadline("Create Instance for " + newModuleName + " [y,n] (y) > "); + if (pcommand) + { + if (strlen(pcommand) > 0) create = pcommand; + callFree(pcommand); + } + if ( create == "y" || create == "n" ) + break; + else + cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl; + create = "y"; + if ( noPrompting ) + exit(1); } - if ( create == "y" || create == "n" ) - break; - else - cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl; - create = "y"; - if ( noPrompting ) - exit(1); } - if ( create == "y" ) { ModuleIP moduleip; @@ -2313,28 +2597,35 @@ int main(int argc, char *argv[]) string dbrootList; - for ( unsigned int id = 1 ; id < count+1 ; ) + if (multi_server_quick_install || amazon_quick_install) { - string moduledbrootid = "ModuleDBRootID" + oam.itoa(moduleID) + "-" + oam.itoa(id) + "-" + oam.itoa(i+1); - try { - string dbrootid = sysConfig->getConfig(ModuleSection, moduledbrootid); + dbrootList = oam.itoa(moduleID); + } + else + { + for ( unsigned int id = 1 ; id < count+1 ; ) + { + string moduledbrootid = "ModuleDBRootID" + oam.itoa(moduleID) + "-" + oam.itoa(id) + "-" + oam.itoa(i+1); + try { + string dbrootid = sysConfig->getConfig(ModuleSection, moduledbrootid); - if ( dbrootid != oam::UnassignedName) { - sysConfig->setConfig(ModuleSection, moduledbrootid, oam::UnassignedName); + if ( dbrootid != oam::UnassignedName) { + sysConfig->setConfig(ModuleSection, moduledbrootid, oam::UnassignedName); - dbrootList = dbrootList + dbrootid; - id ++; - if ( id < count+1 ) - dbrootList = dbrootList + ","; + dbrootList = dbrootList + dbrootid; + id ++; + if ( id < count+1 ) + dbrootList = dbrootList + ","; + } + } + catch(...) + { + cout << "ERROR: Problem setting DBRoot ID in the MariaDB ColumnStore System Configuration file" << endl; + exit(1); } } - catch(...) - { - cout << "ERROR: Problem setting DBRoot ID in the MariaDB ColumnStore System Configuration file" << endl; - exit(1); - } } - + vector dbroots; string tempdbrootList; @@ -3417,12 +3708,25 @@ bool checkSaveConfigFile() //check if Columnstore.xml.rpmsave exist ifstream File (oldFileName.c_str()); if (!File) { + if (single_server_quick_install || multi_server_quick_install || amazon_quick_install) + { + return true; + } if ( noPrompting ) { cout << endl << "Old Config File not found '" + oldFileName + "', exiting" << endl; exit(1); } return true; } + else + { + if (single_server_quick_install || multi_server_quick_install || amazon_quick_install) + { + cout << endl << "Quick Install is for fresh installs only, '" + oldFileName + "' exist, exiting" << endl; + exit(1); + } + } + File.close(); // If 'oldFileName' isn't configured, exit @@ -4837,7 +5141,7 @@ bool storageSetup(bool amazonInstall) } -void setSystemName(bool single_server_quick_install) +void setSystemName() { Oam oam; //setup System Name @@ -4856,7 +5160,7 @@ void setSystemName(bool single_server_quick_install) if ( systemName.empty() ) systemName = "columnstore-1"; - if (!single_server_quick_install) + if (!single_server_quick_install || !multi_server_quick_install) { prompt = "Enter System Name (" + systemName + ") > "; pcommand = callReadline(prompt.c_str()); diff --git a/oamapps/postConfigure/quick_installer_amazon.sh b/oamapps/postConfigure/quick_installer_amazon.sh new file mode 100755 index 000000000..c71dc8920 --- /dev/null +++ b/oamapps/postConfigure/quick_installer_amazon.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# +# $Id: quick_installer_amazon.sh 3705 2018-07-07 19:47:20Z dhill $ +# +# Poddst- Quick Installer for Amazon MariaDB Columnstore + +pmCount="" +umCount="" +systemName="" + +for arg in "$@"; do + if [ `expr -- "$arg" : '--pm-count='` -eq 11 ]; then + pmCount="`echo $arg | awk -F= '{print $2}'`" + elif [ `expr -- "$arg" : '--um-count='` -eq 11 ]; then + umCount="`echo $arg | awk -F= '{print $2}'`" + elif [ `expr -- "$arg" : '--system-name='` -eq 14 ]; then + systemName="`echo $arg | awk -F= '{print $2}'`" + systemName="-sn "$systemName + elif [ `expr -- "$arg" : '--dist-install'` -eq 14 ]; then + nonDistrubutedInstall=" " + elif [ `expr -- "$arg" : '--help'` -eq 6 ]; then + echo "Usage ./quick_installer_amazon.sh [OPTION]" + echo "" + echo "Quick Installer for an Amazon MariaDB ColumnStore Install" + echo "This requires to be run on a MariaDB ColumnStore AMI" + echo "" + echo "Performace Module (pm) number is required" + echo "User Module (um) number is option" + echo "When only pm counts provided, system is combined setup" + echo "When both pm/um counts provided, system is seperate setup" + echo + echo "--pm-count=x Number of pm instances to create" + echo "--um-count=x Number of um instances to create, optional" + echo "--system-name=nnnn System Name, optional" + echo "" + exit 1 + else + echo "./quick_installer_amazon.sh: unknown argument: $arg, enter --help for help" 1>&2 + exit 1 + fi +done + +if [[ $pmCount = "" ]]; then + echo "" + echo "Performace Module (pm) count is required, exiting" + exit 1 +else + if [[ $umCount = "" ]]; then + echo "" + echo "NOTE: Performing a Multi-Server Combined install with um/pm running on some server" + echo"" + else + echo "" + echo "NOTE: Performing a Multi-Server Seperate install with um and pm running on seperate servers" + echo"" + fi +fi + +if [[ $HOME = "/root" ]]; then + echo "${bold}Run post-install script${normal}" + echo "" + /usr/local/mariadb/columnstore/bin/post-install + echo "${bold}Run postConfigure script${normal}" + echo "" + if [[ $umCount = "" ]]; then + /usr/local/mariadb/columnstore/bin/postConfigure -qa -pm-count $pmCount $systemName + else + /usr/local/mariadb/columnstore/bin/postConfigure -qa -pm-count $pmCount -um-count $umCount $systemName + fi +else + echo "${bold}Run post-install script${normal}" + echo "" + $HOME/mariadb/columnstore/bin/post-install --installdir=$HOME/mariadb/columnstore + echo "${bold}Run postConfigure script${normal}" + echo "" + if [[ $umCount = "" ]]; then + $HOME/mariadb/columnstore/bin/postConfigure -i $HOME/mariadb/columnstore -qa -pm-count $pmCount $systemName + else + $HOME/mariadb/columnstore/bin/postConfigure -i $HOME/mariadb/columnstore -qa -pm-count $pmCount -um-count $umCount $systemName + fi +fi diff --git a/oamapps/postConfigure/quick_installer_multi_server.sh b/oamapps/postConfigure/quick_installer_multi_server.sh new file mode 100755 index 000000000..25d615d7e --- /dev/null +++ b/oamapps/postConfigure/quick_installer_multi_server.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# +# $Id: quick_installer_multi_server.sh 3705 2018-07-07 19:47:20Z dhill $ +# +# Poddst- Quick Installer for Multi Server MariaDB Columnstore + +pmIpAddrs="" +umIpAddrs="" +nonDistrubutedInstall="-n" +systemName="" + +for arg in "$@"; do + if [ `expr -- "$arg" : '--pm-ip-addresses='` -eq 18 ]; then + pmIpAddrs="`echo $arg | awk -F= '{print $2}'`" + elif [ `expr -- "$arg" : '--um-ip-addresses='` -eq 18 ]; then + umIpAddrs="`echo $arg | awk -F= '{print $2}'`" + elif [ `expr -- "$arg" : '--system-name='` -eq 14 ]; then + systemName="`echo $arg | awk -F= '{print $2}'`" + systemName="-sn "$systemName + elif [ `expr -- "$arg" : '--dist-install'` -eq 14 ]; then + nonDistrubutedInstall=" " + elif [ `expr -- "$arg" : '--help'` -eq 6 ]; then + echo "Usage ./quick_installer_multi_server.sh [OPTION]" + echo "" + echo "Quick Installer for a Multi Server MariaDB ColumnStore Install" + echo "" + echo "Defaults to non-distrubuted install, meaning MariaDB Columnstore" + echo "needs to be preinstalled on all nodes in the system" + echo "" + echo "Performace Module (pm) IP addresses are required" + echo "User Module (um) IP addresses are option" + echo "When only pm IP addresses provided, system is combined setup" + echo "When both pm/um IP addresses provided, system is seperate setup" + echo + echo "--pm-ip-addresses=xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx" + echo "--um-ip-addresses=xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx, optional" + echo "--dist-install Use Distributed Install, optional" + echo "--system-name=nnnn System Name, optional" + echo "" + exit 1 + else + echo "quick_installer_multi_server.sh: unknown argument: $arg, enter --help for help" 1>&2 + exit 1 + fi +done + +if [[ $pmIpAddrs = "" ]]; then + echo "" + echo "Performace Module (pm) IP addresses required, exiting" + exit 1 +else + if [[ $umIpAddrs = "" ]]; then + echo "" + echo "NOTE: Performing a Multi-Server Combined install with um/pm running on some server" + echo"" + else + echo "" + echo "NOTE: Performing a Multi-Server Seperate install with um and pm running on seperate servers" + echo"" + fi +fi + +if [[ $HOME = "/root" ]]; then + echo "${bold}Run post-install script${normal}" + echo "" + /usr/local/mariadb/columnstore/bin/post-install + echo "${bold}Run postConfigure script${normal}" + echo "" + if [[ $umIpAddrs = "" ]]; then + /usr/local/mariadb/columnstore/bin/postConfigure -qm -pm-ip-addrs $pmIpAddrs $nonDistrubutedInstall $systemName + else + /usr/local/mariadb/columnstore/bin/postConfigure -qm -pm-ip-addrs $pmIpAddrs -um-ip-addrs $umIpAddrs $nonDistrubutedInstall $systemName + fi +else + echo "${bold}Run post-install script${normal}" + echo "" + $HOME/mariadb/columnstore/bin/post-install --installdir=$HOME/mariadb/columnstore + echo "${bold}Run postConfigure script${normal}" + echo "" + if [[ $umIpAddrs = "" ]]; then + $HOME/mariadb/columnstore/bin/postConfigure -i $HOME/mariadb/columnstore -qm -pm-ip-addrs $pmIpAddrs $nonDistrubutedInstall $systemName + else + $HOME/mariadb/columnstore/bin/postConfigure -i $HOME/mariadb/columnstore -qm -pm-ip-addrs $pmIpAddrs -um-ip-addrs $umIpAddrs $nonDistrubutedInstall $systemName + fi +fi diff --git a/oamapps/postConfigure/quick_installer_single_server.sh b/oamapps/postConfigure/quick_installer_single_server.sh old mode 100644 new mode 100755 index 3cf1dac50..2603bcec8 --- a/oamapps/postConfigure/quick_installer_single_server.sh +++ b/oamapps/postConfigure/quick_installer_single_server.sh @@ -4,6 +4,18 @@ # # Poddst- Quick Installer for Single Server MariaDB Columnstore +for arg in "$@"; do + if [ `expr -- "$arg" : '--help'` -eq 6 ]; then + echo "Usage ./quick_installer_multi_server.sh" + echo "" + echo "Quick Installer for a Single Server MariaDB ColumnStore Install" + echo "" + exit 1 + else + echo "quick_installer_multi_server.sh: ignoring unknown argument: $arg" 1>&2 + fi +done + if [ $HOME == "/root" ]; then echo "Run post-install script" @@ -18,5 +30,5 @@ else $HOME/mariadb/columnstore/bin/post-install --installdir=$HOME/mariadb/columnstore echo "Run postConfigure script" echo "" - $HOME/mariadb/columnstore/bin/postConfigure -i $HOME/mariadb/columnstore -sq + $HOME/mariadb/columnstore/bin/postConfigure -i $HOME/mariadb/columnstore -qs fi