You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-05 16:15:50 +03:00
Merge pull request #331 from mariadb-corporation/MCOL-942
MCOL-942 - backported mysql rep fixes from 1.1
This commit is contained in:
@@ -217,6 +217,7 @@ SET(CPACK_RPM_platform_USER_FILELIST
|
|||||||
"/usr/local/mariadb/columnstore/post/test-004.sh"
|
"/usr/local/mariadb/columnstore/post/test-004.sh"
|
||||||
"/usr/local/mariadb/columnstore/bin/os_detect.sh"
|
"/usr/local/mariadb/columnstore/bin/os_detect.sh"
|
||||||
"/usr/local/mariadb/columnstore/bin/columnstoreClusterTester.sh"
|
"/usr/local/mariadb/columnstore/bin/columnstoreClusterTester.sh"
|
||||||
|
"/usr/local/mariadb/columnstore/bin/mariadb-command-line.sh"
|
||||||
${ignored})
|
${ignored})
|
||||||
|
|
||||||
SET(CPACK_RPM_libs_USER_FILELIST
|
SET(CPACK_RPM_libs_USER_FILELIST
|
||||||
|
@@ -34,6 +34,7 @@ install(PROGRAMS post-install
|
|||||||
myCnf-include-args.text
|
myCnf-include-args.text
|
||||||
myCnf-exclude-args.text
|
myCnf-exclude-args.text
|
||||||
columnstore.service
|
columnstore.service
|
||||||
|
mariadb-command-line.sh
|
||||||
DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
|
DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
|
||||||
|
|
||||||
install(FILES module DESTINATION ${ENGINE_LOCALDIR} COMPONENT platform)
|
install(FILES module DESTINATION ${ENGINE_LOCALDIR} COMPONENT platform)
|
||||||
|
59
oam/install_scripts/mariadb-command-line.sh
Normal file
59
oam/install_scripts/mariadb-command-line.sh
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
# generic MariaDB Columnstore Command Line script.
|
||||||
|
#
|
||||||
|
# Notes: This script gets run by ProcMon during installs and upgrades:
|
||||||
|
|
||||||
|
# check log for error
|
||||||
|
checkForError() {
|
||||||
|
grep ERROR /tmp/mariadb-command-line.log > /tmp/error.check
|
||||||
|
if [ `cat /tmp/error.check | wc -c` -ne 0 ]; then
|
||||||
|
echo "ERROR: check log file: /tmp/mariadb-command-line.log"
|
||||||
|
rm -f /tmp/error.check
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
rm -f /tmp/error.check
|
||||||
|
}
|
||||||
|
|
||||||
|
prefix=/usr/local
|
||||||
|
installdir=$prefix/mariadb/columnstore
|
||||||
|
pwprompt=
|
||||||
|
for arg in "$@"; do
|
||||||
|
if [ `expr -- "$arg" : '--command='` -eq 10 ]; then
|
||||||
|
command1="`echo $arg | awk -F= '{print $2}'`"
|
||||||
|
command2="`echo $arg | awk -F= '{print $3}'`"
|
||||||
|
command=$command1"="$command2
|
||||||
|
elif [ `expr -- "$arg" : '--installdir='` -eq 13 ]; then
|
||||||
|
installdir="`echo $arg | awk -F= '{print $2}'`"
|
||||||
|
prefix=`dirname $installdir`
|
||||||
|
elif [ `expr -- "$arg" : '--port='` -eq 7 ]; then
|
||||||
|
port="`echo $arg | awk -F= '{print $2}'`"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
test -f $installdir/post/functions && . $installdir/post/functions
|
||||||
|
|
||||||
|
|
||||||
|
>/tmp/mariadb-command-line.log
|
||||||
|
|
||||||
|
#
|
||||||
|
# Run command
|
||||||
|
#
|
||||||
|
echo "Run command" >>/tmp/mariadb-command-line.log
|
||||||
|
cat >/tmp/mariadb-command-line.sql <<EOD
|
||||||
|
$command;
|
||||||
|
EOD
|
||||||
|
|
||||||
|
cat /tmp/mariadb-command-line.sql >> /tmp/mariadb-command-line.log
|
||||||
|
$installdir/mysql/bin/mysql \
|
||||||
|
--defaults-extra-file=$installdir/mysql/my.cnf \
|
||||||
|
--user=root \
|
||||||
|
calpontsys < /tmp/mariadb-command-line.sql >> /tmp/mariadb-command-line.log 2>&1
|
||||||
|
|
||||||
|
checkForError
|
||||||
|
|
||||||
|
#alls good, 'OK' for success
|
||||||
|
echo "OK"
|
||||||
|
exit 0
|
@@ -459,7 +459,9 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, std::st
|
|||||||
{ // set for slave repl request
|
{ // set for slave repl request
|
||||||
// don't do PMs unless PMwithUM flag is set
|
// don't do PMs unless PMwithUM flag is set
|
||||||
string moduleType = (*pt).DeviceName.substr(0,MAX_MODULE_TYPE_SIZE);
|
string moduleType = (*pt).DeviceName.substr(0,MAX_MODULE_TYPE_SIZE);
|
||||||
if ( moduleType == "pm" && !pmwithum ) {
|
|
||||||
|
if ( ( moduleType == "pm" && !pmwithum ) &&
|
||||||
|
( IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM ) ) {
|
||||||
pt++;
|
pt++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@@ -10048,8 +10048,10 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
|||||||
MySQLRep = "n";
|
MySQLRep = "n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( MySQLRep == "n" && enable )
|
if ( MySQLRep == "n" && enable ) {
|
||||||
|
log.writeLog(__LINE__, "setMySQLReplication: MySQLRep not set, exiting", LOG_TYPE_DEBUG);
|
||||||
return oam::API_SUCCESS;
|
return oam::API_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
log.writeLog(__LINE__, "Setup MySQL Replication", LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "Setup MySQL Replication", LOG_TYPE_DEBUG);
|
||||||
|
|
||||||
@@ -10228,7 +10230,7 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
|||||||
for( ; listPT != devicenetworklist.end() ; listPT++)
|
for( ; listPT != devicenetworklist.end() ; listPT++)
|
||||||
{
|
{
|
||||||
string remoteModuleName = (*listPT).DeviceName;
|
string remoteModuleName = (*listPT).DeviceName;
|
||||||
log.writeLog(__LINE__, "Setup SlavMySQL Replication on " + remoteModuleName, LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "Setup SlaveMySQL Replication on " + remoteModuleName, LOG_TYPE_DEBUG);
|
||||||
|
|
||||||
//skip master
|
//skip master
|
||||||
if ( remoteModuleName == masterModule )
|
if ( remoteModuleName == masterModule )
|
||||||
|
@@ -1730,7 +1730,8 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
|||||||
string masterLogFile = oam::UnassignedName;
|
string masterLogFile = oam::UnassignedName;
|
||||||
string masterLogPos = oam::UnassignedName;
|
string masterLogPos = oam::UnassignedName;
|
||||||
|
|
||||||
if ( (PMwithUM == "n") && (config.moduleType() == "pm") && ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
|
if ( ( (PMwithUM == "n") && (config.moduleType() == "pm") ) &&
|
||||||
|
( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
|
||||||
{
|
{
|
||||||
ackMsg << (ByteStream::byte) ACK;
|
ackMsg << (ByteStream::byte) ACK;
|
||||||
ackMsg << (ByteStream::byte) MASTERREP;
|
ackMsg << (ByteStream::byte) MASTERREP;
|
||||||
@@ -1803,7 +1804,8 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
|||||||
string port;
|
string port;
|
||||||
msg >> port;
|
msg >> port;
|
||||||
|
|
||||||
if ( (PMwithUM == "n") && (config.moduleType() == "pm") && ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
|
if ( ( (PMwithUM == "n") && (config.moduleType() == "pm") ) &&
|
||||||
|
( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
|
||||||
{
|
{
|
||||||
ackMsg << (ByteStream::byte) ACK;
|
ackMsg << (ByteStream::byte) ACK;
|
||||||
ackMsg << (ByteStream::byte) SLAVEREP;
|
ackMsg << (ByteStream::byte) SLAVEREP;
|
||||||
@@ -1850,7 +1852,8 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
|||||||
string module;
|
string module;
|
||||||
msg >> module;
|
msg >> module;
|
||||||
|
|
||||||
if ( (PMwithUM == "n") && (config.moduleType() == "pm") && ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
|
if ( ( (PMwithUM == "n") && (config.moduleType() == "pm") ) &&
|
||||||
|
( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
|
||||||
{
|
{
|
||||||
ackMsg << (ByteStream::byte) ACK;
|
ackMsg << (ByteStream::byte) ACK;
|
||||||
ackMsg << (ByteStream::byte) MASTERDIST;
|
ackMsg << (ByteStream::byte) MASTERDIST;
|
||||||
@@ -4659,218 +4662,103 @@ int ProcessMonitor::changeMyCnf(std::string type)
|
|||||||
|
|
||||||
string dbDir = startup::StartUp::installDir() + "/mysql/db";
|
string dbDir = startup::StartUp::installDir() + "/mysql/db";
|
||||||
|
|
||||||
/* if ( type == "master" )
|
//get server-id based on ExeMgrx setup
|
||||||
|
string serverID = "0";
|
||||||
|
string localModuleName = config.moduleName();
|
||||||
|
for ( int id = 1 ; ; id++ )
|
||||||
{
|
{
|
||||||
// set master replication entries
|
string Section = "ExeMgr" + oam.itoa(id);
|
||||||
vector <string> lines;
|
|
||||||
char line[200];
|
string moduleName;
|
||||||
string buf;
|
|
||||||
while (file.getline(line, 200))
|
try {
|
||||||
{
|
Config* sysConfig = Config::makeConfig();
|
||||||
buf = line;
|
moduleName = sysConfig->getConfig(Section, "Module");
|
||||||
string::size_type pos = buf.find("server-id =",0);
|
|
||||||
if ( pos != string::npos ) {
|
if ( moduleName == localModuleName )
|
||||||
buf = "server-id = 1";
|
{
|
||||||
|
serverID = oam.itoa(id);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (...) {}
|
||||||
|
}
|
||||||
|
|
||||||
// pos = buf.find("# binlog_format=ROW",0);
|
if ( serverID == "0" )
|
||||||
// if ( pos != string::npos ) {
|
{
|
||||||
// buf = "binlog_format=ROW";
|
log.writeLog(__LINE__, "changeMyCnf: ExeMgr for local module doesn't exist", LOG_TYPE_ERROR);
|
||||||
// }
|
return oam::API_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
pos = buf.find("infinidb_local_query=1",0);
|
// set server-id and other options in my.cnf
|
||||||
if ( pos != string::npos && pos == 0) {
|
vector <string> lines;
|
||||||
buf = "# infinidb_local_query=1";
|
char line[200];
|
||||||
}
|
string buf;
|
||||||
|
while (file.getline(line, 200))
|
||||||
//output to temp file
|
{
|
||||||
lines.push_back(buf);
|
buf = line;
|
||||||
|
string::size_type pos = buf.find("server-id",0);
|
||||||
|
if ( pos != string::npos ) {
|
||||||
|
buf = "server-id = " + serverID;
|
||||||
|
|
||||||
|
string command = "SET GLOBAL server_id=" + serverID + ";";
|
||||||
|
int ret = runMariaDBCommandLine(command);
|
||||||
|
if (ret != 0)
|
||||||
|
{
|
||||||
|
log.writeLog(__LINE__, "changeMyCnf: runMariaDBCommandLine Error", LOG_TYPE_ERROR);
|
||||||
|
return oam::API_FAILURE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file.close();
|
// set local query flag if on pm
|
||||||
unlink (mycnfFile.c_str());
|
if ( (PMwithUM == "y") && config.moduleType() == "pm" )
|
||||||
ofstream newFile (mycnfFile.c_str());
|
|
||||||
|
|
||||||
//create new file
|
|
||||||
int fd = open(mycnfFile.c_str(), O_RDWR|O_CREAT, 0664);
|
|
||||||
|
|
||||||
copy(lines.begin(), lines.end(), ostream_iterator<string>(newFile, "\n"));
|
|
||||||
newFile.close();
|
|
||||||
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// if ( type == "slave" )
|
|
||||||
// {
|
|
||||||
//get server-id based on ExeMgrx setup
|
|
||||||
string slaveID = "0";
|
|
||||||
string slaveModuleName = config.moduleName();
|
|
||||||
for ( int id = 1 ; ; id++ )
|
|
||||||
{
|
{
|
||||||
string Section = "ExeMgr" + oam.itoa(id);
|
pos = buf.find("infinidb_local_query",0);
|
||||||
|
if ( pos != string::npos ) {
|
||||||
|
buf = "infinidb_local_query=1";
|
||||||
|
|
||||||
|
string command = "SET GLOBAL " + buf + ";";
|
||||||
|
|
||||||
string moduleName;
|
int ret = runMariaDBCommandLine(command);
|
||||||
|
if (ret != 0)
|
||||||
try {
|
|
||||||
Config* sysConfig = Config::makeConfig();
|
|
||||||
moduleName = sysConfig->getConfig(Section, "Module");
|
|
||||||
|
|
||||||
if ( moduleName == slaveModuleName )
|
|
||||||
{
|
{
|
||||||
slaveID = oam.itoa(id);
|
log.writeLog(__LINE__, "changeMyCnf: runMariaDBCommandLine Error", LOG_TYPE_ERROR);
|
||||||
|
return oam::API_FAILURE;
|
||||||
// if slave ID from above is 1, then it means this is a former Original master and use the ID of the current Master
|
}
|
||||||
if ( slaveID == "1" ) {
|
|
||||||
string PrimaryUMModuleName;
|
|
||||||
oam.getSystemConfig("PrimaryUMModuleName", PrimaryUMModuleName);
|
|
||||||
|
|
||||||
for ( int mid = 1 ; ; mid++ )
|
|
||||||
{
|
|
||||||
string Section = "ExeMgr" + oam.itoa(mid);
|
|
||||||
|
|
||||||
string moduleName;
|
|
||||||
|
|
||||||
try {
|
|
||||||
Config* sysConfig = Config::makeConfig();
|
|
||||||
moduleName = sysConfig->getConfig(Section, "Module");
|
|
||||||
|
|
||||||
if ( moduleName == PrimaryUMModuleName )
|
|
||||||
{
|
|
||||||
slaveID = oam.itoa(mid);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (...) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (...) {}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{ // disable, if needed
|
||||||
|
pos = buf.find("infinidb_local_query",0);
|
||||||
|
if ( pos != string::npos ) {
|
||||||
|
buf = "infinidb_local_query=0";
|
||||||
|
|
||||||
if ( slaveID == "0" )
|
string command = "SET GLOBAL " + buf + ";";
|
||||||
{
|
int ret = runMariaDBCommandLine(command);
|
||||||
log.writeLog(__LINE__, "changeMyCnf: ExeMgr for local module doesn't exist", LOG_TYPE_ERROR);
|
if (ret != 0)
|
||||||
return oam::API_FAILURE;
|
{
|
||||||
|
log.writeLog(__LINE__, "changeMyCnf: runMariaDBCommandLine Error", LOG_TYPE_ERROR);
|
||||||
|
return oam::API_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set slave replication entries
|
|
||||||
vector <string> lines;
|
|
||||||
char line[200];
|
|
||||||
string buf;
|
|
||||||
while (file.getline(line, 200))
|
|
||||||
{
|
|
||||||
buf = line;
|
|
||||||
string::size_type pos = buf.find("server-id",0);
|
|
||||||
if ( pos != string::npos ) {
|
|
||||||
buf = "server-id = " + slaveID;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set local query flag if on pm
|
|
||||||
if ( (PMwithUM == "y") && config.moduleType() == "pm" )
|
|
||||||
{
|
|
||||||
pos = buf.find("# infinidb_local_query=1",0);
|
|
||||||
if ( pos != string::npos ) {
|
|
||||||
buf = "infinidb_local_query=1";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // disable, if needed
|
|
||||||
pos = buf.find("infinidb_local_query=1",0);
|
|
||||||
if ( pos != string::npos ) {
|
|
||||||
buf = "# infinidb_local_query=1";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// pos = buf.find("binlog_format=ROW",0);
|
|
||||||
// if ( pos != string::npos && pos == 0 ) {
|
|
||||||
// buf = "# binlog_format=ROW";
|
|
||||||
// }
|
|
||||||
|
|
||||||
//output to temp file
|
|
||||||
lines.push_back(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
file.close();
|
|
||||||
unlink (mycnfFile.c_str());
|
|
||||||
ofstream newFile (mycnfFile.c_str());
|
|
||||||
|
|
||||||
//create new file
|
//output to temp file
|
||||||
int fd = open(mycnfFile.c_str(), O_RDWR|O_CREAT, 0664);
|
lines.push_back(buf);
|
||||||
|
|
||||||
copy(lines.begin(), lines.end(), ostream_iterator<string>(newFile, "\n"));
|
|
||||||
newFile.close();
|
|
||||||
|
|
||||||
close(fd);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/* if ( type == "disable" )
|
|
||||||
{
|
|
||||||
// set master replication entries
|
|
||||||
vector <string> lines;
|
|
||||||
char line[200];
|
|
||||||
string buf;
|
|
||||||
while (file.getline(line, 200))
|
|
||||||
{
|
|
||||||
buf = line;
|
|
||||||
string::size_type pos = buf.find("server-id",0);
|
|
||||||
if ( pos != string::npos ) {
|
|
||||||
string::size_type pos1 = buf.find("1",pos);
|
|
||||||
if ( pos1 == string::npos ) {
|
|
||||||
buf = "# server-id = 1";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pos = buf.find("log-bin=mysql-bin",0);
|
|
||||||
if ( pos != string::npos ) {
|
|
||||||
buf = "# log-bin=mysql-bin";
|
|
||||||
}
|
|
||||||
|
|
||||||
pos = buf.find("binlog_format=ROW",0);
|
|
||||||
if ( pos != string::npos && pos == 0 ) {
|
|
||||||
buf = "# binlog_format=ROW";
|
|
||||||
}
|
|
||||||
|
|
||||||
pos = buf.find("infinidb_local_query=1",0);
|
|
||||||
if ( pos != string::npos && pos == 0) {
|
|
||||||
buf = "# infinidb_local_query=1";
|
|
||||||
}
|
|
||||||
|
|
||||||
pos = buf.find("# relay-log",0);
|
|
||||||
if ( pos != string::npos ) {
|
|
||||||
buf = buf;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pos = buf.find("relay-log",0);
|
|
||||||
if ( pos != string::npos ) {
|
|
||||||
buf = "# " + buf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pos = buf.find("slave-skip-errors=all",0);
|
|
||||||
if ( pos != string::npos ) {
|
|
||||||
buf = "# slave-skip-errors=all";
|
|
||||||
}
|
|
||||||
|
|
||||||
//output to temp file
|
|
||||||
lines.push_back(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
file.close();
|
|
||||||
unlink (mycnfFile.c_str());
|
|
||||||
ofstream newFile (mycnfFile.c_str());
|
|
||||||
|
|
||||||
//create new file
|
|
||||||
int fd = open(mycnfFile.c_str(), O_RDWR|O_CREAT, 0664);
|
|
||||||
|
|
||||||
copy(lines.begin(), lines.end(), ostream_iterator<string>(newFile, "\n"));
|
|
||||||
newFile.close();
|
|
||||||
|
|
||||||
close(fd);
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
file.close();
|
||||||
|
unlink (mycnfFile.c_str());
|
||||||
|
ofstream newFile (mycnfFile.c_str());
|
||||||
|
|
||||||
|
//create new file
|
||||||
|
int fd = open(mycnfFile.c_str(), O_RDWR|O_CREAT, 0664);
|
||||||
|
|
||||||
|
copy(lines.begin(), lines.end(), ostream_iterator<string>(newFile, "\n"));
|
||||||
|
newFile.close();
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
|
||||||
// set owner and permission
|
// set owner and permission
|
||||||
string cmd = "chmod 664 " + mycnfFile + " >/dev/null 2>&1";
|
string cmd = "chmod 664 " + mycnfFile + " >/dev/null 2>&1";
|
||||||
if ( !rootUser)
|
if ( !rootUser)
|
||||||
@@ -4884,19 +4772,64 @@ int ProcessMonitor::changeMyCnf(std::string type)
|
|||||||
|
|
||||||
system(cmd.c_str());
|
system(cmd.c_str());
|
||||||
|
|
||||||
// restart mysql
|
|
||||||
try {
|
|
||||||
oam.actionMysqlCalpont(MYSQL_RESTART);
|
|
||||||
sleep(5); // give after mysql restart
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{}
|
|
||||||
|
|
||||||
log.writeLog(__LINE__, "changeMyCnf function successfully completed", LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "changeMyCnf function successfully completed", LOG_TYPE_DEBUG);
|
||||||
|
|
||||||
return oam::API_SUCCESS;
|
return oam::API_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************************************
|
||||||
|
* @brief runMariaDBCommandLine
|
||||||
|
*
|
||||||
|
* purpose: run MariaDB Command Line script
|
||||||
|
*
|
||||||
|
******************************************************************************************/
|
||||||
|
int ProcessMonitor::runMariaDBCommandLine(std::string command)
|
||||||
|
{
|
||||||
|
Oam oam;
|
||||||
|
|
||||||
|
log.writeLog(__LINE__, "runMariaDBCommandLine function called: cmd = " + command, LOG_TYPE_DEBUG);
|
||||||
|
|
||||||
|
// mysql port number
|
||||||
|
string MySQLPort;
|
||||||
|
try {
|
||||||
|
oam.getSystemConfig("MySQLPort", MySQLPort);
|
||||||
|
}
|
||||||
|
catch(...) {
|
||||||
|
MySQLPort = "3306";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( MySQLPort.empty() )
|
||||||
|
MySQLPort = "3306";
|
||||||
|
|
||||||
|
string cmd = startup::StartUp::installDir() + "/bin/mariadb-command-line.sh --installdir=" + startup::StartUp::installDir() + " --command='" + command + "' --port=" + MySQLPort + " > /tmp/mariadb-command-line.sh.log 2>&1";
|
||||||
|
|
||||||
|
log.writeLog(__LINE__, "cmd = " + cmd, LOG_TYPE_DEBUG);
|
||||||
|
|
||||||
|
system(cmd.c_str());
|
||||||
|
|
||||||
|
string logFile = "/tmp/mariadb-command-line.sh.log";
|
||||||
|
|
||||||
|
if (oam.checkLogStatus(logFile, "ERROR 1045") ) {
|
||||||
|
log.writeLog(__LINE__, "mariadb-command-line.sh: MySQL Password Error, check .my.cnf", LOG_TYPE_ERROR);
|
||||||
|
return oam::API_FAILURE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (oam.checkLogStatus(logFile, "OK"))
|
||||||
|
{
|
||||||
|
log.writeLog(__LINE__, "mariadb-command-line.sh: Successful return", LOG_TYPE_DEBUG);
|
||||||
|
return oam::API_SUCCESS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log.writeLog(__LINE__, "mariadb-command-line.sh: Error return, check log /tmp/mariadb-command-line.sh.log", LOG_TYPE_ERROR);
|
||||||
|
return oam::API_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return oam::API_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************************
|
/******************************************************************************************
|
||||||
* @brief runMasterRep
|
* @brief runMasterRep
|
||||||
*
|
*
|
||||||
@@ -4950,7 +4883,8 @@ int ProcessMonitor::runMasterRep(std::string& masterLogFile, std::string& master
|
|||||||
|
|
||||||
string moduleType = systemModuleTypeConfig.moduletypeconfig[i].ModuleType;
|
string moduleType = systemModuleTypeConfig.moduletypeconfig[i].ModuleType;
|
||||||
|
|
||||||
if ( (PMwithUM == "n") && (moduleType == "pm") && ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
|
if ( ( (PMwithUM == "n") && (moduleType == "pm") ) &&
|
||||||
|
( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
HostConfigList::iterator pt1 = (*pt).hostConfigList.begin();
|
HostConfigList::iterator pt1 = (*pt).hostConfigList.begin();
|
||||||
@@ -5246,7 +5180,8 @@ int ProcessMonitor::runMasterDist(std::string& password, std::string& slaveModul
|
|||||||
|
|
||||||
string moduleType = systemModuleTypeConfig.moduletypeconfig[i].ModuleType;
|
string moduleType = systemModuleTypeConfig.moduletypeconfig[i].ModuleType;
|
||||||
|
|
||||||
if ( (PMwithUM == "n") && (moduleType == "pm") && ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
|
if ( ( (PMwithUM == "n") && (moduleType == "pm") ) &&
|
||||||
|
( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DeviceNetworkList::iterator pt = systemModuleTypeConfig.moduletypeconfig[i].ModuleNetworkList.begin();
|
DeviceNetworkList::iterator pt = systemModuleTypeConfig.moduletypeconfig[i].ModuleNetworkList.begin();
|
||||||
@@ -5291,7 +5226,7 @@ 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";
|
string cmd = startup::StartUp::installDir() + "/bin/rsync.sh " + ipAddr + " " + password + " " + startup::StartUp::installDir() + " 1 > /tmp/master-dist_" + slaveModule + ".log";
|
||||||
system(cmd.c_str());
|
system(cmd.c_str());
|
||||||
|
|
||||||
log.writeLog(__LINE__, "cmd = " + cmd, LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "cmd = " + cmd, LOG_TYPE_DEBUG);
|
||||||
|
|
||||||
string logFile = "/tmp/master-dist_" + slaveModule + ".log";
|
string logFile = "/tmp/master-dist_" + slaveModule + ".log";
|
||||||
if (!oam.checkLogStatus(logFile, "FAILED"))
|
if (!oam.checkLogStatus(logFile, "FAILED"))
|
||||||
|
@@ -494,6 +494,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
int changeMyCnf(std::string type);
|
int changeMyCnf(std::string type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@brief run MariaDB Command Line script
|
||||||
|
*/
|
||||||
|
int runMariaDBCommandLine(std::string command);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*@brief run Master Replication script
|
*@brief run Master Replication script
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user