1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-12-24 14:20:59 +03:00

MCOL-61, ami install

This commit is contained in:
David Hill
2016-11-20 22:47:54 +00:00
parent 591ff9326f
commit 9ce117f521
2 changed files with 110 additions and 81 deletions

View File

@@ -5984,7 +5984,15 @@ namespace oam
//format attached volume
writeLog("addUMdisk - Format new Volume for: " + volumeName, LOG_TYPE_DEBUG);
string cmd = "mkfs.ext2 -F " + device + " > /dev/null 2>&1";
string cmd;
int user;
user = getuid();
if (user == 0)
cmd = "mkfs.ext2 -F " + device + " > /dev/null 2>&1";
else
cmd = "sudo mkfs.ext2 -F " + device + " > /dev/null 2>&1";
system(cmd.c_str());
//detach volume
@@ -6202,7 +6210,13 @@ namespace oam
//format attached volume
cout << " Formatting DBRoot #" << itoa(*pt1) << ", please wait..." << endl;
string cmd = "mkfs.ext2 -F " + amazonDeviceName + " > /tmp/format.log 2>&1";
string cmd;
int user;
user = getuid();
if (user == 0)
cmd = "mkfs.ext2 -F " + amazonDeviceName + " > /tmp/format.log 2>&1";
else
cmd = "sudo mkfs.ext2 -F " + amazonDeviceName + " > /tmp/format.log 2>&1";
writeLog("addDbroot format cmd: " + cmd, LOG_TYPE_DEBUG );
@@ -8555,7 +8569,11 @@ namespace oam
return "";
//update /etc/fstab with mount
string entry = device + " " + InstallDir + "/data" + dbrootID + " ext2 noatime,nodiratime,noauto 0 0";
string entry;
if (user == 0)
entry = device + " " + InstallDir + "/data" + dbrootID + " ext2 noatime,nodiratime,noauto 0 0";
else
entry = device + " " + InstallDir + "/data" + dbrootID + " ext2 noatime,nodiratime,noauto,user 0 0";
//update local fstab
if (user == 0)

View File

