1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Merge pull request #665 from pleblanc1976/mcol-1607

Mcol 1607 - postconfig must support writing hostnames to config file
This commit is contained in:
Patrick LeBlanc
2018-12-21 09:01:06 -06:00
committed by GitHub
7 changed files with 326 additions and 151 deletions

View File

@ -309,8 +309,10 @@
<Desc4>MariaDB Columnstore Packages and setup the module to make it ready to be restored</Desc4> <Desc4>MariaDB Columnstore Packages and setup the module to make it ready to be restored</Desc4>
<Arg1>Required: Module-type or Module-name being added</Arg1> <Arg1>Required: Module-type or Module-name being added</Arg1>
<Arg2>Required: Number-of-Modules being added when Module-type is specified</Arg2> <Arg2>Required: Number-of-Modules being added when Module-type is specified</Arg2>
<Arg3>Optional: Server-Hostnames/Amazon-Instance-Names seperated by commas</Arg3> <Arg3>Required: Store hostnames in the configuration instead of IP addresses (y/n)</Arg3>
<Arg4>Optional: Server-root-password</Arg4> <Arg4>If not Amazon, then Required: hostnames separated by commas</Arg4>
<Arg5>If Amazon, then Optional: Amazon-Instance-Names separated by commas</Arg5>
<Arg6>Optional: Server-user-password</Arg6>
</Cmd48> </Cmd48>
<Cmd49> <Cmd49>
<Name>removeModule</Name> <Name>removeModule</Name>

View File

