1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-08 14:22:09 +03:00

fix commands again

This commit is contained in:
david hill
2016-05-02 11:35:12 -05:00
parent 3e306bd5bb
commit 1978b58e42
3 changed files with 96 additions and 96 deletions

View File

@@ -83,7 +83,7 @@ if [ "$1" = "deassignElasticIP" ]; then
echo "Enter Elastic IP Address"
exit 1
else
IPAddress="$2"getType
IPAddress="$2"
fi
fi
@@ -150,11 +150,11 @@ getInstance() {
localIP=`ifconfig eth0 | grep "inet addr:" | awk '{print substr($2,6,20)}'`
#get local Instance ID
instance=`cat $describeInstanceFile | grep -m 1 $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'`
instance=`cat $describeInstanceFile | grep -m 1 -w $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'`
if [ "$instance" == "" ]; then
describeInstance
fi
instance=`cat $describeInstanceFile | grep -m 1 $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'`
instance=`cat $describeInstanceFile | grep -m 1 -w $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'`
echo $instance
return
@@ -170,11 +170,11 @@ getInstancePrivate() {
localIP=`ifconfig eth0 | grep "inet addr:" | awk '{print substr($2,6,20)}'`
#get local Instance ID
instance=`cat $describeInstanceFile | grep -m 1 $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'`
instance=`cat $describeInstanceFile | grep -m 1 -w $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'`
if [ "$instance" == "" ]; then
describeInstance
fi
instance=`cat $describeInstanceFile | grep -m 1 $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'`
instance=`cat $describeInstanceFile | grep -m 1 -w $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'`
return
}
@@ -184,7 +184,7 @@ getZone() {
#get from Calpont.xml if it's there, if not, get from instance then store
zone=`$prefix/Calpont/bin/getConfig Installation AmazonZone`
if [ "$zone" = "unassigned" ]; then
if [ "$zone" = "unassigned" ] || [ "$zone" = "" ]; then
#get local Instance ID
getInstancePrivate >/dev/null 2>&1
#get zone
@@ -196,11 +196,11 @@ getZone() {
zone=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $11}'`
else
zone=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $10}'`
zone=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $11}'`
if [ "$zone" == "" ]; then
describeInstance
fi
zone=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $10}'`
zone=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $11}'`
fi
$prefix/Calpont/bin/setConfig Installation AmazonZone $zone
fi
@@ -494,6 +494,7 @@ getSubnet() {
echo $subnet
else
echo "failed"
fi
return
}

View File

@@ -715,51 +715,6 @@ int main(int argc, char *argv[])
if ( MySQLRep == "y" )
mysqlRep = true;
string answer = "n";
while(true) {
if ( !mysqlRep )
prompt = "Enable MySQL Replication feature? [y,n] (n) > ";
else
break;
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";
}
if ( MySQLRep == "y" )
mysqlRep = true;
else
mysqlRep = false;
try {
sysConfig->setConfig(InstallSection, "PMwithUM", PMwithUM);
}
catch(...)
{}
try {
sysConfig->setConfig(InstallSection, "MySQLRep", MySQLRep);
}
catch(...)
{}
break;
}
default: // normal, separate UM and PM
@@ -825,42 +780,6 @@ int main(int argc, char *argv[])
}
}
if ( !pmwithum )
{
answer = "n";
while(true) {
if ( mysqlRep )
prompt = "Enable MySQL Replication feature? [y,n] (n) > ";
else
break;
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";
}
if ( MySQLRep == "y" )
mysqlRep = true;
else
mysqlRep = false;
}
try {
sysConfig->setConfig(InstallSection, "PMwithUM", PMwithUM);
}
@@ -1483,11 +1402,33 @@ int main(int argc, char *argv[])
}
}
if ( moduleType == "pm" )
if ( moduleType == "pm" ) {
pmNumber = moduleCount;
if ( moduleType == "um" )
if ( pmNumber > 1 && ( IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM ) )
{
mysqlRep = true;
try {
sysConfig->setConfig(InstallSection, "MySQLRep", "y");
}
catch(...)
{}
}
}
if ( moduleType == "um" ) {
umNumber = moduleCount;
if ( umNumber > 1 )
{
mysqlRep = true;
try {
sysConfig->setConfig(InstallSection, "MySQLRep", "y");
}
catch(...)
{}
}
}
int moduleID = 1;

View File

@@ -4737,9 +4737,14 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
sysConfig->setConfig(Section, "Port", "8622");
}
bool setMysqlRep = false;
if ( moduleType == "um" ||
( moduleType == "pm" && config.ServerInstallType() == oam::INSTALL_COMBINE_DM_UM_PM ) ||
( moduleType == "pm" && PMwithUM == "y") ) {
setMysqlRep = true;
listPT = devicenetworklist.begin();
for( ; listPT != devicenetworklist.end() ; listPT++)
{
@@ -5229,10 +5234,25 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
sleep(30);
}
//check and add MySQL Replication slave
string MySQLRep;
try {
oam.getSystemConfig("MySQLRep", MySQLRep);
}
catch(...) {
MySQLRep = "n";
}
if ( MySQLRep == "n" && setMysqlRep ) {
try {
oam.setSystemConfig("MySQLRep", "y");
}
catch(...) {}
}
//distribute config file
distributeConfigFile("system");
//add MySQL Replication slave
log.writeLog(__LINE__, "Setup MySQL Replication for new Modules being Added", LOG_TYPE_DEBUG);
processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, true, password );
@@ -5247,6 +5267,10 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
******************************************************************************************/
int ProcessManager::removeModule(oam::DeviceNetworkList devicenetworklist, bool manualFlag)
{
ProcessLog log;
Configuration config;
ProcessManager processManager(config, log);
ModuleTypeConfig moduletypeconfig;
ModuleTypeConfig setmoduletypeconfig;
Oam oam;
@@ -5587,7 +5611,22 @@ int ProcessManager::removeModule(oam::DeviceNetworkList devicenetworklist, bool
//distribute config file
distributeConfigFile("system");
string password;
// check if there is a root password stored
string rpw = oam::UnassignedName;
try
{
oam.getSystemConfig("rpw", password);
}
catch(...)
{
rpw = "root";
}
log.writeLog(__LINE__, "Setup MySQL Replication for new Modules being Added", LOG_TYPE_DEBUG);
processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, true, password );
return API_SUCCESS;
}
@@ -9966,8 +10005,17 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
if ( config.ServerInstallType() == oam::INSTALL_COMBINE_DM_UM_PM && !failover ) {
try {
Config* sysConfig = Config::makeConfig();
if ( sysConfig->getConfig("DBRM_Controller", "NumWorkers") == "1" )
return oam::API_SUCCESS;
if ( sysConfig->getConfig("DBRM_Controller", "NumWorkers") == "1" ) {
//disable mysqlrep
log.writeLog(__LINE__, "Disable MySQL Replication", LOG_TYPE_DEBUG);
try {
oam.setSystemConfig("MySQLRep", "n");
}
catch(...) {}
enable = false;
distributeDB = true;
}
}
catch(...)
{
@@ -9985,7 +10033,17 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
{}
if ( moduletypeconfig.ModuleCount < 1 )
return oam::API_SUCCESS;
{
//disable mysqlrep
log.writeLog(__LINE__, "Disable MySQL Replication", LOG_TYPE_DEBUG);
try {
oam.setSystemConfig("MySQLRep", "n");
}
catch(...) {}
enable = false;
distributeDB = true;
}
}
log.writeLog(__LINE__, "Setup MySQL Replication", LOG_TYPE_DEBUG);