1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00
This commit is contained in:
david hill
2017-06-21 16:21:59 -05:00
parent 98a9a09f67
commit 743fec5c5e
11 changed files with 268 additions and 85 deletions

View File

@ -104,21 +104,6 @@ if [ $module = "pm" ]; then
done
fi
echo "Setup rc.local on Module"
if [ $EUID -eq 0 -a -f $COLUMNSTORE_INSTALL_DIR/local/rc.local.columnstore ]; then
if [ $user = "root" ]; then
touch /etc/rc.local
rm -f /etc/rc.local.columnstoreSave
cp /etc/rc.local /etc/rc.local.columnstoreSave
cat $COLUMNSTORE_INSTALL_DIR/local/rc.local.columnstore >> /etc/rc.local
else
sudo touch /etc/rc.local
sudo rm -f /etc/rc.local.columnstoreSave
sudo cp /etc/rc.local /etc/rc.local.columnstoreSave
sudo cat $COLUMNSTORE_INSTALL_DIR/local/rc.local.columnstore >> /etc/rc.local
fi
fi
plugin=`$COLUMNSTORE_INSTALL_DIR/bin/getConfig SystemConfig DataFilePlugin`
if [ -n "$plugin" ]; then
echo "Setup .bashrc on Module for local-query"

View File

@ -50,14 +50,6 @@ else
$SUDO rm -f /etc/exports > /dev/null 2>&1
fi
if test -f /etc/rc.d/rc.local.columnstoreSave ; then
$SUDO mv -f /etc/rc.d/rc.local.columnstoreSave /etc/rc.d/rc.local > /dev/null 2>&1
fi
if test -f /etc/rc.local.columnstoreSave ; then
$SUDO mv -f /etc/rc.local.columnstoreSave /etc/rc.local > /dev/null 2>&1
fi
export COLUMNSTORE_INSTALL_DIR=$installdir
cloud=`$COLUMNSTORE_INSTALL_DIR/bin/getConfig Installation Cloud`

View File

@ -2771,6 +2771,8 @@ namespace oam
// Get Server Type Install ID
serverTypeInstall = atoi(sysConfig->getConfig("Installation", "ServerTypeInstall").c_str());
sysConfig;
}
catch (...) {}

View File

@ -519,7 +519,7 @@ namespace oam
DISABLEMYSQLREP,
GLUSTERASSIGN,
GLUSTERUNASSIGN,
PROCESSALARM
PROCESSALARM
};
/** @brief Process Management - Mgr to Mon request options
@ -557,6 +557,7 @@ namespace oam
HEARTBEAT_SEND,
PROCBUILDSYSTEMTABLES,
LOCALHEARTBEAT,
CONFIGURE,
RECONFIGURE,
PROCESSRESTART,
GETSOFTWAREINFO,

View File

@ -3169,6 +3169,18 @@ int main(int argc, char *argv[])
cout << " DONE" << endl;
}
}
else
{
if ( ( IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM ) ||
( (IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM) && pmwithum ) )
{
cout << endl << "===== Running the MariaDB ColumnStore MariaDB ColumnStore setup scripts =====" << endl << endl;
// call the mysql setup scripts
mysqlSetup();
sleep(5);
}
}
}
}
@ -3460,7 +3472,7 @@ int main(int argc, char *argv[])
}
//set mysql replication, if wasn't setup before on system
if ( ( mysqlRep && pmwithum ) ||
/* if ( ( mysqlRep && pmwithum ) ||
( mysqlRep && (umNumber > 1) ) ||
( mysqlRep && (pmNumber > 1) && (IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM) ) )
{
@ -3477,7 +3489,7 @@ int main(int argc, char *argv[])
else
cout << " DONE" << endl;
}
*/
cout << endl << "MariaDB ColumnStore Install Successfully Completed, System is Active" << endl << endl;
cout << "Enter the following command to define MariaDB ColumnStore Alias Commands" << endl << endl;

View File

