1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-06-06 08:21:01 +03:00

MCOL-916: Fix for failovers when dbroots cannot be simply swapped between standby and parent modules. MCOL-913: Prevent distribute config file logging errors. MCOL-915 Improve mcsadmin output for removeModule command when using DataRedundancy. MCOL-928: fix for postConfigure not detecting gluster is installed in Debain9.1.

This commit is contained in:
Ben Thompson 2017-10-13 17:12:52 -05:00
parent cad14d2111
commit 5e367098a9
4 changed files with 483 additions and 437 deletions

View File

@ -4933,7 +4933,7 @@ namespace oam
{ {
//give time for ProcMon/ProcMgr to get fully active on new pm //give time for ProcMon/ProcMgr to get fully active on new pm
sleep(10); sleep(10);
// build and send msg to restart system // build and send msg to restart system
returnStatus = sendMsgToProcMgr(RESTARTSYSTEM, "", FORCEFUL, ACK_YES); returnStatus = sendMsgToProcMgr(RESTARTSYSTEM, "", FORCEFUL, ACK_YES);
@ -5652,6 +5652,46 @@ namespace oam
{ {
writeLog("FAILURE: Error assigning gluster dbroot# " + itoa(dbrootID), LOG_TYPE_ERROR ); writeLog("FAILURE: Error assigning gluster dbroot# " + itoa(dbrootID), LOG_TYPE_ERROR );
} }
// check if a copy is available when residePM returns
string pmList = "";
try {
string errmsg;
int ret = glusterctl(oam::GLUSTER_WHOHAS, itoa(subDBRootID), pmList, errmsg);
if ( ret != 0 )
{
writeLog("ERROR: glusterctl failure getting pm list for dbroot " + itoa(subDBRootID) + " , error: " + errmsg, LOG_TYPE_ERROR );
exceptionControl("autoMovePmDbroot", API_INVALID_PARAMETER);
}
}
catch (exception& )
{
writeLog("ERROR: glusterctl failure getting pm list for dbroot " + itoa(subDBRootID), LOG_TYPE_ERROR );
exceptionControl("autoMovePmDbroot", API_INVALID_PARAMETER);
}
catch (...)
{
writeLog("ERROR: glusterctl failure getting pm list for dbroot " + itoa(subDBRootID), LOG_TYPE_ERROR );
exceptionControl("autoMovePmDbroot", API_INVALID_PARAMETER);
}
bool found = false;
boost::char_separator<char> sep(" ");
boost::tokenizer< boost::char_separator<char> > tokens(pmList, sep);
for ( boost::tokenizer< boost::char_separator<char> >::iterator it = tokens.begin();
it != tokens.end();
++it)
{
if ( atoi((*it).c_str()) == residePMID )
{
// found it and can assign the subDBRoot back to residedPM no switch back is needed
found = true;
}
}
// We will go back to this PM
if (!found)
{
subDBRootID = dbrootID;
}
} }
//store in move dbroot transaction file //store in move dbroot transaction file
@ -6632,7 +6672,7 @@ namespace oam
{ {
getPmDbrootConfig(atoi(residePMID.c_str()), residedbrootConfigList); getPmDbrootConfig(atoi(residePMID.c_str()), residedbrootConfigList);
cout << "DBRoot IDs assigned to '" + residePM + "' = "; cout << endl << "DBRoot IDs assigned to '" + residePM + "' = ";
DBRootConfigList::iterator pt = residedbrootConfigList.begin(); DBRootConfigList::iterator pt = residedbrootConfigList.begin();
for( ; pt != residedbrootConfigList.end() ;) for( ; pt != residedbrootConfigList.end() ;)
@ -6650,7 +6690,7 @@ namespace oam
exceptionControl("unassignPmDbrootConfig", API_FAILURE); exceptionControl("unassignPmDbrootConfig", API_FAILURE);
} }
cout << endl << "Changes being applied" << endl << endl; cout << "Changes being applied..." << endl;
//remove entered dbroot IDs from reside PM list //remove entered dbroot IDs from reside PM list
DBRootConfigList::iterator pt1 = dbrootlist.begin(); DBRootConfigList::iterator pt1 = dbrootlist.begin();
@ -6700,6 +6740,7 @@ namespace oam
detachEC2Volume(volumeName); detachEC2Volume(volumeName);
residedbrootConfigList.erase(pt2); residedbrootConfigList.erase(pt2);
cout << "DBRoot IDs unassigned from '" + residePM + "' = " + itoa(*pt1) << endl;
break; break;
} }
@ -6732,7 +6773,7 @@ namespace oam
if (pt != residedbrootConfigList.end()) if (pt != residedbrootConfigList.end())
cout << ", "; cout << ", ";
} }
cout << endl; cout << endl << endl;
} }
catch (exception& e) catch (exception& e)
{ {

View File

@ -2778,131 +2778,407 @@ int main(int argc, char *argv[])
//skip interface with remote servers and perform install //skip interface with remote servers and perform install
if ( !nonDistribute ) if ( !nonDistribute )
{ {
// //
// perform remote install of other servers in the system // perform remote install of other servers in the system
// //
cout << endl << "===== System Installation =====" << endl << endl; cout << endl << "===== System Installation =====" << endl << endl;
cout << "System Configuration is complete, System Installation is the next step." << endl;
cout << "System Configuration is complete, System Installation is the next step." << endl; while(true)
while(true)
{
pcommand = callReadline("Would you like to continue with the System Installation? [y,n] (y) > ");
if (pcommand)
{ {
if (strlen(pcommand) > 0) install = pcommand; pcommand = callReadline("Would you like to continue with the System Installation? [y,n] (y) > ");
callFree(pcommand); if (pcommand)
}
if ( install == "y" || install == "n" )
break;
else
cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl;
install = "y";
if ( noPrompting )
exit(1);
}
if ( install == "y" ) {
SystemSoftware systemsoftware;
try
{
oam.getSystemSoftware(systemsoftware);
}
catch (exception& e)
{
cout << " ERROR: reading getSystemSoftware API" << endl;
exit (1);
}
cout << endl;
string version = systemsoftware.Version + "-" + systemsoftware.Release;
string installType = "initial";
if ( EEPackageType == "rpm" )
{
cout << "Performing a MariaDB ColumnStore System install using RPM packages" << endl;
cout << "located in the " + HOME + " directory." << endl << endl;
}
else
{
if ( EEPackageType == "binary" )
{ {
cout << "Performing a MariaDB ColumnStore System install using a Binary package" << endl; if (strlen(pcommand) > 0) install = pcommand;
callFree(pcommand);
}
if ( install == "y" || install == "n" )
break;
else
cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl;
install = "y";
if ( noPrompting )
exit(1);
}
if ( install == "y" )
{
SystemSoftware systemsoftware;
try
{
oam.getSystemSoftware(systemsoftware);
}
catch (exception& e)
{
cout << " ERROR: reading getSystemSoftware API" << endl;
exit (1);
}
cout << endl;
string version = systemsoftware.Version + "-" + systemsoftware.Release;
string installType = "initial";
if ( EEPackageType == "rpm" )
{
cout << "Performing a MariaDB ColumnStore System install using RPM packages" << endl;
cout << "located in the " + HOME + " directory." << endl << endl; cout << "located in the " + HOME + " directory." << endl << endl;
} }
else else
{ {
cout << "Performing a MariaDB ColumnStore System install using using DEB packages" << endl; if ( EEPackageType == "binary" )
cout << "located in the " + HOME + " directory." << endl; {
cout << "Performing a MariaDB ColumnStore System install using a Binary package" << endl;
cout << "located in the " + HOME + " directory." << endl << endl;
}
else
{
cout << "Performing a MariaDB ColumnStore System install using using DEB packages" << endl;
cout << "located in the " + HOME + " directory." << endl;
}
} }
}
//check if pkgs are located in $HOME directory
//check if pkgs are located in $HOME directory if ( EEPackageType == "rpm")
if ( EEPackageType == "rpm") columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.rpm";
columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.rpm";
else
if ( EEPackageType == "deb")
columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.deb";
else else
columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.bin.tar.gz"; if ( EEPackageType == "deb")
columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.deb";
else
columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.bin.tar.gz";
if( !pkgCheck(columnstorePackage) ) if( !pkgCheck(columnstorePackage) )
exit(1); exit(1);
if ( password.empty() )
{
cout << endl;
cout << "Next step is to enter the password to access the other Servers." << endl;
cout << "This is either your password or you can default to using a ssh key" << endl;
cout << "If using a password, the password needs to be the same on all Servers." << endl << endl;
}
while(true) if ( password.empty() )
{ {
char *pass1, *pass2; cout << endl;
cout << "Next step is to enter the password to access the other Servers." << endl;
cout << "This is either your password or you can default to using a ssh key" << endl;
cout << "If using a password, the password needs to be the same on all Servers." << endl << endl;
}
if ( noPrompting ) { while(true)
cout << "Enter password, hit 'enter' to default to using a ssh key, or 'exit' > " << endl; {
if ( password.empty() ) char *pass1, *pass2;
if ( noPrompting ) {
cout << "Enter password, hit 'enter' to default to using a ssh key, or 'exit' > " << endl;
if ( password.empty() )
password = "ssh";
break;
}
//check for command line option password
if ( !password.empty() )
break;
pass1=getpass("Enter password, hit 'enter' to default to using a ssh key, or 'exit' > ");
if ( strcmp(pass1, "") == 0 ) {
password = "ssh"; password = "ssh";
break; break;
}
if ( pass1 == "exit")
exit(0);
string p1 = pass1;
pass2=getpass("Confirm password > ");
string p2 = pass2;
if ( p1 == p2 ) {
password = p2;
break;
}
else
cout << "Password mismatch, please re-enter" << endl;
} }
//check for command line option password //add single quote for special characters
if ( !password.empty() ) if ( password != "ssh" )
break; {
password = "'" + password + "'";
}
checkSystemMySQLPort(mysqlPort, sysConfig, USER, password, childmodulelist, IserverTypeInstall, pmwithum);
pass1=getpass("Enter password, hit 'enter' to default to using a ssh key, or 'exit' > "); if ( ( IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM ) ||
if ( strcmp(pass1, "") == 0 ) { ( (IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM) && pmwithum ) )
password = "ssh"; {
break; cout << endl << "===== Running the MariaDB ColumnStore MariaDB ColumnStore setup scripts =====" << endl << endl;
// call the mysql setup scripts
mysqlSetup();
sleep(5);
} }
if ( pass1 == "exit") string AmazonInstall = "0";
exit(0); if ( amazonInstall )
AmazonInstall = "1";
string p1 = pass1; ChildModuleList::iterator list1 = childmodulelist.begin();
pass2=getpass("Confirm password > "); for (; list1 != childmodulelist.end() ; list1++)
string p2 = pass2; {
if ( p1 == p2 ) { string remoteModuleName = (*list1).moduleName;
password = p2; string remoteModuleIP = (*list1).moduleIP;
break; string remoteHostName = (*list1).hostName;
string remoteModuleType = remoteModuleName.substr(0,MAX_MODULE_TYPE_SIZE);
string debug_logfile;
string logfile;
if ( remote_installer_debug == "1" ) {
logfile = "/tmp/";
logfile += remoteModuleName + "_" + EEPackageType + "_install.log";
debug_logfile = " > " + logfile;
}
if ( remoteModuleType == "um" ||
(remoteModuleType == "pm" && IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM) ||
(remoteModuleType == "pm" && pmwithum) )
{
cout << endl << "----- Performing Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl;
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/package_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + AmazonInstall + " " + 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 package_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 + " " + installType + " " + AmazonInstall + " " + 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 package_installer.sh" << endl;
exit(1);
}
}
}
}
else
{
if ( (remoteModuleType == "pm" && IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM) ||
(remoteModuleType == "pm" && !pmwithum ) )
{
cout << endl << "----- Performing Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl;
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/package_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + AmazonInstall + " " + 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 package_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 + " " + installType + " " + AmazonInstall + " " +
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 package_installer.sh" << endl;
exit(1);
}
}
}
}
}
}
if ( thread_remote_installer ) {
//wait until remove install Thread Count is at zero or hit timeout
cout << endl << "MariaDB ColumnStore Package being installed, please wait ...";
cout.flush();
/* block until all threads complete */
for (thread_id = 0; thread_id < (int) childmodulelist.size(); ++thread_id) {
pthread_join(thr[thread_id], NULL);
}
cout << " DONE" << endl;
} }
else
cout << "Password mismatch, please re-enter" << endl;
} }
else
//add single quote for special characters
if ( password != "ssh" )
{ {
password = "'" + password + "'"; if (DataRedundancy && install != "y")
{
cout << endl << "Must choose to install with DataRedundancy configured." << endl;
exit(1);
}
} }
}
checkSystemMySQLPort(mysqlPort, sysConfig, USER, password, childmodulelist, IserverTypeInstall, pmwithum); else
{
if ( ( IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM ) || if ( ( IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM ) ||
( (IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM) && pmwithum ) ) ( (IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM) && pmwithum ) )
{ {
@ -2912,311 +3188,24 @@ int main(int argc, char *argv[])
mysqlSetup(); mysqlSetup();
sleep(5); sleep(5);
} }
string AmazonInstall = "0";
if ( amazonInstall )
AmazonInstall = "1";
ChildModuleList::iterator list1 = childmodulelist.begin();
for (; list1 != childmodulelist.end() ; list1++)
{
string remoteModuleName = (*list1).moduleName;
string remoteModuleIP = (*list1).moduleIP;
string remoteHostName = (*list1).hostName;
string remoteModuleType = remoteModuleName.substr(0,MAX_MODULE_TYPE_SIZE);
string debug_logfile;
string logfile;
if ( remote_installer_debug == "1" ) {
logfile = "/tmp/";
logfile += remoteModuleName + "_" + EEPackageType + "_install.log";
debug_logfile = " > " + logfile;
}
if ( remoteModuleType == "um" ||
(remoteModuleType == "pm" && IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM) ||
(remoteModuleType == "pm" && pmwithum) )
{
cout << endl << "----- Performing Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl;
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/package_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + AmazonInstall + " " + 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 package_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 + " " + installType + " " + AmazonInstall + " " + 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 package_installer.sh" << endl;
exit(1);
}
}
}
}
else
{
if ( (remoteModuleType == "pm" && IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM) ||
(remoteModuleType == "pm" && !pmwithum ) )
{
cout << endl << "----- Performing Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl;
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/package_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + AmazonInstall + " " + 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 package_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 + " " + installType + " " + AmazonInstall + " " +
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 package_installer.sh" << endl;
exit(1);
}
}
}
}
}
}
if ( thread_remote_installer ) {
//wait until remove install Thread Count is at zero or hit timeout
cout << endl << "MariaDB ColumnStore Package being installed, please wait ...";
cout.flush();
/* block until all threads complete */
for (thread_id = 0; thread_id < (int) childmodulelist.size(); ++thread_id) {
pthread_join(thr[thread_id], NULL);
}
cout << " DONE" << endl;
}
}
} }
else
{ //configure data redundancy
if ( ( IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM ) || if (DataRedundancy)
( (IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM) && pmwithum ) )
{ {
cout << endl << "===== Running the MariaDB ColumnStore MariaDB ColumnStore setup scripts =====" << endl << endl; cout << endl;
if ( reuseConfig != "y" ) {
cout << endl << "===== Configuring MariaDB ColumnStore Data Redundancy Functionality =====" << endl << endl;
if (!glusterSetup(password))
{
cout << "ERROR: Problem setting up ColumnStore Data Redundancy" << endl;
exit(1);
}
// call the mysql setup scripts }
mysqlSetup();
sleep(5);
} }
}
} }
//configure data redundancy
if (DataRedundancy )
{
cout << endl;
string start = "y";
if ( reuseConfig == "y" )
start = "n";
/*
while(true)
{
pcommand = callReadline("Would you like to configure MariaDB ColumnStore Data Redundancy? [y,n] (" + start + ") > ");
if (pcommand)
{
if (strlen(pcommand) > 0) start = pcommand;
callFree(pcommand);
}
if ( start == "y" || start == "n" )
break;
else
cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl;
start = "y";
if ( noPrompting )
exit(1);
}
*/
if ( start == "y" ) {
cout << endl << "===== Configuring MariaDB ColumnStore Data Redundancy Functionality =====" << endl << endl;
if (!glusterSetup(password))
{
cout << "ERROR: Problem setting up ColumnStore Data Redundancy" << endl;
exit(1);
}
}
}
if ( !writeConfig(sysConfig) ) { if ( !writeConfig(sysConfig) ) {
cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl;
@ -4442,7 +4431,12 @@ bool storageSetup(bool amazonInstall)
} }
//check if gluster is installed //check if gluster is installed
int rtnCode = system("gluster --version > /tmp/gluster.log 2>&1"); int rtnCode = 1;
if (rootUser)
rtnCode = system("gluster --version > /tmp/gluster.log 2>&1");
else
rtnCode = system("sudo gluster --version > /tmp/gluster.log 2>&1");
if (rtnCode == 0) if (rtnCode == 0)
{ {
glusterInstalled = "y"; glusterInstalled = "y";
@ -5817,19 +5811,11 @@ bool glusterSetup(string password) {
{ {
for ( int brick=1; brick<=numberBricksPM; brick++) for ( int brick=1; brick<=numberBricksPM; brick++)
{ {
// create the gluster brick directories now command = remoteCommand + DataRedundancyConfigs[pm].pmIpAddr + " " + password + " 'mkdir -p " + installDir + "/gluster/brick" + oam.itoa(brick) + "'";
//if (rootUser)
//{
command = remoteCommand + DataRedundancyConfigs[pm].pmIpAddr + " " + password + " 'mkdir -p " + installDir + "/gluster/brick" + oam.itoa(brick) + "'";
//}
//else
//{
// command = remoteCommand + DataRedundancyConfigs[pm].pmIpAddr + " " + password + " 'sudo mkdir -p " + installDir + "/gluster/brick" + oam.itoa(brick) + "'";
//}
status = system(command.c_str()); status = system(command.c_str());
if (WEXITSTATUS(status) != 0 ) if (WEXITSTATUS(status) != 0 )
{ {
cout << "ERROR: failed to make directory(" << DataRedundancyConfigs[pm].pmIpAddr << "): 'mkdir -p " << installDir << "/gluster/brick" << oam.itoa(brick) << "'" << endl; cout << "ERROR: failed to make directory(" << DataRedundancyConfigs[pm].pmIpAddr << "): '" << command << "'" << endl;
exit(1); exit(1);
} }
/* /*

View File

@ -1392,6 +1392,7 @@ void pingDeviceThread()
oam.sendDeviceNotification(config.moduleName(), MODULE_UP); oam.sendDeviceNotification(config.moduleName(), MODULE_UP);
int status; int status;
DBRootConfigList dbrootConfigList;
// if shared pm, move dbroots back to pm // if shared pm, move dbroots back to pm
if ( ( moduleName.find("pm") == 0 && !amazon && ( DBRootStorageType != "internal") ) || if ( ( moduleName.find("pm") == 0 && !amazon && ( DBRootStorageType != "internal") ) ||
@ -1414,7 +1415,6 @@ void pingDeviceThread()
//check if any dbroots got assigned back to this module //check if any dbroots got assigned back to this module
// they could not be moved if there were busy on other pms // they could not be moved if there were busy on other pms
DBRootConfigList dbrootConfigList;
try try
{ {
int moduleID = atoi(moduleName.substr(MAX_MODULE_TYPE_SIZE,MAX_MODULE_ID_SIZE).c_str()); int moduleID = atoi(moduleName.substr(MAX_MODULE_TYPE_SIZE,MAX_MODULE_ID_SIZE).c_str());
@ -1454,7 +1454,7 @@ void pingDeviceThread()
{} {}
log.writeLog(__LINE__, "autoUnMovePmDbroot success", LOG_TYPE_DEBUG); log.writeLog(__LINE__, "autoUnMovePmDbroot success", LOG_TYPE_DEBUG);
//distribute config file //distribute config file
processManager.distributeConfigFile("system"); processManager.distributeConfigFile("system");
@ -1590,6 +1590,15 @@ void pingDeviceThread()
if ( moduleName.substr(0,MAX_MODULE_TYPE_SIZE) == "pm" ) if ( moduleName.substr(0,MAX_MODULE_TYPE_SIZE) == "pm" )
processManager.setStandbyModule(moduleName); processManager.setStandbyModule(moduleName);
} }
DBRootConfigList::iterator pt = dbrootConfigList.begin();
if (( DBRootStorageType == "DataRedundancy") && (*pt == 1))
{
log.writeLog(__LINE__, "stopModule, " + config.moduleName(), LOG_TYPE_DEBUG);
processManager.stopModule(config.moduleName(), oam::FORCEFUL, false);
processManager.switchParentOAMModule(moduleName);
processManager.stopProcess(config.moduleName(), "ProcessManager", oam::FORCEFUL, true);
break;
}
} }
else { else {
//stop failed, retry //stop failed, retry

View File

@ -8307,7 +8307,7 @@ int ProcessManager::distributeConfigFile(std::string name, std::string file)
} }
catch(...) catch(...)
{} {}
if (opState == oam::AUTO_DISABLED) if (opState == oam::AUTO_DISABLED)
continue; continue;
@ -8321,7 +8321,7 @@ int ProcessManager::distributeConfigFile(std::string name, std::string file)
else else
{ {
//log the error event //log the error event
log.writeLog(__LINE__, (*pt).DeviceName + " distributeConfigFile failed!!", LOG_TYPE_ERROR); log.writeLog(__LINE__, (*pt).DeviceName + " distributeConfigFile failed!!", LOG_TYPE_DEBUG);
} }
} }
} }
@ -8338,7 +8338,7 @@ int ProcessManager::distributeConfigFile(std::string name, std::string file)
else else
{ {
//log the error event //log the error event
log.writeLog(__LINE__, name + " distributeConfigFile failed!!", LOG_TYPE_ERROR); log.writeLog(__LINE__, name + " distributeConfigFile failed!!", LOG_TYPE_DEBUG);
} }
} }
@ -8653,21 +8653,29 @@ int ProcessManager::switchParentOAMModule(std::string newActiveModuleName)
//move a newparent dbroot to old parent for balancing //move a newparent dbroot to old parent for balancing
DBRootConfigList residedbrootConfigList; DBRootConfigList residedbrootConfigList;
bool doDBRootMove = true;
try try
{ {
oam.getPmDbrootConfig(moduleID, residedbrootConfigList); oam.getPmDbrootConfig(moduleID, residedbrootConfigList);
if ( residedbrootConfigList.size() > 0 ) if ( residedbrootConfigList.size() > 0 )
{ {
DBRootConfigList::iterator pt = residedbrootConfigList.begin(); DBRootConfigList::iterator pt = residedbrootConfigList.begin();
try { if (*pt != 1)
oam.manualMovePmDbroot(newActiveModuleName, oam.itoa(*pt), config.OAMParentName());
}
catch (...)
{ {
log.writeLog(__LINE__, "ERROR: manualMovePmDbroot Failed", LOG_TYPE_ERROR); try {
pthread_mutex_unlock(&THREAD_LOCK); oam.manualMovePmDbroot(newActiveModuleName, oam.itoa(*pt), config.OAMParentName());
return API_FAILURE; }
catch (...)
{
log.writeLog(__LINE__, "ERROR: manualMovePmDbroot Failed", LOG_TYPE_ERROR);
pthread_mutex_unlock(&THREAD_LOCK);
return API_FAILURE;
}
}
else
{
doDBRootMove = false;
} }
} }
} }
@ -8679,16 +8687,18 @@ int ProcessManager::switchParentOAMModule(std::string newActiveModuleName)
} }
//move dbroot #1 to new parent //move dbroot #1 to new parent
try { if (doDBRootMove)
oam.manualMovePmDbroot(config.OAMParentName(), "1", newActiveModuleName);
}
catch (...)
{ {
log.writeLog(__LINE__, "ERROR: manualMovePmDbroot Failed", LOG_TYPE_ERROR); try {
pthread_mutex_unlock(&THREAD_LOCK); oam.manualMovePmDbroot(config.OAMParentName(), "1", newActiveModuleName);
return API_FAILURE; }
catch (...)
{
log.writeLog(__LINE__, "ERROR: manualMovePmDbroot Failed", LOG_TYPE_ERROR);
pthread_mutex_unlock(&THREAD_LOCK);
return API_FAILURE;
}
} }
Config* sysConfig4 = Config::makeConfig(); Config* sysConfig4 = Config::makeConfig();
// get new Active address // get new Active address