@@ -861,12 +861,12 @@ int main(int argc, char *argv[])
exit(0);
}
if ( ready == "y" )
break;
cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl;
if ( noPrompting )
exit(1);
if ( ready != "y" )
{
cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl;
if ( noPrompting )
exit(1);
}
}
try {
@@ -925,28 +925,30 @@ int main(int argc, char *argv[])
if( !copyKeyfiles() )
cout << "copyKeyfiles error" << endl;
try {
AmazonRegion = sysConfig->getConfig(InstallSection, "AmazonRegion");
}
catch(...)
{}
cout << endl;
prompt = "Enter Amazon Region you are running in (" + AmazonRegion + ") > ";
pcommand = callReadline(prompt.c_str());
if (pcommand) {
if (strlen(pcommand) > 0) AmazonRegion = pcommand;
callFree(pcommand);
}
try {
sysConfig->setConfig(InstallSection, "AmazonRegion", AmazonRegion);
}
catch(...)
{}
break;
}
try {
AmazonRegion = sysConfig->getConfig(InstallSection, "AmazonRegion");
}
catch(...)
{}
cout << endl;
prompt = "Enter Amazon Region you are running in (" + AmazonRegion + ") > ";
pcommand = callReadline(prompt.c_str());
if (pcommand) {
if (strlen(pcommand) > 0) AmazonRegion = pcommand;
callFree(pcommand);
}
try {
sysConfig->setConfig(InstallSection, "AmazonRegion", AmazonRegion);
}
catch(...)
{}
if ( !writeConfig(sysConfig) ) {
cout << "ERROR: Failed trying to update MariaDB Columnstore System Configuration file" << endl;
exit(1);
@@ -954,54 +956,51 @@ int main(int argc, char *argv[])
sleep(1);
if ( amazonInstall )
{
//get subnetID
try {
amazonSubNet = sysConfig->getConfig(InstallSection, "AmazonSubNetID");
}
catch(...)
{}
//get subnetID
try {
amazonSubNet = sysConfig->getConfig(InstallSection, "AmazonSubNetID");
}
catch(...)
{}
if ( amazonSubNet == oam::UnassignedName )
{
//check if this is a vpc system by checking for subnet setup
amazonSubNet = oam.getEC2LocalInstanceSubnet();
// cout << "amazonSubNet = " << amazonSubNet << endl;
if ( amazonSubNet == "failed" || amazonSubNet == "" )
{
amazonSubNet = oam::UnassignedName;
cloud = "amazon-ec2";
}
else
{
cloud = "amazon-vpc";
}
if ( amazonSubNet == oam::UnassignedName )
{
//check if this is a vpc system by checking for subnet setup
amazonSubNet = oam.getEC2LocalInstanceSubnet();
// cout << "amazonSubNet = " << amazonSubNet << endl;
if ( amazonSubNet == "failed" || amazonSubNet == "" )
{
amazonSubNet = oam::UnassignedName;
cloud = "amazon-ec2";
}
else
{
cloud = "amazon-vpc";
}
//set subnetID
try {
sysConfig->setConfig(InstallSection, "AmazonSubNetID", amazonSubNet);
}
catch(...)
{}
}
else
cloud = "amazon-vpc";
try {
sysConfig->setConfig(InstallSection, "Cloud", cloud);
}
catch(...)
{}
//set subnetID
try {
sysConfig->setConfig(InstallSection, "AmazonSubNetID", amazonSubNet);
}
catch(...)
{}
}
else
{
try {
sysConfig->setConfig(InstallSection, "Cloud", oam::UnassignedName);
}
catch(...)
{}
cloud = "amazon-vpc";
try {
sysConfig->setConfig(InstallSection, "Cloud", cloud);
}
catch(...)
{}
}
else
{
try {
sysConfig->setConfig(InstallSection, "Cloud", oam::UnassignedName);
}
catch(...)
{}
}
if ( pmwithum )
@@ -2711,6 +2710,7 @@ int main(int argc, char *argv[])
/* create a thread_data_t argument array */
thread_data_t thr_data[childmodulelist.size()];
string install = "y";
if ( IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM ||
pmNumber > 1 ) {
//
@@ -2718,7 +2718,6 @@ int main(int argc, char *argv[])
//
cout << endl << "===== System Installation =====" << endl << endl;
string install = "y";
cout << "System Configuration is complete, System Installation is the next step." << endl;
while(true)
@@ -2783,13 +2782,22 @@ int main(int argc, char *argv[])
}
if ( EEPackageType == "rpm" )
cout << "Performing an MariaDB Columnstore System install using RPM packages located in the " + HOME + " directory." << endl;
{
cout << "Performing an MariaDB Columnstore System install using RPM packages" << endl;
cout << " located in the " + HOME + " directory." << endl;
}
else
{
if ( EEPackageType == "binary" )
cout << "Performing an MariaDB Columnstore System install using a Binary package located in the " + HOME + " directory." << endl;
{
cout << "Performing an MariaDB Columnstore System install using a Binary package" << endl;
cout << "located in the " + HOME + " directory." << endl;
}
else
cout << "Performing an MariaDB Columnstore System install using using DEB packages located in the " + HOME + " directory." << endl;
{
cout << "Performing an MariaDB Columnstore System install using using DEB packages" << endl;
cout << "located in the " + HOME + " directory." << endl;
}
}
//Write out Updated System Configuration File
@@ -3355,16 +3363,19 @@ int main(int argc, char *argv[])
string remoteModuleName = (*list1).moduleName;
string remoteModuleIP = (*list1).moduleIP;
string remoteHostName = (*list1).hostName;
//run remote command script
cout << endl << "----- Starting MariaDB Columnstore on '" + remoteModuleName + "' -----" << endl << endl;
cmd = installDir + "/bin/remote_scp_put.sh " + remoteModuleIP + " " + installDir + "/etc/Columnstore.xml > /dev/null 2>&1";
if ( install == "n" )
{ // didnt do a full install, push the config file
cmd = installDir + "/bin/remote_scp_put.sh " + remoteModuleIP + " " + installDir + "/etc/Columnstore.xml > /dev/null 2>&1";
system(cmd.c_str());
}
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/bin/columnstore restart' 0";
int rtnCode = system(cmd.c_str());
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password +
" '" + installDir + "/bin/columnstore restart' 0";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0)
cout << "Error with running remote_command.sh" << endl;
else