From f4e3b7299d182f9d84db9a833cb1c7971a27ad5a Mon Sep 17 00:00:00 2001 From: david hill Date: Tue, 24 Jan 2017 09:15:01 -0600 Subject: [PATCH] commit from develop, MCOL-455, MCOL-527, AND MCOL-528 --- oam/etc/ConsoleCmds.xml | 5 +- oam/oamcpp/liboamcpp.cpp | 2 +- oamapps/postConfigure/postConfigure.cpp | 127 +++++++++++++----------- procmon/processmonitor.cpp | 86 +++++++++++++++- 4 files changed, 154 insertions(+), 66 deletions(-) diff --git a/oam/etc/ConsoleCmds.xml b/oam/etc/ConsoleCmds.xml index 1373a211c..01f6001cc 100644 --- a/oam/etc/ConsoleCmds.xml +++ b/oam/etc/ConsoleCmds.xml @@ -29,8 +29,9 @@ redistributeData Redistribute table data accross all dbroots to balance disk usage START to begin a redistribution - STOP to stop redistribution before completion - STATUS to to view statistics and progress + START REMOVE n to being a redistribution where data is removed from dbroot 'n' + STOP to stop redistribution before completion + STATUS to to view statistics and progress findObjectFile diff --git a/oam/oamcpp/liboamcpp.cpp b/oam/oamcpp/liboamcpp.cpp index 3d35f35b7..810aac264 100644 --- a/oam/oamcpp/liboamcpp.cpp +++ b/oam/oamcpp/liboamcpp.cpp @@ -5987,7 +5987,7 @@ namespace oam } //attach and format volumes - device = "/dev/sdf"; + device = "/dev/xvdf"; string localInstance = getEC2LocalInstance(); diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index 1679a07d1..1facf1a7c 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -666,64 +666,6 @@ int main(int argc, char *argv[]) exit(1); } - cout << "NOTE: The MariaDB ColumnStore Schema Sync feature will replicate all of the" << endl; - cout << " schemas and InnoDB tables across the User Module nodes. This feature can be enabled" << endl; - cout << " or disabled, for example, if you wish to configure your own replication post installation." << endl << endl; - - try { - MySQLRep = sysConfig->getConfig(InstallSection, "MySQLRep"); - } - catch(...) - {} - - if ( MySQLRep == "y" ) - mysqlRep = true; - - string answer = "y"; - - while(true) { - if ( mysqlRep ) - prompt = "MariaDB ColumnStore Schema Sync feature is Enabled, do you want to leave enabled? [y,n] (y) > "; - else - prompt = "MariaDB ColumnStore Schema Sync feature, do you want to enable? [y,n] (y) > "; - - pcommand = callReadline(prompt.c_str()); - if (pcommand) { - if (strlen(pcommand) > 0) answer = pcommand; - callFree(pcommand); - } - - if ( answer == "y" || answer == "n" ) { - cout << endl; - break; - } - else - cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl; - if ( noPrompting ) - exit(1); - } - - if ( answer == "y" ) { - mysqlRep = true; - MySQLRep = "y"; - } - else - { - mysqlRep = false; - MySQLRep = "n"; - } - - try { - sysConfig->setConfig(InstallSection, "MySQLRep", MySQLRep); - } - catch(...) - {} - - if ( !writeConfig(sysConfig) ) { - cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; - exit(1); - } - switch ( IserverTypeInstall ) { case (oam::INSTALL_COMBINE_DM_UM_PM): // combined #1 - dm/um/pm on a single server { @@ -813,6 +755,75 @@ int main(int argc, char *argv[]) break; } + // check for Schema Schema is Local Query wasnt selected + if (!pmwithum) + { + cout << "NOTE: The MariaDB ColumnStore Schema Sync feature will replicate all of the" << endl; + cout << " schemas and InnoDB tables across the User Module nodes. This feature can be enabled" << endl; + cout << " or disabled, for example, if you wish to configure your own replication post installation." << endl << endl; + + try { + MySQLRep = sysConfig->getConfig(InstallSection, "MySQLRep"); + } + catch(...) + {} + + if ( MySQLRep == "y" ) + mysqlRep = true; + + string answer = "y"; + + while(true) { + if ( mysqlRep ) + prompt = "MariaDB ColumnStore Schema Sync feature is Enabled, do you want to leave enabled? [y,n] (y) > "; + else + prompt = "MariaDB ColumnStore Schema Sync feature, do you want to enable? [y,n] (y) > "; + + pcommand = callReadline(prompt.c_str()); + if (pcommand) { + if (strlen(pcommand) > 0) answer = pcommand; + callFree(pcommand); + } + + if ( answer == "y" || answer == "n" ) { + cout << endl; + break; + } + else + cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl; + + if ( noPrompting ) + exit(1); + } + + if ( answer == "y" ) { + mysqlRep = true; + MySQLRep = "y"; + } + else + { + mysqlRep = false; + MySQLRep = "n"; + } + + try { + sysConfig->setConfig(InstallSection, "MySQLRep", MySQLRep); + } + catch(...) + {} + } + else + { //Schema Sync is default as on when Local Query is Selected + mysqlRep = true; + MySQLRep = "y"; + + try { + sysConfig->setConfig(InstallSection, "MySQLRep", MySQLRep); + } + catch(...) + {} + } + if ( !writeConfig(sysConfig) ) { cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; exit(1); diff --git a/procmon/processmonitor.cpp b/procmon/processmonitor.cpp index 56fa5ac33..e474c69d5 100644 --- a/procmon/processmonitor.cpp +++ b/procmon/processmonitor.cpp @@ -5271,6 +5271,8 @@ int ProcessMonitor::runMasterDist(std::string& password, std::string& slaveModul string cmd = startup::StartUp::installDir() + "/bin/rsync.sh " + ipAddr + " " + password + " " + startup::StartUp::installDir() + " 1 > /tmp/master-dist_" + slaveModule + ".log"; system(cmd.c_str()); + + log.writeLog(__LINE__, "cmd = " + cmd, LOG_TYPE_DEBUG); string logFile = "/tmp/master-dist_" + slaveModule + ".log"; if (!oam.checkLogStatus(logFile, "FAILED")) @@ -5501,12 +5503,49 @@ bool ProcessMonitor::amazonVolumeCheck(int dbrootID) string status = oam.getEC2VolumeStatus(volumeName); if ( status == "attached" ) { - string cmd = "mount " + deviceName + " " + startup::StartUp::installDir() + "/mysql/db -t ext2 -o defaults > /dev/null"; + string cmd; + if ( rootUser) + cmd = "mount " + deviceName + " " + startup::StartUp::installDir() + "/mysql/db -t ext2 -o noatime,nodiratime,noauto > /tmp/um_mount.log"; + else + cmd = "sudo mount " + deviceName + " " + startup::StartUp::installDir() + "/mysql/db -t ext2 -o noatime,nodiratime,noauto,user > /tmp/um_mount.log"; + system(cmd.c_str()); log.writeLog(__LINE__, "mount cmd: " + cmd, LOG_TYPE_DEBUG); - cmd = "chown mysql:mysql -R " + startup::StartUp::installDir() + "/mysql/db"; + if ( rootUser) + cmd = "chown -R mysql:mysql " + startup::StartUp::installDir() + "/mysql/db"; + else + cmd = "sudo chown -R " + USER + ":" + USER + " " + startup::StartUp::installDir() + "/mysql/db"; + system(cmd.c_str()); + log.writeLog(__LINE__, "chown cmd: " + cmd, LOG_TYPE_DEBUG); + + //check for setup files in mysq/db, if not, create them for a new install + string file = startup::StartUp::installDir() + "/mysql/db/mysql"; + ifstream new_file (file.c_str()); + if (!new_file) { + string cmd; + cmd = startup::StartUp::installDir() + "/bin/post-mysqld-install --installdir=" + startup::StartUp::installDir() + " > /tmp/post-mysqld-install.log 2>&1"; + log.writeLog(__LINE__, "cmd: " + cmd, LOG_TYPE_DEBUG); + + int rtnCode = system(cmd.c_str()); + if (WEXITSTATUS(rtnCode) != 0) { + log.writeLog(__LINE__, "amazonVolumeCheck function failed, post-mysqld-install error" , LOG_TYPE_ERROR); + return false; + } + else + log.writeLog(__LINE__, "amazonVolumeCheck function, post-mysqld-install passed" , LOG_TYPE_DEBUG); + + cmd = startup::StartUp::installDir() + "/bin/post-mysql-install --installdir=" + startup::StartUp::installDir() + " > /tmp/post-mysql-install.log";; + log.writeLog(__LINE__, "cmd: " + cmd, LOG_TYPE_DEBUG); + rtnCode = system(cmd.c_str()); + if (WEXITSTATUS(rtnCode) != 0) { + log.writeLog(__LINE__, "amazonVolumeCheck function failed, post-mysql-install error" , LOG_TYPE_ERROR); + return false; + } + else + log.writeLog(__LINE__, "amazonVolumeCheck function, post-mysql-install passed" , LOG_TYPE_DEBUG); + } log.writeLog(__LINE__, "amazonVolumeCheck function successfully completed, volume attached: " + volumeName, LOG_TYPE_DEBUG); return true; @@ -5531,12 +5570,49 @@ bool ProcessMonitor::amazonVolumeCheck(int dbrootID) {} if (oam.attachEC2Volume(volumeName, deviceName, instanceName)) { - string cmd = "mount " + deviceName + " " + startup::StartUp::installDir() + "/mysql/db -t ext2 -o defaults > /dev/null"; + string cmd; + if ( rootUser) + cmd = "mount " + deviceName + " " + startup::StartUp::installDir() + "/mysql/db -t ext2 -o noatime,nodiratime,noauto > /tmp/um_mount.log"; + else + cmd = "sudo mount " + deviceName + " " + startup::StartUp::installDir() + "/mysql/db -t ext2 -o noatime,nodiratime,noauto,user > /tmp/um_mount.log"; + system(cmd.c_str()); log.writeLog(__LINE__, "mount cmd: " + cmd, LOG_TYPE_DEBUG); - cmd = "chown mysql:mysql -R " + startup::StartUp::installDir() + "/mysql/db"; + if ( rootUser) + cmd = "chown -R mysql:mysql " + startup::StartUp::installDir() + "/mysql/db"; + else + cmd = "sudo chown -R " + USER + ":" + USER + " " + startup::StartUp::installDir() + "/mysql/db"; + system(cmd.c_str()); + log.writeLog(__LINE__, "chown cmd: " + cmd, LOG_TYPE_DEBUG); + + //check for setup files in mysq/db, if not, create them for a new install + string file = startup::StartUp::installDir() + "/mysql/db/mysql"; + ifstream new_file (file.c_str()); + if (!new_file) { + string cmd; + cmd = startup::StartUp::installDir() + "/bin/post-mysqld-install --installdir=" + startup::StartUp::installDir() + " > /tmp/post-mysqld-install.log 2>&1"; + log.writeLog(__LINE__, "cmd: " + cmd, LOG_TYPE_DEBUG); + int rtnCode = system(cmd.c_str()); + if (WEXITSTATUS(rtnCode) != 0) { + log.writeLog(__LINE__, "amazonVolumeCheck function failed, post-mysqld-install error" , LOG_TYPE_ERROR); + return false; + } + else + log.writeLog(__LINE__, "amazonVolumeCheck function, post-mysqld-install passed" , LOG_TYPE_DEBUG); + + cmd = startup::StartUp::installDir() + "/bin/post-mysql-install --installdir=" + startup::StartUp::installDir() + " > /tmp/post-mysql-install.log";; + log.writeLog(__LINE__, "cmd: " + cmd, LOG_TYPE_DEBUG); + + rtnCode = system(cmd.c_str()); + if (WEXITSTATUS(rtnCode) != 0) { + log.writeLog(__LINE__, "amazonVolumeCheck function failed, post-mysql-install error" , LOG_TYPE_ERROR); + return false; + } + else + log.writeLog(__LINE__, "amazonVolumeCheck function, post-mysql-install passed" , LOG_TYPE_DEBUG); + } return true; } @@ -5809,7 +5885,7 @@ int ProcessMonitor::checkDataMount() string fileName = dbroot + "/OAMdbrootCheck"; ofstream fout(fileName.c_str()); if (!fout) { - log.writeLog(__LINE__, "ERROR: Failed test write to DBRoot: " + dbroot + " " + strerror(errno), LOG_TYPE_ERROR); + log.writeLog(__LINE__, "ERROR: Failed test write to DBRoot: " + dbroot, LOG_TYPE_ERROR); return API_FAILURE; }