@ -552,6 +552,72 @@ static void startMgrProcessThread()
log.writeLog(__LINE__, "EXCEPTION ERROR on getSystemConfig: Caught unknown exception!", LOG_TYPE_ERROR);
}
//get Distributed Install
string DistributedInstall = "y";
try
{
oam.getSystemConfig("DistributedInstall", DistributedInstall);
}
catch (...)
{
log.writeLog(__LINE__, "addModule - ERROR: get DistributedInstall", LOG_TYPE_ERROR);
}
//send out moduleName to remote nodes on non-distrubuted install
if ( DistributedInstall == "n" )
{
int status = API_SUCCESS;
int k = 0;
for( ; k < 1200 ; k++ )
{
if ( startsystemthreadStop ) {
processManager.setSystemState(oam::MAN_OFFLINE);
// exit thread
log.writeLog(__LINE__, "startMgrProcessThread Exit with a stop system flag", LOG_TYPE_DEBUG);
pthread_exit(0);
}
status = API_SUCCESS;
for( unsigned int i = 0 ; i < systemmoduletypeconfig.moduletypeconfig.size(); i++)
{
int moduleCount = systemmoduletypeconfig.moduletypeconfig[i].ModuleCount;
if( moduleCount == 0)
continue;
DeviceNetworkList::iterator pt = systemmoduletypeconfig.moduletypeconfig[i].ModuleNetworkList.begin();
for ( ; pt != systemmoduletypeconfig.moduletypeconfig[i].ModuleNetworkList.end(); pt++)
{
string moduleName = (*pt).DeviceName;
if ( (*pt).DisableState == oam::MANDISABLEDSTATE ||
(*pt).DisableState == oam::AUTODISABLEDSTATE )
continue;
int ret = processManager.configureModule(moduleName);
if ( ret != API_SUCCESS )
status = ret;
}
}
//get out of loop if all modules updated
if( status == API_SUCCESS )
break;
//retry after sleeping for a bit
sleep(1);
}
if ( k == 1200 || status == API_FAILURE) {
// system didn't successfull restart
processManager.setSystemState(oam::FAILED);
// exit thread
log.writeLog(__LINE__, "startMgrProcessThread Exit with a failure, not all ProcMons running", LOG_TYPE_CRITICAL);
log.writeLog(__LINE__, "startMgrProcessThread Exit - failure", LOG_TYPE_DEBUG);
pthread_exit(0);
}
}
//wait until all modules are up after a system reboot
int i = 0;
for( ; i < 100 ; i++ )

View File

@ -4983,6 +4983,9 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
}
}
//distribute config file
distributeConfigFile("system");
if ( DistributedInstall == "y" ) {
//PMwithUM config
@ -5350,9 +5353,16 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
sleep(30);
}
}
else
{
listPT = devicenetworklist.begin();
for( ; listPT != devicenetworklist.end() ; listPT++)
{
string moduleName = (*listPT).DeviceName;
//distribute config file
distributeConfigFile("system");
processManager.configureModule(moduleName);
}
}
log.writeLog(__LINE__, "Setup MySQL Replication for new Modules being Added", LOG_TYPE_DEBUG);
processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, true, password );
@ -6056,6 +6066,40 @@ int ProcessManager::reconfigureModule(oam::DeviceNetworkList devicenetworklist)
return API_SUCCESS;
}
/******************************************************************************************
* @brief configureModule
*
* purpose: Configure Module sends message to procmon to setup modulename
*
******************************************************************************************/
int ProcessManager::configureModule(std::string moduleName)
{
//distribute config file
distributeConfigFile(moduleName);
//
//Send Configure msg to Module's Process-Monitor being reconfigured
//
ByteStream msg;
ByteStream::byte requestID = CONFIGURE;
msg << requestID;
msg << moduleName;
int returnStatus = sendMsgProcMon( moduleName, msg, requestID );
if ( returnStatus == API_SUCCESS)
//log the event
log.writeLog(__LINE__, "configureModule - procmon configure successful", LOG_TYPE_DEBUG);
else
{
log.writeLog(__LINE__, "configureModule - procmon configure failed", LOG_TYPE_ERROR);
return API_FAILURE;
}
return API_SUCCESS;
}
/******************************************************************************************
* @brief sendMsgProcMon

View File

@ -415,6 +415,11 @@ public:
*/
int addModule(oam::DeviceNetworkList devicenetworklist, std::string password, bool manualFlag = true);
/**
*@brief Configure Module
*/
int configureModule(std::string moduleName);
/**
*@brief Reconfigure Module
*/