@ -1272,10 +1272,12 @@ void Oam::setSystemConfig(const std::string module, ModuleConfig moduleconfig)
* *
********************************************************************/ ********************************************************************/
void Oam::addModule(DeviceNetworkList devicenetworklist, const std::string password, const std::string mysqlpw) void Oam::addModule(DeviceNetworkList devicenetworklist, const std::string password, const std::string mysqlpw,
bool storeHostnames)
{ {
// build and send msg // build and send msg
int returnStatus = sendMsgToProcMgr2(ADDMODULE, devicenetworklist, FORCEFUL, ACK_YES, password, mysqlpw); int returnStatus = sendAddModuleToProcMgr(ADDMODULE, devicenetworklist, FORCEFUL, ACK_YES, storeHostnames,
password, mysqlpw);
if (returnStatus != API_SUCCESS) if (returnStatus != API_SUCCESS)
exceptionControl("addModule", returnStatus); exceptionControl("addModule", returnStatus);
@ -10007,6 +10009,124 @@ int Oam::sendMsgToProcMgr2(messageqcpp::ByteStream::byte requestType, DeviceNetw
return returnStatus; return returnStatus;
} }
/* A slightly different version of sendMsgToProcMgr2. Add-module needs to send one add'l
parameter, and this was the best of a couple bad options. */
int Oam::sendAddModuleToProcMgr(messageqcpp::ByteStream::byte requestType, DeviceNetworkList devicenetworklist,
GRACEFUL_FLAG gracefulflag, ACK_FLAG ackflag, bool storeHostnames, const std::string password,
const std::string mysqlpw)
{
if (!checkSystemRunning())
return API_CONN_REFUSED;
int returnStatus = API_TIMEOUT; //default
ByteStream msg;
ByteStream receivedMSG;
ByteStream::byte msgType;
ByteStream::byte actionType;
ByteStream::byte status;
// get current requesting process, an error will occur if process is a UI tool (not kept in Status Table)
// this will be used to determine if this is a manually or auto request down within Process-Monitor
bool requestManual;
myProcessStatus_t t;
try
{
t = getMyProcessStatus();
requestManual = false; // set to auto
}
catch (...)
{
requestManual = true; // set to manual
}
// setup message
msg << (ByteStream::byte) REQUEST;
msg << requestType;
msg << (std::string) " ";
msg << (ByteStream::byte) gracefulflag;
msg << (ByteStream::byte) ackflag;
msg << (ByteStream::byte) requestManual;
msg << (uint8_t) storeHostnames;
msg << (uint16_t) devicenetworklist.size();
DeviceNetworkList::iterator pt = devicenetworklist.begin();
for ( ; pt != devicenetworklist.end() ; pt++)
{
msg << (*pt).DeviceName;
if ( (*pt).UserTempDeviceName.empty() )
msg << " ";
else
msg << (*pt).UserTempDeviceName;
if ( (*pt).DisableState.empty() )
msg << " ";
else
msg << (*pt).DisableState;
msg << (uint16_t) (*pt).hostConfigList.size();
HostConfigList::iterator pt1 = (*pt).hostConfigList.begin();
for ( ; pt1 != (*pt).hostConfigList.end() ; pt1++)
{
msg << (*pt1).IPAddr;
msg << (*pt1).HostName;
msg << (*pt1).NicID;
}
}
msg << password;
msg << mysqlpw;
try
{
//send the msg to Process Manager
MessageQueueClient procmgr("ProcMgr");
procmgr.write(msg);
// check for Ack msg if needed
if ( ackflag == ACK_YES )
{
// wait 15 minutes for ACK from Process Manager
struct timespec ts = { 900, 0 };
receivedMSG = procmgr.read(&ts);
if (receivedMSG.length() > 0)
{
receivedMSG >> msgType;
receivedMSG >> actionType;
receivedMSG >> status;
if ( msgType == oam::ACK && actionType == requestType)
{
// ACK for this request
returnStatus = status;
}
}
else // timeout
returnStatus = API_TIMEOUT;
}
else
// No ACK, assume write success
returnStatus = API_SUCCESS;
// shutdown connection
procmgr.shutdown();
}
catch (...)
{
returnStatus = API_FAILURE;
}
return returnStatus;
}
/*************************************************************************** /***************************************************************************
* *
* Function: sendMsgToProcMgr3 * Function: sendMsgToProcMgr3

View File

@ -1488,7 +1488,8 @@ public:
* @param DeviceNetworkConfig the Modules added * @param DeviceNetworkConfig the Modules added
* @param password Host Root Password * @param password Host Root Password
*/ */
EXPORT void addModule(DeviceNetworkList devicenetworklist, const std::string password, const std::string mysqlpw); EXPORT void addModule(DeviceNetworkList devicenetworklist, const std::string password, const std::string mysqlpw,
bool storeHostnames);
/** @brief remove Module /** @brief remove Module
* *
@ -2503,6 +2504,12 @@ private:
int sendMsgToProcMgr2(messageqcpp::ByteStream::byte requestType, DeviceNetworkList devicenetworklist, int sendMsgToProcMgr2(messageqcpp::ByteStream::byte requestType, DeviceNetworkList devicenetworklist,
GRACEFUL_FLAG gracefulflag, ACK_FLAG ackflag, const std::string password = oam::UnassignedName, const std::string mysqlpw = oam::UnassignedName); GRACEFUL_FLAG gracefulflag, ACK_FLAG ackflag, const std::string password = oam::UnassignedName, const std::string mysqlpw = oam::UnassignedName);
/** @brief a slightly different version of sendMsgToProcMgr2, which is for addmodule only.
*/
int sendAddModuleToProcMgr(messageqcpp::ByteStream::byte requestType, DeviceNetworkList devicenetworklist,
GRACEFUL_FLAG gracefulflag, ACK_FLAG ackflag, bool storeHostnames, const std::string password = oam::UnassignedName,
const std::string mysqlpw = oam::UnassignedName);
/** @brief build and send request message to Process Manager /** @brief build and send request message to Process Manager
* Check for status messages * Check for status messages
*/ */

View File

@ -5660,6 +5660,7 @@ int processCommand(string* arguments)
DeviceNetworkList enabledevicenetworklist; DeviceNetworkList enabledevicenetworklist;
HostConfig hostconfig; HostConfig hostconfig;
bool storeHostnames = false;
string moduleType; string moduleType;
string moduleName; string moduleName;
int moduleCount; int moduleCount;
@ -5670,7 +5671,7 @@ int processCommand(string* arguments)
umStorageNames umstoragenames; umStorageNames umstoragenames;
int hostArg; int hostArg;
int dbrootPerPM = 0; int dbrootPerPM = 0;
//check if module type or module name was entered //check if module type or module name was entered
if ( arguments[1].size() == 2 ) if ( arguments[1].size() == 2 )
{ {
@ -5685,8 +5686,47 @@ int processCommand(string* arguments)
//Module Type was entered //Module Type was entered
moduleType = arguments[1]; moduleType = arguments[1];
moduleCount = atoi(arguments[2].c_str()); moduleCount = atoi(arguments[2].c_str());
hostArg = 4;
// MCOL-1607. Check whether we should store host names or IP addresses.
if (arguments[3] != "" && (arguments[3][0] == 'y' || arguments[3][0] == 'Y'))
storeHostnames = true;
//check for a non-distrubuted install setup, dont need password
if ( DistributedInstall != "y" )
{
if (arguments[5] != "")
password = arguments[5];
else
{
cout << endl;
string prompt = "Enter the 'User' Password or 'ssh' if configured with ssh-keys";
password = dataPrompt(prompt);
}
}
if (arguments[6] != "")
dbrootPerPM = atoi(arguments[6].c_str());
}
else
{
//Module Name was entered
if (arguments[2] == "" && cloud == oam::UnassignedName)
{
// need at least arguments
cout << endl << "**** addModule Failed : Missing a required Parameter, enter 'help' for additional information" << endl;
break;
}
moduleName = arguments[1];
moduleType = arguments[1].substr(0, MAX_MODULE_TYPE_SIZE);
moduleCount = 1;
hostArg = 3; hostArg = 3;
// MCOL-1607. Check whether we should store host names or IP addresses.
if (arguments[2] != "" && (arguments[2][0] == 'y' || arguments[2][0] == 'Y'))
storeHostnames = true;
//check for a non-distrubuted install setup, dont need password //check for a non-distrubuted install setup, dont need password
if ( DistributedInstall != "y" ) if ( DistributedInstall != "y" )
{ {
@ -5703,37 +5743,6 @@ int processCommand(string* arguments)
if (arguments[5] != "") if (arguments[5] != "")
dbrootPerPM = atoi(arguments[5].c_str()); dbrootPerPM = atoi(arguments[5].c_str());
} }
else
{
//Module Name was entered
if (arguments[2] == "" && cloud == oam::UnassignedName)
{
// need at least arguments
cout << endl << "**** addModule Failed : Missing a required Parameter, enter 'help' for additional information" << endl;
break;
}
moduleName = arguments[1];
moduleType = arguments[1].substr(0, MAX_MODULE_TYPE_SIZE);
moduleCount = 1;
hostArg = 2;
//check for a non-distrubuted install setup, dont need password
if ( DistributedInstall != "y" )
{
if (arguments[3] != "")
password = arguments[3];
else
{
cout << endl;
string prompt = "Enter the 'User' Password or 'ssh' if configured with ssh-keys";
password = dataPrompt(prompt);
}
}
if (arguments[4] != "")
dbrootPerPM = atoi(arguments[4].c_str());
}
//do we needed this check???? //do we needed this check????
if ( moduleCount < 1 || moduleCount > 10 ) if ( moduleCount < 1 || moduleCount > 10 )
@ -5925,7 +5934,24 @@ int processCommand(string* arguments)
string hostName; string hostName;
string IPAddress; string IPAddress;
if ( cloud == "amazon-ec2") // MCOL-1607. Store hostnames in the config file if they entered one */
if (storeHostnames)
{
// special case
if (cloud == "amazon-vpc" && *listPT1 == "autoassign")
{
hostName = oam::UnassignedName;
IPAddress = *listPT1;
}
else if (oam.isValidIP(*listPT1)) // they entered an IP addr
{
hostName = oam::UnassignedName;
IPAddress = *listPT1;
}
else // they entered a hostname
IPAddress = hostName = *listPT1;
}
else if ( cloud == "amazon-ec2")
{ {
hostName = *listPT1; hostName = *listPT1;
@ -5978,14 +6004,13 @@ int processCommand(string* arguments)
// non-amazon // non-amazon
hostName = *listPT1; hostName = *listPT1;
IPAddress = oam.getIPAddress(hostName); IPAddress = oam.getIPAddress(hostName);
if ( IPAddress.empty() ) if ( IPAddress.empty() )
{ {
// prompt for IP Address // prompt for IP Address
string prompt = "IP Address of " + hostName + " not found, enter IP Address or enter 'abort'"; string prompt = "IP Address of " + hostName + " not found, enter IP Address or enter 'abort'";
IPAddress = dataPrompt(prompt); IPAddress = dataPrompt(prompt);
if ( IPAddress == "abort" || !oam.isValidIP(IPAddress)) if ( IPAddress == "abort" || !oam.isValidIP(IPAddress) )
return 1; return 1;
} }
} }
@ -6023,18 +6048,22 @@ int processCommand(string* arguments)
{ {
string prompt = "DataRedundancy is configured for dedicated network, enter a hostname"; string prompt = "DataRedundancy is configured for dedicated network, enter a hostname";
DataRedundancyHostname = dataPrompt(prompt); DataRedundancyHostname = dataPrompt(prompt);
DataRedundancyIPAddress = oam.getIPAddress(DataRedundancyHostname); if (storeHostnames)
DataRedundancyIPAddress = DataRedundancyHostname;
if ( DataRedundancyIPAddress.empty() ) else
{ {
// prompt for IP Address DataRedundancyIPAddress = oam.getIPAddress(DataRedundancyHostname);
string prompt = "IP Address of " + DataRedundancyHostname + " not found, enter IP Address";
DataRedundancyIPAddress = dataPrompt(prompt);
if (!oam.isValidIP(DataRedundancyIPAddress)) if ( DataRedundancyIPAddress.empty() )
return 1; {
// prompt for IP Address
string prompt = "IP Address of " + DataRedundancyHostname + " not found, enter IP Address";
DataRedundancyIPAddress = dataPrompt(prompt);
if (!oam.isValidIP(DataRedundancyIPAddress))
return 1;
}
} }
sysConfig->setConfig("DataRedundancyConfig", dataDupHostName, DataRedundancyHostname); sysConfig->setConfig("DataRedundancyConfig", dataDupHostName, DataRedundancyHostname);
sysConfig->setConfig("DataRedundancyConfig", dataDupIPaddr, DataRedundancyIPAddress); sysConfig->setConfig("DataRedundancyConfig", dataDupIPaddr, DataRedundancyIPAddress);
} }
@ -6105,7 +6134,7 @@ int processCommand(string* arguments)
cout << "please wait..." << endl; cout << "please wait..." << endl;
oam.addModule(devicenetworklist, password, mysqlpassword); oam.addModule(devicenetworklist, password, mysqlpassword, storeHostnames);
cout << "Add Module(s) successfully completed" << endl; cout << "Add Module(s) successfully completed" << endl;

View File

@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */ MA 02110-1301, USA. */
/****************************************************************************************** /******************************************************************************************
* $Id: postConfigure.cpp 64 2006-10-12 22:21:51Z dhill $ * $Id: postConfigure.cpp 64 2006-10-12 22:21:51Z dhill $
@ -129,7 +129,7 @@ void singleServerConfigSetup(Config* sysConfig);
void remoteInstallThread(void*); void remoteInstallThread(void*);
bool glusterSetup(string password); bool glusterSetup(string password, bool doNotResolveHostNames);
std::string launchInstance(ModuleIP moduleip); std::string launchInstance(ModuleIP moduleip);
@ -192,6 +192,7 @@ bool nonDistributeFlag = false;
bool single_server_quick_install = false; bool single_server_quick_install = false;
bool multi_server_quick_install = false; bool multi_server_quick_install = false;
bool amazon_quick_install = false; bool amazon_quick_install = false;
bool doNotResolveHostNames = false;
string DataFileEnvFile; string DataFileEnvFile;
@ -275,12 +276,12 @@ int main(int argc, char* argv[])
usergroup = getgid(); usergroup = getgid();
string SUDO = ""; string SUDO = "";
if (user != 0) if (user != 0)
{ {
rootUser = false; rootUser = false;
SUDO = "sudo "; SUDO = "sudo ";
} }
char* p = getenv("USER"); char* p = getenv("USER");
if (p && *p) if (p && *p)
@ -298,7 +299,7 @@ int main(int argc, char* argv[])
for ( int i = 1; i < argc; i++ ) for ( int i = 1; i < argc; i++ )
{ {
if( string("-h") == argv[i] ) if( string("-h") == argv[i] )
{ {
cout << endl; cout << endl;
cout << "This is the MariaDB ColumnStore System Configuration and Installation tool." << endl; cout << "This is the MariaDB ColumnStore System Configuration and Installation tool." << endl;
@ -322,13 +323,18 @@ int main(int argc, char* argv[])
cout << " -qs Quick Install - Single Server" << endl; cout << " -qs Quick Install - Single Server" << endl;
cout << " -qm Quick Install - Multi Server" << endl; cout << " -qm Quick Install - Multi Server" << endl;
cout << " -port MariaDB ColumnStore Port Address" << endl; cout << " -port MariaDB ColumnStore Port Address" << endl;
cout << " -i Non-root Install directory, Only use for non-root installs" << endl; cout << " -i Non-root Install directory, Only use for non-root installs" << endl;
cout << " -n Non-distributed install, meaning postConfigure will not install packages on remote nodes" << endl; cout << " -n Non-distributed install, meaning postConfigure will not install packages on remote nodes" << endl;
cout << " -d Distributed install, meaning postConfigure will install packages on remote nodes" << endl; cout << " -d Distributed install, meaning postConfigure will install packages on remote nodes" << endl;
cout << " -sn System Name" << endl; cout << " -sn System Name" << endl;
cout << " -pm-ip-addrs Performance Module IP Addresses xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx" << endl; cout << " -pm-ip-addrs Performance Module IP Addresses xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx" << endl;
cout << " -um-ip-addrs User Module IP Addresses xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx" << endl; cout << " -um-ip-addrs User Module IP Addresses xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx" << endl;
cout << " -x Do not resolve IP Addresses from host names" << endl;
exit (0); exit (0);
}
else if (string("-x") == argv[i])
{
doNotResolveHostNames = true;
} }
else if( string("-qs") == argv[i] ) else if( string("-qs") == argv[i] )
{ {
@ -349,33 +355,33 @@ int main(int argc, char* argv[])
nodeps = "--nodeps"; nodeps = "--nodeps";
else if ( string("-o") == argv[i] ) else if ( string("-o") == argv[i] )
startOfflinePrompt = true; startOfflinePrompt = true;
else if( string("-c") == argv[i] ) else if( string("-c") == argv[i] )
{ {
i++; i++;
if (i >= argc ) if (i >= argc )
{ {
cout << " ERROR: Config File not provided" << endl; cout << " ERROR: Config File not provided" << endl;
exit (1); exit (1);
} }
oldFileName = argv[i]; oldFileName = argv[i];
if ( oldFileName.find("Columnstore.xml") == string::npos ) if ( oldFileName.find("Columnstore.xml") == string::npos )
{ {
cout << " ERROR: Config File is not a Columnstore.xml file name" << endl; cout << " ERROR: Config File is not a Columnstore.xml file name" << endl;
exit (1); exit (1);
} }
} }
else if( string("-p") == argv[i] ) else if( string("-p") == argv[i] )
{ {
i++; i++;
if (i >= argc ) if (i >= argc )
{ {
cout << " ERROR: Password not provided" << endl; cout << " ERROR: Password not provided" << endl;
exit (1); exit (1);
} }
password = argv[i]; password = argv[i];
if ( password.find("-") != string::npos ) if ( password.find("-") != string::npos )
{ {
cout << " ERROR: Valid Password not provided" << endl; cout << " ERROR: Valid Password not provided" << endl;
exit (1); exit (1);
@ -394,10 +400,10 @@ int main(int argc, char* argv[])
nonDistribute = false; nonDistribute = false;
nonDistributeFlag = true; nonDistributeFlag = true;
} }
else if( string("-port") == argv[i] ) else if( string("-port") == argv[i] )
{ {
i++; i++;
if (i >= argc ) if (i >= argc )
{ {
cout << " ERROR: MariaDB ColumnStore Port ID not supplied" << endl; cout << " ERROR: MariaDB ColumnStore Port ID not supplied" << endl;
exit (1); exit (1);
@ -411,10 +417,10 @@ int main(int argc, char* argv[])
exit (1); exit (1);
} }
} }
else if( string("-i") == argv[i] ) else if( string("-i") == argv[i] )
{ {
i++; i++;
if (i >= argc ) if (i >= argc )
{ {
cout << " ERROR: Path not provided" << endl; cout << " ERROR: Path not provided" << endl;
exit (1); exit (1);
@ -422,50 +428,50 @@ int main(int argc, char* argv[])
installDir = argv[i]; installDir = argv[i];
} }
else if( string("-sn") == argv[i] ) else if( string("-sn") == argv[i] )
{ {
i++; i++;
if (i >= argc ) if (i >= argc )
{ {
cout << " ERROR: System-name not provided" << endl; cout << " ERROR: System-name not provided" << endl;
exit (1); exit (1);
} }
systemName = argv[i]; systemName = argv[i];
} }
else if( string("-pm-ip-addrs") == argv[i] ) else if( string("-pm-ip-addrs") == argv[i] )
{ {
i++; i++;
if (i >= argc ) if (i >= argc )
{ {
cout << " ERROR: PM-IP-ADRESSES not provided" << endl; cout << " ERROR: PM-IP-ADRESSES not provided" << endl;
exit (1); exit (1);
} }
pmIpAddrs = argv[i]; pmIpAddrs = argv[i];
} }
else if( string("-um-ip-addrs") == argv[i] ) else if( string("-um-ip-addrs") == argv[i] )
{ {
i++; i++;
if (i >= argc ) if (i >= argc )
{ {
cout << " ERROR: UM-IP-ADRESSES not provided" << endl; cout << " ERROR: UM-IP-ADRESSES not provided" << endl;
exit (1); exit (1);
} }
umIpAddrs = argv[i]; umIpAddrs = argv[i];
} }
else if( string("-pm-count") == argv[i] ) else if( string("-pm-count") == argv[i] )
{ {
i++; i++;
if (i >= argc ) if (i >= argc )
{ {
cout << " ERROR: PM-COUNT not provided" << endl; cout << " ERROR: PM-COUNT not provided" << endl;
exit (1); exit (1);
} }
pmNumber = atoi(argv[i]); pmNumber = atoi(argv[i]);
} }
else if( string("-um-count") == argv[i] ) else if( string("-um-count") == argv[i] )
{ {
i++; i++;
if (i >= argc ) if (i >= argc )
{ {
cout << " ERROR: UM-COUNT not provided" << endl; cout << " ERROR: UM-COUNT not provided" << endl;
exit (1); exit (1);
@ -479,7 +485,7 @@ int main(int argc, char* argv[])
exit (1); exit (1);
} }
} }
//check if quick install multi-server has been given ip address //check if quick install multi-server has been given ip address
if (multi_server_quick_install) if (multi_server_quick_install)
{ {
@ -553,7 +559,7 @@ int main(int argc, char* argv[])
// redirectStandardOutputToFile(postConfigureLog, false ); // redirectStandardOutputToFile(postConfigureLog, false );
} }
} }
//check if MariaDB ColumnStore is up and running //check if MariaDB ColumnStore is up and running
if (oam.checkSystemRunning()) if (oam.checkSystemRunning())
{ {
@ -567,7 +573,7 @@ int main(int argc, char* argv[])
cout << "ERROR: Configuration File not setup" << endl; cout << "ERROR: Configuration File not setup" << endl;
exit(1); exit(1);
} }
//determine package type //determine package type
string EEPackageType; string EEPackageType;
@ -605,7 +611,7 @@ int main(int argc, char* argv[])
cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl;
exit(1); exit(1);
} }
//check for local ip address as pm1 //check for local ip address as pm1
ModuleConfig moduleconfig; ModuleConfig moduleconfig;
@ -789,7 +795,7 @@ int main(int argc, char* argv[])
} }
cout << endl; cout << endl;
if (single_server_quick_install) if (single_server_quick_install)
{ {
cout << "===== Quick Install Single-Server Configuration =====" << endl << endl; cout << "===== Quick Install Single-Server Configuration =====" << endl << endl;
@ -797,13 +803,13 @@ int main(int argc, char* argv[])
cout << "Single-Server install is used when there will only be 1 server configured" << endl; cout << "Single-Server install is used when there will only be 1 server configured" << endl;
cout << "on the system. It can also be used for production systems, if the plan is" << endl; cout << "on the system. It can also be used for production systems, if the plan is" << endl;
cout << "to stay single-server." << endl; cout << "to stay single-server." << endl;
singleServerInstall = "1"; singleServerInstall = "1";
} }
else if (multi_server_quick_install) else if (multi_server_quick_install)
{ {
cout << "===== Quick Install Multi-Server Configuration =====" << endl << endl; cout << "===== Quick Install Multi-Server Configuration =====" << endl << endl;
cout << "Multi-Server install defaulting to using local storage" << endl; cout << "Multi-Server install defaulting to using local storage" << endl;
singleServerInstall = "2"; singleServerInstall = "2";
@ -811,7 +817,7 @@ int main(int argc, char* argv[])
else if (amazon_quick_install) else if (amazon_quick_install)
{ {
cout << "===== Quick Install Amazon Configuration =====" << endl << endl; cout << "===== Quick Install Amazon Configuration =====" << endl << endl;
cout << "Amazon AMI EC2 install defaulting to using local storage" << endl; cout << "Amazon AMI EC2 install defaulting to using local storage" << endl;
singleServerInstall = "2"; singleServerInstall = "2";
@ -842,7 +848,7 @@ int main(int argc, char* argv[])
else else
singleServerInstall = "2"; singleServerInstall = "2";
while(true) while(true)
{ {
string temp = singleServerInstall; string temp = singleServerInstall;
prompt = "Select the type of System Server install [1=single, 2=multi] (" + singleServerInstall + ") > "; prompt = "Select the type of System Server install [1=single, 2=multi] (" + singleServerInstall + ") > ";
@ -889,7 +895,7 @@ int main(int argc, char* argv[])
//setup to Columnstore.xml file for single server //setup to Columnstore.xml file for single server
singleServerConfigSetup(sysConfig); singleServerConfigSetup(sysConfig);
} }
//module ProcessConfig.xml to setup all apps on the pm //module ProcessConfig.xml to setup all apps on the pm
if ( !updateProcessConfig() ) if ( !updateProcessConfig() )
cout << "Update ProcessConfig.xml error" << endl; cout << "Update ProcessConfig.xml error" << endl;
@ -967,7 +973,7 @@ int main(int argc, char* argv[])
} }
// perform multi-node install // perform multi-node install
try try
{ {
sysConfig->setConfig(InstallSection, "SingleServerInstall", "n"); sysConfig->setConfig(InstallSection, "SingleServerInstall", "n");
@ -987,7 +993,7 @@ int main(int argc, char* argv[])
// //
// Multi-server install // Multi-server install
// //
ModuleIP InputModuleIP; ModuleIP InputModuleIP;
ModuleIpList InputModuleIPList; ModuleIpList InputModuleIPList;
@ -1001,7 +1007,7 @@ int main(int argc, char* argv[])
} }
catch(...) catch(...)
{} {}
if (umIpAddrs == "" ) if (umIpAddrs == "" )
{ {
// set Server Type Installation to combined // set Server Type Installation to combined
@ -1026,10 +1032,10 @@ int main(int argc, char* argv[])
InputModuleIP.moduleName = module; InputModuleIP.moduleName = module;
InputModuleIPList.push_back(InputModuleIP); InputModuleIPList.push_back(InputModuleIP);
} }
umNumber = id-1; umNumber = id-1;
} }
if (pmIpAddrs != "" ) if (pmIpAddrs != "" )
{ {
int id = 1; int id = 1;
@ -1045,16 +1051,16 @@ int main(int argc, char* argv[])
InputModuleIP.moduleName = module; InputModuleIP.moduleName = module;
InputModuleIPList.push_back(InputModuleIP); InputModuleIPList.push_back(InputModuleIP);
} }
pmNumber = id-1; pmNumber = id-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;
exit(1); exit(1);
} }
MaxNicID = 1; MaxNicID = 1;
} }
else else
@ -1067,13 +1073,13 @@ int main(int argc, char* argv[])
} }
catch(...) catch(...)
{} {}
try { try {
sysConfig->setConfig(InstallSection, "Cloud", "amazon-vpc"); sysConfig->setConfig(InstallSection, "Cloud", "amazon-vpc");
} }
catch(...) catch(...)
{} {}
if (umNumber == 0 ) if (umNumber == 0 )
{ {
// set Server Type Installation to combined // set Server Type Installation to combined
@ -1084,12 +1090,12 @@ int main(int argc, char* argv[])
{} {}
} }
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;
exit(1); exit(1);
} }
MaxNicID = 1; MaxNicID = 1;
} }
} }
@ -1350,7 +1356,7 @@ int main(int argc, char* argv[])
//amazon install setup check //amazon install setup check
bool amazonInstall = false; bool amazonInstall = false;
string cloud = oam::UnassignedName; string cloud = oam::UnassignedName;
if (!multi_server_quick_install) if (!multi_server_quick_install)
{ {
string amazonLog = tmpDir + "/amazon.log"; string amazonLog = tmpDir + "/amazon.log";
@ -1367,7 +1373,7 @@ int main(int argc, char* argv[])
// not running on amazon with ec2-api-tools // not running on amazon with ec2-api-tools
if (amazon_quick_install) if (amazon_quick_install)
{ {
cout << "ERROR: Amazon Quick Installer was specified, bu the Amazon CLI API packages isnt installed, exiting" << endl; cout << "ERROR: Amazon Quick Installer was specified, but the Amazon CLI API packages is not installed, exiting" << endl;
exit(1); exit(1);
} }
@ -1380,7 +1386,7 @@ int main(int argc, char* argv[])
// not running on amazon with ec2-api-tools // not running on amazon with ec2-api-tools
if (amazon_quick_install) if (amazon_quick_install)
{ {
cout << "ERROR: Amazon Quick Installer was specified, bu the AMazon CLI API packages isnt installed, exiting" << endl; cout << "ERROR: Amazon Quick Installer was specified, but the Amazon CLI API packages is not installed, exiting" << endl;
exit(1); exit(1);
} }
@ -1390,7 +1396,7 @@ int main(int argc, char* argv[])
amazonInstall = true; amazonInstall = true;
} }
} }
try try
{ {
cloud = sysConfig->getConfig(InstallSection, "Cloud"); cloud = sysConfig->getConfig(InstallSection, "Cloud");
@ -1717,13 +1723,6 @@ int main(int argc, char* argv[])
// are we using settings from previous config file? // are we using settings from previous config file?
if ( reuseConfig == "n" ) if ( reuseConfig == "n" )
{ {
string numBlocksPct; string numBlocksPct;
try try
@ -1877,14 +1876,14 @@ int main(int argc, char* argv[])
catch (...) catch (...)
{} {}
} }
if ( moduleType == "um") if ( moduleType == "um")
if ( umNumber != 0 ) if ( umNumber != 0 )
moduleCount = umNumber; moduleCount = umNumber;
if ( moduleType == "pm") if ( moduleType == "pm")
if ( pmNumber != 0 ) if ( pmNumber != 0 )
moduleCount = pmNumber; moduleCount = pmNumber;
//verify and setup of modules count //verify and setup of modules count
switch ( IserverTypeInstall ) switch ( IserverTypeInstall )
@ -2044,7 +2043,7 @@ int main(int argc, char* argv[])
moduleDisableState = oam::ENABLEDSTATE; moduleDisableState = oam::ENABLEDSTATE;
//setup HostName/IPAddress for each NIC //setup HostName/IPAddress for each NIC
string moduleHostName = oam::UnassignedName; string moduleHostName = oam::UnassignedName;
string moduleIPAddr = oam::UnassignedIpAddr; string moduleIPAddr = oam::UnassignedIpAddr;
@ -2063,7 +2062,7 @@ int main(int argc, char* argv[])
} }
} }
} }
unsigned int nicID=1; unsigned int nicID=1;
for( ; nicID < MaxNicID +1 ; nicID++ ) for( ; nicID < MaxNicID +1 ; nicID++ )
{ {
@ -2076,9 +2075,9 @@ int main(int argc, char* argv[])
for( ; listPT != sysModuleTypeConfig.moduletypeconfig[i].ModuleNetworkList.end() ; listPT++) for( ; listPT != sysModuleTypeConfig.moduletypeconfig[i].ModuleNetworkList.end() ; listPT++)
{ {
if (newModuleName == (*listPT).DeviceName) if (newModuleName == (*listPT).DeviceName)
{ {
if ( nicID == 1 ) if ( nicID == 1 )
{ {
moduleDisableState = (*listPT).DisableState; moduleDisableState = (*listPT).DisableState;
@ -2091,7 +2090,7 @@ int main(int argc, char* argv[])
for( ; pt1 != (*listPT).hostConfigList.end() ; pt1++) for( ; pt1 != (*listPT).hostConfigList.end() ; pt1++)
{ {
if ((*pt1).NicID == nicID) if ((*pt1).NicID == nicID)
{ {
moduleHostName = (*pt1).HostName; moduleHostName = (*pt1).HostName;
moduleIPAddr = (*pt1).IPAddr; moduleIPAddr = (*pt1).IPAddr;
@ -2103,8 +2102,8 @@ int main(int argc, char* argv[])
} }
} }
} }
if ( nicID == 1 ) if ( nicID == 1 )
{ {
if ( moduleDisableState != oam::ENABLEDSTATE ) if ( moduleDisableState != oam::ENABLEDSTATE )
{ {
@ -2452,7 +2451,11 @@ int main(int argc, char* argv[])
if ( moduleIPAddr == oam::UnassignedIpAddr ) if ( moduleIPAddr == oam::UnassignedIpAddr )
{ {
//get IP Address //get IP Address
string IPAddress = oam.getIPAddress( newModuleHostName); string IPAddress;
if (doNotResolveHostNames)
IPAddress = newModuleHostName;
else
IPAddress = oam.getIPAddress( newModuleHostName);
if ( !IPAddress.empty() ) if ( !IPAddress.empty() )
newModuleIPAddr = IPAddress; newModuleIPAddr = IPAddress;
@ -2468,7 +2471,7 @@ int main(int argc, char* argv[])
//prompt for IP address //prompt for IP address
while (true) while (true)
{ {
prompt = "Enter Nic Interface #" + oam.itoa(nicID) + " IP Address of " + newModuleHostName + " (" + newModuleIPAddr + ") > "; prompt = "Enter Nic Interface #" + oam.itoa(nicID) + " IP Address or hostname of " + newModuleHostName + " (" + newModuleIPAddr + ") > ";
pcommand = callReadline(prompt.c_str()); pcommand = callReadline(prompt.c_str());
if (pcommand) if (pcommand)
@ -2489,7 +2492,7 @@ int main(int argc, char* argv[])
continue; continue;
} }
if (oam.isValidIP(newModuleIPAddr)) if (oam.isValidIP(newModuleIPAddr) || doNotResolveHostNames)
{ {
//check and see if hostname already used //check and see if hostname already used
bool matchFound = false; bool matchFound = false;
@ -2948,7 +2951,7 @@ int main(int argc, char* argv[])
} }
} }
} }
vector <string> dbroots; vector <string> dbroots;
string tempdbrootList; string tempdbrootList;
@ -3497,7 +3500,7 @@ int main(int argc, char* argv[])
} }
if ( IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM || if ( IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM ||
pmNumber > 1 ) pmNumber > 1 )
{ {
if ( password.empty() ) if ( password.empty() )
{ {
@ -3531,10 +3534,10 @@ int main(int argc, char* argv[])
if ( p1 == p2 ) { if ( p1 == p2 ) {
password = p2; password = p2;
break; break;
} }
else else
cout << "Password mismatch, please re-enter" << endl; cout << "Password mismatch, please re-enter" << endl;
} }
//add single quote for special characters //add single quote for special characters
if ( password != "ssh" ) if ( password != "ssh" )
@ -3543,7 +3546,7 @@ int main(int argc, char* argv[])
} }
} }
} }
} }
int thread_id = 0; int thread_id = 0;
@ -3824,7 +3827,7 @@ int main(int argc, char* argv[])
cout << " DONE" << endl; cout << " DONE" << endl;
} }
} }
//configure data redundancy //configure data redundancy
if (DataRedundancy) if (DataRedundancy)
{ {
@ -3897,7 +3900,7 @@ int main(int argc, char* argv[])
{ {
cout << endl << "===== Configuring MariaDB ColumnStore Data Redundancy Functionality =====" << endl << endl; cout << endl << "===== Configuring MariaDB ColumnStore Data Redundancy Functionality =====" << endl << endl;
if (!glusterSetup(password)) if (!glusterSetup(password, doNotResolveHostNames))
{ {
cout << "ERROR: Problem setting up ColumnStore Data Redundancy" << endl; cout << "ERROR: Problem setting up ColumnStore Data Redundancy" << endl;
exit(1); exit(1);
@ -4039,7 +4042,7 @@ int main(int argc, char* argv[])
} }
} }
} }
string dbbuilderLog = tmpDir + "/dbbuilder.log"; string dbbuilderLog = tmpDir + "/dbbuilder.log";
if (hdfs) if (hdfs)
@ -4060,7 +4063,7 @@ int main(int argc, char* argv[])
//send message to procmon's to run upgrade script //send message to procmon's to run upgrade script
int status = sendUpgradeRequest(IserverTypeInstall, pmwithum); int status = sendUpgradeRequest(IserverTypeInstall, pmwithum);
if ( status != 0 ) { if ( status != 0 ) {
cout << endl << "MariaDB Columnstore Install Failed" << endl << endl; cout << endl << "MariaDB Columnstore Install Failed" << endl << endl;
exit(1); exit(1);
@ -4423,7 +4426,7 @@ bool updateProcessConfig()
vector <string> oldModule; vector <string> oldModule;
string newModule = ">pm"; string newModule = ">pm";
oldModule.push_back(">um"); oldModule.push_back(">um");
string fileName = installDir + "/etc/ProcessConfig.xml"; string fileName = installDir + "/etc/ProcessConfig.xml";
//Save a copy of the original version //Save a copy of the original version
@ -4564,9 +4567,9 @@ bool uncommentCalpontXml( string entry)
*/ */
bool makeRClocal(string moduleType, string moduleName, int IserverTypeInstall) bool makeRClocal(string moduleType, string moduleName, int IserverTypeInstall)
{ {
return true; return true;
vector <string> lines; vector <string> lines;
string mount1; string mount1;
@ -5147,7 +5150,7 @@ bool storageSetup(bool amazonInstall)
//check if hadoop is installed //check if hadoop is installed
string hadoopLog = tmpDir + "/hadoop.log"; string hadoopLog = tmpDir + "/hadoop.log";
string cmd = "which hadoop > " + hadoopLog + " 2>&1"; string cmd = "which hadoop > " + hadoopLog + " 2>&1";
system(cmd.c_str()); system(cmd.c_str());
@ -5732,7 +5735,7 @@ void setSystemName()
Oam oam; Oam oam;
//setup System Name //setup System Name
if ( systemName.empty() ) if ( systemName.empty() )
{ {
try { try {
@ -5743,7 +5746,7 @@ void setSystemName()
systemName = oam::UnassignedName; systemName = oam::UnassignedName;
} }
} }
if ( systemName.empty() ) if ( systemName.empty() )
systemName = "columnstore-1"; systemName = "columnstore-1";
@ -5759,7 +5762,7 @@ void setSystemName()
callFree(pcommand); callFree(pcommand);
} }
} }
try try
{ {
sysConfig->setConfig(SystemSection, "SystemName", systemName); sysConfig->setConfig(SystemSection, "SystemName", systemName);
@ -6275,7 +6278,7 @@ std::string launchInstance(ModuleIP moduleip)
return instanceName; return instanceName;
} }
bool glusterSetup(string password) bool glusterSetup(string password, bool doNotResolveHostNames)
{ {
Oam oam; Oam oam;
int dataRedundancyCopies = 0; int dataRedundancyCopies = 0;
@ -6429,10 +6432,14 @@ bool glusterSetup(string password)
callFree(pcommand); callFree(pcommand);
} }
if ( moduleIPAddr == oam::UnassignedIpAddr ) if ( moduleIPAddr == oam::UnassignedIpAddr)
{ {
//get IP Address //get IP Address
string IPAddress = oam.getIPAddress( moduleHostName); string IPAddress;
if (doNotResolveHostNames)
IPAddress = moduleHostName;
else
IPAddress = oam.getIPAddress( moduleHostName);
if ( !IPAddress.empty() ) if ( !IPAddress.empty() )
moduleIPAddr = IPAddress; moduleIPAddr = IPAddress;
@ -6467,7 +6474,7 @@ bool glusterSetup(string password)
continue; continue;
} }
if (oam.isValidIP(moduleIPAddr)) if (oam.isValidIP(moduleIPAddr) || doNotResolveHostNames)
{ {
// run ping test to validate // run ping test to validate
@ -6926,7 +6933,7 @@ bool glusterSetup(string password)
void singleServerConfigSetup(Config* sysConfig) void singleServerConfigSetup(Config* sysConfig)
{ {
try try
{ {
sysConfig->setConfig("ExeMgr1", "IPAddr", "127.0.0.1"); sysConfig->setConfig("ExeMgr1", "IPAddr", "127.0.0.1");

View File

@ -2205,10 +2205,15 @@ void processMSG(messageqcpp::IOSocket* cfIos)
string value; string value;
uint16_t count, ivalue, nicCount; uint16_t count, ivalue, nicCount;
uint8_t tmp8;
oam::DeviceNetworkConfig devicenetworkconfig; oam::DeviceNetworkConfig devicenetworkconfig;
oam::DeviceNetworkList devicenetworklist; oam::DeviceNetworkList devicenetworklist;
oam::HostConfig hostconfig; oam::HostConfig hostconfig;
bool storeHostnames;
msg >> tmp8;
storeHostnames = (tmp8 != 0);
//get module count to add //get module count to add
msg >> count; msg >> count;
@ -2223,7 +2228,7 @@ void processMSG(messageqcpp::IOSocket* cfIos)
devicenetworkconfig.UserTempDeviceName = value; devicenetworkconfig.UserTempDeviceName = value;
msg >> value; msg >> value;
devicenetworkconfig.DisableState = value; devicenetworkconfig.DisableState = value;
msg >> nicCount; msg >> nicCount;
for (int j = 0 ; j < nicCount ; j ++ ) for (int j = 0 ; j < nicCount ; j ++ )
@ -2244,7 +2249,7 @@ void processMSG(messageqcpp::IOSocket* cfIos)
string password; string password;
msg >> password; msg >> password;
status = processManager.addModule(devicenetworklist, password); status = processManager.addModule(devicenetworklist, password, storeHostnames);
log.writeLog(__LINE__, "ADDMODULE: ACK received from Process-Monitor, return status = " + oam.itoa(status)); log.writeLog(__LINE__, "ADDMODULE: ACK received from Process-Monitor, return status = " + oam.itoa(status));
} }
@ -4835,7 +4840,8 @@ int ProcessManager::reinitProcessType( std::string processName )
* purpose: Add Module to system configuration * purpose: Add Module to system configuration
* *
******************************************************************************************/ ******************************************************************************************/
int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::string password, bool manualFlag) int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::string password, bool storeHostnames,
bool manualFlag)
{ {
ProcessLog log; ProcessLog log;
Configuration config; Configuration config;
@ -5262,7 +5268,10 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
} }
hostconfig.HostName = hostName; hostconfig.HostName = hostName;
hostconfig.IPAddr = IPAddr; if (storeHostnames)
hostconfig.IPAddr = hostName;
else
hostconfig.IPAddr = IPAddr;
hostconfig.NicID = (*pt1).NicID; hostconfig.NicID = (*pt1).NicID;
devicenetworkconfig.hostConfigList.push_back(hostconfig); devicenetworkconfig.hostConfigList.push_back(hostconfig);
} }

View File

@ -416,7 +416,8 @@ public:
/** /**
*@brief Add Module *@brief Add Module
*/ */
int addModule(oam::DeviceNetworkList devicenetworklist, std::string password, bool manualFlag = true); int addModule(oam::DeviceNetworkList devicenetworklist, std::string password, bool storeHostnames,
bool manualFlag = true);
/** /**
*@brief Configure Module *@brief Configure Module