View File

@ -57,6 +57,7 @@ bool processInitComplete = false;
bool rootUser = true;
string USER = "root";
string PMwithUM = "n";
bool startProcMon = false;
//extern std::string gOAMParentModuleName;
extern bool gOAMParentModuleFlag;
@ -96,6 +97,7 @@ int main(int argc, char **argv)
MonitorLog log;
MonitorConfig config;
ProcessMonitor aMonitor(config, log);
Config* sysConfig = Config::makeConfig();
log.writeLog(__LINE__, " ");
log.writeLog(__LINE__, "**********Process Monitor Started**********");
@ -130,8 +132,82 @@ int main(int argc, char **argv)
setlocale(LC_ALL, systemLang.c_str());
// create message thread
pthread_t MessageThread;
int ret = pthread_create (&MessageThread, NULL, (void*(*)(void*)) &messageThread, &config);
if ( ret != 0 ) {
log.writeLog(__LINE__, "pthread_create failed, exiting..., return code = " + oam.itoa(ret), LOG_TYPE_CRITICAL);
exit (1);
}
//check if this is a fresh install, meaning the Columnstore.xml file is not setup
//if so, wait for messages from Procmgr to start us up
string exemgrIpadd = sysConfig->getConfig("ExeMgr1", "IPAddr");
if ( exemgrIpadd == "0.0.0.0" )
{
int count = 0;
while(true)
{
if ( startProcMon )
break;
else
{
count++;
if (count > 10 ) {
count = 0;
log.writeLog(__LINE__, "Waiting for ProcMgr to start us up", LOG_TYPE_DEBUG);
}
sleep(1);
}
}
//re-read local system info with updated Columnstore.xml
sleep(1);
MonitorConfig config;
//get Distributed Install
string DistributedInstall = "y";
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" )
{
//PMwithUM config
try {
oam.getSystemConfig( "PMwithUM", PMwithUM);
}
catch(...) {
PMwithUM = "n";
}
string modType = config.moduleType();
if ( ( config.ServerInstallType() == oam::INSTALL_COMBINE_DM_UM_PM ) ||
( PMwithUM == "y") )
modType = "um";
//run the module install script
string cmd = startup::StartUp::installDir() + "/bin/module_installer.sh " + " --installdir=" + startup::StartUp::installDir() + " --module=" + modType + " > /dev/null 2>&1";
log.writeLog(__LINE__, "run module_installer.sh", LOG_TYPE_DEBUG);
log.writeLog(__LINE__, cmd, LOG_TYPE_DEBUG);
system(cmd.c_str());
//exit to allow ProcMon to restart in a setup state
log.writeLog(__LINE__, "restarting for a non-distrubuted install", LOG_TYPE_DEBUG);
exit (0);
}
}
//define entry if missing
Config* sysConfig = Config::makeConfig();
if ( gOAMParentModuleFlag )
{
string PrimaryUMModuleName;
@ -152,12 +228,6 @@ int main(int argc, char **argv)
log.writeLog(__LINE__, "ProcMon: Starting as NON-ACTIVE Parent", LOG_TYPE_DEBUG);
}
// create message thread
pthread_t MessageThread;
int ret = pthread_create (&MessageThread, NULL, (void*(*)(void*)) &messageThread, &config);
if ( ret != 0 )
log.writeLog(__LINE__, "pthread_create failed, return code = " + oam.itoa(ret), LOG_TYPE_ERROR);
//create and mount data directories
aMonitor.createDataDirs(cloud);
@ -290,16 +360,9 @@ int main(int argc, char **argv)
}
else
{
bool fresh = false;
// not active Parent, get updated Columnstore.xml, retry in case ProcMgr isn't up yet
if (!HDFS)
{
//check if this is a fresh install, meaning the Columnstore.xml file is not setup
string exemgrIpadd = sysConfig->getConfig("ExeMgr1", "IPAddr");
if ( exemgrIpadd == "0.0.0.0" )
fresh = true;
int count = 0;
while(true)
{
@ -326,33 +389,6 @@ int main(int argc, char **argv)
MonitorConfig config;
}
//get Distributed Install
string DistributedInstall = "y";
try
{
oam.getSystemConfig("DistributedInstall", DistributedInstall);
}
catch (...)
{
log.writeLog(__LINE__, "addModule - ERROR: get DistributedInstall", LOG_TYPE_ERROR);
}
//check for a fresh install on a non-distrubuted install setup
if ( DistributedInstall == "n" && fresh )
{
string modType = config.moduleType();
if ( config.ServerInstallType() == oam::INSTALL_COMBINE_DM_UM_PM )
modType = "um";
//run the module install script
string cmd = startup::StartUp::installDir() + "/bin/module_installer.sh " + " --installdir=" + startup::StartUp::installDir() + " --module=" + modType + " > /dev/null 2>&1";
log.writeLog(__LINE__, "run module_installer.sh", LOG_TYPE_DEBUG);
log.writeLog(__LINE__, cmd, LOG_TYPE_DEBUG);
system(cmd.c_str());
}
// not OAM parent module, delay starting until a successful get status is performed
// makes sure the Parent OAM ProcMon is fully ready
while(true)

View File

@ -51,6 +51,7 @@ extern bool rootUser;
extern string USER;
extern bool HDFS;
extern string PMwithUM;
extern bool startProcMon;
//std::string gOAMParentModuleName;
bool gOAMParentModuleFlag;
@ -1360,6 +1361,29 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
break;
}
case CONFIGURE:
{
log.writeLog(__LINE__, "MSG RECEIVED: Configure Module");
string configureModuleName;
msg >> configureModuleName;
uint16_t rtnCode;
int requestStatus = API_SUCCESS;
configureModule(configureModuleName);
ackMsg << (ByteStream::byte) ACK;
ackMsg << (ByteStream::byte) CONFIGURE;
ackMsg << (ByteStream::byte) requestStatus;
mq.write(ackMsg);
log.writeLog(__LINE__, "CONFIGURE: ACK back to ProcMgr, return status = " + oam.itoa((int) requestStatus));
//set startmodule flag
startProcMon = true;
break;
}
case RECONFIGURE:
{
log.writeLog(__LINE__, "MSG RECEIVED: Reconfigure Module");
@ -3537,21 +3561,6 @@ int ProcessMonitor::reconfigureModule(std::string reconfigureModuleName)
system(cmd.c_str());
}
//copy and apply new rc.local.calpont from pm1
cmd = "rm -f " + installDir + "/local/rc.local.calpont";
system(cmd.c_str());
cmd = "cp " + installDir + "/local/etc/" + reconfigureModuleName + "/rc.local.calpont " + installDir + "/local/.";
system(cmd.c_str());
cmd = "rm -f /etc/rc.d/rc.local";
system(cmd.c_str());
cmd = "cp /etc/rc.d/rc.local.columnstoreSave /etc/rc.d/rc.local >/dev/null 2>&1";
system(cmd.c_str());
if (geteuid() == 0)
cmd = "cat " + installDir + "/local/rc.local.calpont >> /etc/rc.d/rc.local >/dev/null 2>&1";
system(cmd.c_str());
cmd = "/etc/rc.d/rc.local >/dev/null 2>&1";
system(cmd.c_str());
//update module file
string fileName = installDir + "/local/module";
@ -3566,6 +3575,32 @@ int ProcessMonitor::reconfigureModule(std::string reconfigureModuleName)
return API_SUCCESS;
}
/******************************************************************************************
* @brief configureModule
*
* purpose: configure Module functionality
* Edit the moduleFile file with new Module Name
*
******************************************************************************************/
int ProcessMonitor::configureModule(std::string configureModuleName)
{
Oam oam;
string installDir = startup::StartUp::installDir();
//update module file
string fileName = installDir + "/local/module";
unlink (fileName.c_str());
ofstream newFile (fileName.c_str());
string cmd = "echo " + configureModuleName + " > " + fileName;
system(cmd.c_str());
newFile.close();
return API_SUCCESS;
}
/******************************************************************************************
* @brief checkSpecialProcessState

View File

@ -398,6 +398,11 @@ public:
*/
int buildSystemTables();
/**
*@brief configure Module fucntionality
*/
int configureModule(std::string configureModuleName);
/**
*@brief reconfigure Module fucntionality
*/