From 67bc2a459d62eea07a4e1f8c6e6b7436e5ae18ad Mon Sep 17 00:00:00 2001 From: David Hill Date: Tue, 13 Dec 2016 14:56:10 -0600 Subject: [PATCH 01/31] MCOL-464 --- oam/install_scripts/module_installer.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/oam/install_scripts/module_installer.sh b/oam/install_scripts/module_installer.sh index 74c53d833..1bce1f049 100755 --- a/oam/install_scripts/module_installer.sh +++ b/oam/install_scripts/module_installer.sh @@ -54,10 +54,10 @@ fi export COLUMNSTORE_INSTALL_DIR=$installdir cloud=`$COLUMNSTORE_INSTALL_DIR/bin/getConfig Installation Cloud` -if [ $module = "pm" ]; then - if [ $cloud = "amazon-ec2" ] || [ $cloud = "amazon-vpc" ]; then - cp $COLUMNSTORE_INSTALL_DIR/local/etc/*.pem /root/. > /dev/null 2>&1 - +if [ $cloud = "amazon-ec2" ] || [ $cloud = "amazon-vpc" ]; then + cp $COLUMNSTORE_INSTALL_DIR/local/etc/*.pem $HOME/. > /dev/null 2>&1 + + if [ $module = "pm" ]; then if test -f $COLUMNSTORE_INSTALL_DIR/local/etc/pm1/fstab ; then echo "Setup fstab on Module" touch /etc/fstab From 0eefa09eaf7f8a819e566871999b43f8f0f2bb14 Mon Sep 17 00:00:00 2001 From: David Hill Date: Tue, 13 Dec 2016 16:09:08 -0600 Subject: [PATCH 02/31] MCOL-453 --- oamapps/mcsadmin/mcsadmin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oamapps/mcsadmin/mcsadmin.cpp b/oamapps/mcsadmin/mcsadmin.cpp index 0cd92e44e..64b07576e 100644 --- a/oamapps/mcsadmin/mcsadmin.cpp +++ b/oamapps/mcsadmin/mcsadmin.cpp @@ -5569,7 +5569,7 @@ int processCommand(string* arguments) if ( localModule != parentOAMModule ) { // exit out since not on Parent OAM Module - cout << endl << "**** addModule Failed : only should be run on the Parent OAM Module, which is '" << parentOAMModule << "'" << endl; + cout << endl << "**** removeModule Failed : only should be run on the Parent OAM Module, which is '" << parentOAMModule << "'" << endl; break; } From 52890e97a1764117f844797afec59d98d0447ebf Mon Sep 17 00:00:00 2001 From: david hill Date: Mon, 19 Dec 2016 16:22:37 -0600 Subject: [PATCH 03/31] MCOL-462 --- oam/cloud/MCSInstanceCmds.sh | 62 ++----- oam/cloud/MCSVolumeCmds.sh | 42 +---- oam/cloud/MCSgetCredentials.sh | 27 +++ oamapps/postConfigure/postConfigure.cpp | 218 ++++++++++-------------- 4 files changed, 140 insertions(+), 209 deletions(-) create mode 100644 oam/cloud/MCSgetCredentials.sh diff --git a/oam/cloud/MCSInstanceCmds.sh b/oam/cloud/MCSInstanceCmds.sh index 225fcbf69..d105a5dc9 100644 --- a/oam/cloud/MCSInstanceCmds.sh +++ b/oam/cloud/MCSInstanceCmds.sh @@ -109,35 +109,9 @@ export PATH=$path export EC2_HOME=$ec2 export JAVA_HOME=$java -# get Keys and region -AmazonAccessKeyFile=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonAccessKey` -if [ $AmazonAccessKeyFile == "unassigned" ]; then - echo "FAILED: missing Config Setting AmazonAccessKey : $AmazonAccessKeyfile" - exit 1 -fi - -AmazonSecretKeyFile=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonSecretKey` -if [ $AmazonSecretKeyFile == "unassigned" ]; then - echo "FAILED: missing Config Setting AmazonSecretKeyFile : $AmazonSecretKeyFile" - exit 1 -fi - -AmazonAccessKey=`cat $AmazonAccessKeyFile` -AmazonSecretKey=`cat $AmazonSecretKeyFile` - Region=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonRegion` subnet=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonSubNetID` -if test ! -f $AmazonAccessKeyfile ; then - echo "FAILED: missing AmazonAccessKeyfile : $AmazonAccessKeyfile" - exit 1 -fi - -if test ! -f $AmazonSecretKeyfile ; then - echo "FAILED: missing AmazonSecretKeyfile : $AmazonSecretKeyfile" - exit 1 -fi - #default instance to null instance="" @@ -145,7 +119,7 @@ describeInstanceFile="/tmp/describeInstance.txt" touch $describeInstanceFile describeInstance() { - ec2-describe-instances -O $AmazonAccessKey -W $AmazonSecretKey --region $Region > $describeInstanceFile 2>&1 + ec2-describe-instances --region $Region > $describeInstanceFile 2>&1 } #call at start up @@ -401,37 +375,37 @@ launchInstance() { if [ "$subnet" == "unassigned" ]; then #NOT VPC if [ "$instanceProfile" = "" ] || [ "$instanceProfile" = "default" ]; then - newInstance=`ec2-run-instances -O $AmazonAccessKey -W $AmazonSecretKey -k $key -g $group -t $instanceType -z $zone --region $Region $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + newInstance=`ec2-run-instances -k $key -g $group -t $instanceType -z $zone --region $Region $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` else - newInstance=`ec2-run-instances -O $AmazonAccessKey -W $AmazonSecretKey -k $key -g $group -t $instanceType -z $zone -p $instanceProfile --region $Region $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + newInstance=`ec2-run-instances -k $key -g $group -t $instanceType -z $zone -p $instanceProfile --region $Region $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` fi else # VPC if [ "$instanceProfile" = "" ] || [ "$instanceProfile" = "default" ]; then if [ "$group" != "default" ]; then if [ "$IPaddress" = "autoassign" ]; then - newInstance=`ec2-run-instances -O $AmazonAccessKey -W $AmazonSecretKey -k $key -g $group -t $instanceType -z $zone --region $Region -s $subnet $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + newInstance=`ec2-run-instances -k $key -g $group -t $instanceType -z $zone --region $Region -s $subnet $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` else - newInstance=`ec2-run-instances -O $AmazonAccessKey -W $AmazonSecretKey -k $key -g $group -t $instanceType -z $zone --region $Region -s $subnet --private-ip-address $IPaddress $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + newInstance=`ec2-run-instances -k $key -g $group -t $instanceType -z $zone --region $Region -s $subnet --private-ip-address $IPaddress $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` fi else if [ "$IPaddress" = "autoassign" ]; then - newInstance=`ec2-run-instances -O $AmazonAccessKey -W $AmazonSecretKey -k $key -t $instanceType -z $zone --region $Region -s $subnet $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + newInstance=`ec2-run-instances -k $key -t $instanceType -z $zone --region $Region -s $subnet $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` else - newInstance=`ec2-run-instances --O $AmazonAccessKey -W $AmazonSecretKey -k $key -t $instanceType -z $zone --region $Region -s $subnet --private-ip-address $IPaddress $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + newInstance=`ec2-run-instances - -k $key -t $instanceType -z $zone --region $Region -s $subnet --private-ip-address $IPaddress $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` fi fi else if [ "$group" != "default" ]; then if [ "$IPaddress" = "autoassign" ]; then - newInstance=`ec2-run-instances -O $AmazonAccessKey -W $AmazonSecretKey -k $key -g $group -t $instanceType -z $zone -p $instanceProfile --region $Region -s $subnet $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + newInstance=`ec2-run-instances -k $key -g $group -t $instanceType -z $zone -p $instanceProfile --region $Region -s $subnet $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` else - newInstance=`ec2-run-instances -O $AmazonAccessKey -W $AmazonSecretKey -k $key -g $group -t $instanceType -z $zone -p $instanceProfile --region $Region -s $subnet --private-ip-address $IPaddress $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + newInstance=`ec2-run-instances -k $key -g $group -t $instanceType -z $zone -p $instanceProfile --region $Region -s $subnet --private-ip-address $IPaddress $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` fi else if [ "$IPaddress" = "autoassign" ]; then - newInstance=`ec2-run-instances -O $AmazonAccessKey -W $AmazonSecretKey -k $key -t $instanceType -z $zone -p $instanceProfile --region $Region -s $subnet $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + newInstance=`ec2-run-instances -k $key -t $instanceType -z $zone -p $instanceProfile --region $Region -s $subnet $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` else - newInstance=`ec2-run-instances -O $AmazonAccessKey -W $AmazonSecretKey -k $key -t $instanceType -z $zone -p $instanceProfile --region $Region -s $subnet --private-ip-address $IPaddress $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + newInstance=`ec2-run-instances -k $key -t $instanceType -z $zone -p $instanceProfile --region $Region -s $subnet --private-ip-address $IPaddress $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` fi fi fi @@ -442,19 +416,19 @@ launchInstance() { terminateInstance() { #terminate Instance - ec2-terminate-instances -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $instanceName > /tmp/termInstanceInfo_$instanceName 2>&1 + ec2-terminate-instances --region $Region $instanceName > /tmp/termInstanceInfo_$instanceName 2>&1 return } stopInstance() { #terminate Instance - ec2-stop-instances -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $instanceName > /tmp/stopInstanceInfo_$instanceName 2>&1 + ec2-stop-instances --region $Region $instanceName > /tmp/stopInstanceInfo_$instanceName 2>&1 return } startInstance() { #terminate Instance - ec2-start-instances -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $instanceName > /tmp/startInstanceInfo_$instanceName 2>&1 + ec2-start-instances --region $Region $instanceName > /tmp/startInstanceInfo_$instanceName 2>&1 cat /tmp/startInstanceInfo_$instanceName | grep INSTANCE > /tmp/startInstanceStatus_$instanceName if [ `cat /tmp/startInstanceStatus_$instanceName | wc -c` -eq 0 ]; then @@ -469,10 +443,10 @@ assignElasticIP() { #terminate Instance if [ "$subnet" == "unassigned" ]; then - ec2-associate-address -O $AmazonAccessKey -W $AmazonSecretKey -i $instanceName $IPAddress > /tmp/assignElasticIPInfo_$IPAddress 2>&1 + ec2-associate-address -i $instanceName $IPAddress > /tmp/assignElasticIPInfo_$IPAddress 2>&1 else - EIP=`ec2-describe-addresses -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $IPAddress | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $4}'` - ec2-associate-address -O $AmazonAccessKey -W $AmazonSecretKey --region $Region -i $instanceName -a $EIP > /tmp/assignElasticIPInfo_$IPAddress 2>&1 + EIP=`ec2-describe-addresses --region $Region $IPAddress | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $4}'` + ec2-associate-address --region $Region -i $instanceName -a $EIP > /tmp/assignElasticIPInfo_$IPAddress 2>&1 fi cat /tmp/assignElasticIPInfo_$IPAddress | grep ADDRESS > /tmp/assignElasticIPStatus_$IPAddress @@ -487,7 +461,7 @@ assignElasticIP() { deassignElasticIP() { #terminate Instance - ec2-disassociate-address -O $AmazonAccessKey -W $AmazonSecretKey $IPAddress > /tmp/deassignElasticIPInfo_$IPAddress 2>&1 + ec2-disassociate-address $IPAddress > /tmp/deassignElasticIPInfo_$IPAddress 2>&1 cat /tmp/deassignElasticIPInfo_$IPAddress | grep ADDRESS > /tmp/deassignElasticIPStatus_$IPAddress if [ `cat /tmp/deassignElasticIPStatus_$IPAddress | wc -c` -eq 0 ]; then diff --git a/oam/cloud/MCSVolumeCmds.sh b/oam/cloud/MCSVolumeCmds.sh index 7bac1a7dc..51d1a1ecc 100644 --- a/oam/cloud/MCSVolumeCmds.sh +++ b/oam/cloud/MCSVolumeCmds.sh @@ -109,32 +109,6 @@ export PATH=$path export EC2_HOME=$ec2 export JAVA_HOME=$java -# get Keys and region -AmazonAccessKeyFile=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonAccessKey` -if [ $AmazonAccessKeyFile == "unassigned" ]; then - echo "FAILED: missing Config Setting AmazonAccessKey : $AmazonAccessKeyfile" - exit 1 -fi - -AmazonSecretKeyFile=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonSecretKey` -if [ $AmazonSecretKeyFile == "unassigned" ]; then - echo "FAILED: missing Config Setting AmazonSecretKeyFile : $AmazonSecretKeyFile" - exit 1 -fi - -AmazonAccessKey=`cat $AmazonAccessKeyFile` -AmazonSecretKey=`cat $AmazonSecretKeyFile` - -if test ! -f $AmazonAccessKeyfile ; then - echo "FAILED: missing AmazonAccessKeyfile : $AmazonAccessKeyfile" - exit 1 -fi - -if test ! -f $AmazonSecretKeyfile ; then - echo "FAILED: missing AmazonSecretKeyfile : $AmazonSecretKeyfile" - exit 1 -fi - Region=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonRegion` @@ -209,9 +183,9 @@ createvolume() { #create volume if [ $volumeType == "io1" ]; then - volume=`ec2-create-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region -z $zone -s $volumeSize -t $volumeType -iops $volumeIOPS | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + volume=`ec2-create-volume --region $Region -z $zone -s $volumeSize -t $volumeType -iops $volumeIOPS | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` else - volume=`ec2-create-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region -z $zone -s $volumeSize -t $volumeType | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + volume=`ec2-create-volume --region $Region -z $zone -s $volumeSize -t $volumeType | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` fi echo $volume @@ -220,7 +194,7 @@ createvolume() { describevolume() { #describe volume - ec2-describe-volumes -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1 + ec2-describe-volumes --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1 checkInfostatus echo $STATUS @@ -229,14 +203,14 @@ describevolume() { detachvolume() { #detach volume - ec2-detach-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1 + ec2-detach-volume --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1 checkInfostatus if [ $STATUS == "detaching" ]; then retries=1 while [ $retries -ne 60 ]; do #retry until it's attached - ec2-detach-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1 + ec2-detach-volume --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1 checkInfostatus if [ $STATUS == "available" ]; then @@ -266,7 +240,7 @@ detachvolume() { attachvolume() { #detach volume - ec2-attach-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName -i $instanceName -d $deviceName > /tmp/volumeInfo_$volumeName 2>&1 + ec2-attach-volume --region $Region $volumeName -i $instanceName -d $deviceName > /tmp/volumeInfo_$volumeName 2>&1 checkInfostatus if [ $STATUS == "attaching" -o $STATUS == "already-attached" ]; then @@ -300,13 +274,13 @@ attachvolume() { deletevolume() { #delete volume - ec2-delete-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName > /tmp/deletevolume_$volumeName 2>&1 + ec2-delete-volume --region $Region $volumeName > /tmp/deletevolume_$volumeName 2>&1 return } createTag() { #create tag - ec2-create-tags -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $resourceName --tag $tagName=$tagValue > /tmp/createTag_$volumeName 2>&1 + ec2-create-tags --region $Region $resourceName --tag $tagName=$tagValue > /tmp/createTag_$volumeName 2>&1 return } diff --git a/oam/cloud/MCSgetCredentials.sh b/oam/cloud/MCSgetCredentials.sh new file mode 100644 index 000000000..6d03d51db --- /dev/null +++ b/oam/cloud/MCSgetCredentials.sh @@ -0,0 +1,27 @@ +#! /bin/sh +# Get Amazon EC2 security-credentials, access and secret access keys +# +instance_profile=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/` +# + +if [ -z "$instance_profile" ]; then + exit 1; +fi + +aws_access_key_id=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep AccessKeyId | cut -d':' -f2 | sed 's/[^0-9A-Z]*//g'` + +if [ -z "$aws_access_key_id" ]; then + exit 1; +fi + +aws_secret_access_key=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep SecretAccessKey | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g'` + +if [ -z "$aws_secret_access_key_id" ]; then + exit 1; +fi + +# +export AWS_ACCESS_KEY_ID=${aws_access_key_id} +export AWS_SECRET_ACCESS_KEY=${aws_secret_access_key} + +exit 0 diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index e60a4a4b0..2b5c78e11 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -101,12 +101,9 @@ bool createDbrootDirs(string DBRootStorageType); bool pkgCheck(); bool storageSetup(bool amazonInstall); void setSystemName(); -bool checkInstanceRunning(string instanceName, string AmazonAccessKey, string AmazonSecretKey); -string getInstanceIP(string instanceName, string AmazonAccessKey, string AmazonSecretKey); -bool attachVolume(string instanceName, string volumeName, string deviceName, string dbrootPath); bool singleServerDBrootSetup(); bool copyFstab(string moduleName); -bool copyKeyfiles(); +bool attachVolume(string instanceName, string volumeName, string deviceName, string dbrootPath); void remoteInstallThread(void *); @@ -156,8 +153,6 @@ bool thread_remote_installer = true; string singleServerInstall = "1"; string reuseConfig ="n"; string oldFileName; -string AmazonAccessKey; -string AmazonSecretKey; string AmazonRegion; string glusterCopies; string glusterInstalled = "n"; @@ -836,139 +831,116 @@ int main(int argc, char *argv[]) catch(...) { cloud = oam::UnassignedName; - } + } - if ( cloud == "disable" ) - amazonInstall = false; + if ( cloud == "disable" ) + amazonInstall = false; if ( amazonInstall ) { if ( cloud == oam::UnassignedName ) { - while(true) { - string enable = "y"; - prompt = "Amazon AMI Tools installed, do you want to have ColumnStore utilize them [y,n] (y) > "; - pcommand = callReadline(prompt.c_str()); + while(true) { + string enable = "y"; + prompt = "Amazon AMI Tools installed, do you want to have ColumnStore utilize them [y,n] (y) > "; + pcommand = callReadline(prompt.c_str()); - if (pcommand) { - if (strlen(pcommand) > 0) enable = pcommand; - callFree(pcommand); - - if (enable == "n") { - amazonInstall = false; + if (pcommand) { + if (strlen(pcommand) > 0) enable = pcommand; + callFree(pcommand); + + if (enable == "n") { + amazonInstall = false; - try { - sysConfig->setConfig(InstallSection, "Cloud", "disable"); - } - catch(...) - {}; - - break; - } - } + try { + sysConfig->setConfig(InstallSection, "Cloud", "disable"); + } + catch(...) + {}; - if ( enable != "y" ) - { - cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl; - if ( noPrompting ) - exit(1); - } break; - } + } + } + + if ( enable != "y" ) + { + cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl; + if ( noPrompting ) + exit(1); + } + break; + } } if ( amazonInstall ) { - try { - AmazonAccessKey = sysConfig->getConfig(InstallSection, "AmazonAccessKey"); - AmazonSecretKey = sysConfig->getConfig(InstallSection, "AmazonSecretKey"); - } - catch(...) - {} - - cout << endl << "Amazon API Tools usage, these files will need to be installed on the local instance:" << endl << endl; - cout << " 1. File containing the Amazon Access Key" << endl; - cout << " 2. File containing the Amazon Secret Key" << endl << endl; - - while(true) { - string ready = "y"; - prompt = "Are these files installed and ready to continue [y,n] (y) > "; - pcommand = callReadline(prompt.c_str()); - if (pcommand) { - if (strlen(pcommand) > 0) ready = pcommand; - callFree(pcommand); - if (ready == "n") { - cout << endl << "Please Install these files and re-run postConfigure. exiting..." << endl; - exit(0); - } - - if ( ready != "y" ) - { - cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl; - if ( noPrompting ) - exit(1); - } + bool noKey = false; + string AWS_ACCESS_KEY_ID; + char* p= getenv("AWS_ACCESS_KEY_ID"); + if (p && *p) { + AWS_ACCESS_KEY_ID = p; + if ( AWS_ACCESS_KEY_ID.empty() ) + noKey = true; } + else + noKey = true; - try { - AmazonAccessKey = sysConfig->getConfig(InstallSection, "AmazonAccessKey"); - AmazonSecretKey = sysConfig->getConfig(InstallSection, "AmazonSecretKey"); - } - catch(...) - {} - - cout << endl; - - while(true) + if ( !noKey ) { - prompt = "Enter file name containing the Access Key (" + AmazonAccessKey + ") > "; - pcommand = callReadline(prompt.c_str()); - if (pcommand) { - if (strlen(pcommand) > 0) AmazonAccessKey = pcommand; - callFree(pcommand); - } - ifstream File (AmazonAccessKey.c_str()); - if (!File) { - cout << "Error: file not found, please re-enter" << endl; - if ( noPrompting ) - exit(1); + string AWS_SECRET_ACCESS_KEY_ID; + char* p= getenv("AWS_SECRET_ACCESS_KEY_ID"); + if (p && *p) { + AWS_SECRET_ACCESS_KEY_ID = p; + if ( AWS_SECRET_ACCESS_KEY_ID.empty() ) + noKey = true; + } + else + noKey = true; + } + + if ( noKey ) + { // now call the script to see if keys were passed in IAM role + string cmd = installDir + "/bin/MCSgetCredentials > /dev/null 2>&1"; + + noKey = false; + int rtnCode = system(cmd.c_str()); + if (WEXITSTATUS(rtnCode) != 0) + noKey = true; + else + { + string AWS_ACCESS_KEY_ID; + char* p= getenv("AWS_ACCESS_KEY_ID"); + if (p && *p) { + AWS_ACCESS_KEY_ID = p; + if ( AWS_ACCESS_KEY_ID.empty() ) + noKey = true; } else - break; - } + noKey = true; - while(true) - { - prompt = "Enter file name containing the Secret Key (" + AmazonSecretKey + ") > "; - pcommand = callReadline(prompt.c_str()); - if (pcommand) { - if (strlen(pcommand) > 0) AmazonSecretKey = pcommand; - callFree(pcommand); - } - ifstream File (AmazonSecretKey.c_str()); - if (!File) + if ( !noKey ) { - cout << "Error: file not found, please re-enter" << endl; - if ( noPrompting ) - exit(1); + string AWS_SECRET_ACCESS_KEY_ID; + char* p= getenv("AWS_SECRET_ACCESS_KEY_ID"); + if (p && *p) { + AWS_SECRET_ACCESS_KEY_ID = p; + if ( AWS_SECRET_ACCESS_KEY_ID.empty() ) + noKey = true; + } + else + noKey = true; } - else - break; + } + + if ( noKey ) + { + cout << endl << "Error returned from MCSgetCredentials" << endl; + cout << "No EC2 AMI Access/Secret Credituals set, check Amazon Install Doc" << endl; + exit(1); + } } - - try { - sysConfig->setConfig(InstallSection, "AmazonAccessKey", AmazonAccessKey); - sysConfig->setConfig(InstallSection, "AmazonSecretKey", AmazonSecretKey); - } - catch(...) - {} - - if( !copyKeyfiles() ) - cout << "copyKeyfiles error" << endl; - - break; } - + try { AmazonRegion = sysConfig->getConfig(InstallSection, "AmazonRegion"); } @@ -1044,8 +1016,6 @@ int main(int argc, char *argv[]) {} } - } - if ( pmwithum ) cout << endl << "NOTE: Local Query Feature is enabled" << endl; @@ -5019,20 +4989,6 @@ bool copyFstab(string moduleName) return true; } -/* - * Copy x.509 file - */ -bool copyKeyfiles() -{ - string cmd = "/bin/cp -f " + AmazonAccessKey + " " + installDir + "/local/etc/. > /dev/null 2>&1"; - system(cmd.c_str()); - - cmd = "/bin/cp -f " + AmazonSecretKey + " " + installDir + "/local/etc/. > /dev/null 2>&1"; - system(cmd.c_str()); - - return true; -} - /* * Create a module file From 7ade71eb0c95032acdd4d4c73fe7089fea00ef0e Mon Sep 17 00:00:00 2001 From: David Hill Date: Tue, 20 Dec 2016 15:47:27 -0600 Subject: [PATCH 04/31] MCOL-476 --- oamapps/mcsadmin/mcsadmin.cpp | 102 ++++---- oamapps/postConfigure/helpers.cpp | 20 +- oamapps/postConfigure/installer.cpp | 58 ++--- oamapps/postConfigure/postConfigure.cpp | 304 ++++++++++++------------ 4 files changed, 242 insertions(+), 242 deletions(-) diff --git a/oamapps/mcsadmin/mcsadmin.cpp b/oamapps/mcsadmin/mcsadmin.cpp index 64b07576e..d4ceeb76c 100644 --- a/oamapps/mcsadmin/mcsadmin.cpp +++ b/oamapps/mcsadmin/mcsadmin.cpp @@ -176,7 +176,7 @@ bool waitForStop() //------------------------------------------------------------------------------ void handleSigTerm(int i) { - std::cout << "Received SIGTERM to terminate MariaDB Columnstore Console..." << std::endl; + std::cout << "Received SIGTERM to terminate MariaDB ColumnStore Console..." << std::endl; } @@ -336,9 +336,9 @@ int main(int argc, char *argv[]) } else { - cout << endl << "MariaDB Columnstore Admin Console" << endl; + cout << endl << "MariaDB ColumnStore Admin Console" << endl; cout << " enter 'help' for list of commands" << endl; - cout << " enter 'exit' to exit the MariaDB Columnstore Command Console" << endl; + cout << " enter 'exit' to exit the MariaDB ColumnStore Command Console" << endl; cout << " use up/down arrows to recall commands" << endl << endl; // output current active alarm stats @@ -707,7 +707,7 @@ int processCommand(string* arguments) // close the log file writeLog("End of a command session!!!"); logFile.close(); - cout << "Exiting the MariaDB Columnstore Admin Console" << endl; + cout << "Exiting the MariaDB ColumnStore Admin Console" << endl; exit (0); } @@ -2091,7 +2091,7 @@ int processCommand(string* arguments) break; } - cout << endl << "This command stops the processing of applications on all Modules within the MariaDB Columnstore System" << endl; + cout << endl << "This command stops the processing of applications on all Modules within the MariaDB ColumnStore System" << endl; try { @@ -2208,7 +2208,7 @@ int processCommand(string* arguments) bool bDBRMReady = dbrm.isDBRMReady(); getFlags(arguments, gracefulTemp, ackTemp, suspendAnswer, bNeedsConfirm); - cout << endl << "This command stops the processing of applications on all Modules within the MariaDB Columnstore System" << endl; + cout << endl << "This command stops the processing of applications on all Modules within the MariaDB ColumnStore System" << endl; try { @@ -2310,7 +2310,7 @@ int processCommand(string* arguments) cmd = "pdsh -a '/" + startup::StartUp::installDir() + "/bin/columnstore stop' > /tmp/cc-stop.pdsh 2>&1"; system(cmd.c_str()); if (oam.checkLogStatus("/tmp/cc-stop.pdsh", "exit") ) { - cout << endl << "ERROR: Stopping MariaDB Columnstore Service failure, check /tmp/cc-stop.pdsh. exit..." << endl; + cout << endl << "ERROR: Stopping MariaDB ColumnStore Service failure, check /tmp/cc-stop.pdsh. exit..." << endl; } } else @@ -2355,7 +2355,7 @@ int processCommand(string* arguments) cmd = "pdsh -a '" + startup::StartUp::installDir() + "/bin/columnstore stop' > /tmp/cc-stop.pdsh 2>&1"; system(cmd.c_str()); if (oam.checkLogStatus("/tmp/cc-stop.pdsh", "exit") ) { - cout << endl << "ERROR: Stopping MariaDB Columnstore Service failure, check /tmp/cc-stop.pdsh. exit..." << endl; + cout << endl << "ERROR: Stopping MariaDB ColumnStore Service failure, check /tmp/cc-stop.pdsh. exit..." << endl; break; } } @@ -2451,7 +2451,7 @@ int processCommand(string* arguments) cmd = "pdsh -a '" + startup::StartUp::installDir() + "/bin/columnstore restart' > /tmp/cc-restart.pdsh 2>&1"; system(cmd.c_str()); if (oam.checkLogStatus("/tmp/cc-restart.pdsh", "exit") ) { - cout << endl << "ERROR: Restart MariaDB Columnstore Service failure, check /tmp/cc-restart.pdsh. exit..." << endl; + cout << endl << "ERROR: Restart MariaDB ColumnStore Service failure, check /tmp/cc-restart.pdsh. exit..." << endl; break; } } @@ -2670,7 +2670,7 @@ int processCommand(string* arguments) cmd = "pdsh -a '" + startup::StartUp::installDir() + "/bin/columnstore restart' > /tmp/cc-restart.pdsh 2>&1"; system(cmd.c_str()); if (oam.checkLogStatus("/tmp/cc-restart.pdsh", "exit") ) { - cout << endl << "ERROR: Restart MariaDB Columnstore Service failue, check /tmp/cc-restart.pdsh. exit..." << endl; + cout << endl << "ERROR: Restart MariaDB ColumnStore Service failue, check /tmp/cc-restart.pdsh. exit..." << endl; break; } } @@ -3357,7 +3357,7 @@ int processCommand(string* arguments) if ( MySQLRep == "y" && MySQLPasswordConfig == oam::UnassignedName ) { cout << endl; - string prompt = "MariaDB Columnstore Replication is enabled, is there a 'MariaDB Columnstore' Password configured in " + HOME + "/.my.cnf (y,n): "; + string prompt = "MariaDB ColumnStore Replication is enabled, is there a 'MariaDB ColumnStore' Password configured in " + HOME + "/.my.cnf (y,n): "; MySQLPasswordConfig = dataPrompt(prompt); } @@ -3525,7 +3525,7 @@ int processCommand(string* arguments) string configFileName; oam.getSystemConfig("SystemLogConfigFile", configFileName); - cout << endl << "MariaDB Columnstore System Log Configuration Data" << endl << endl; + cout << endl << "MariaDB ColumnStore System Log Configuration Data" << endl << endl; cout << "System Logging Configuration File being used: " << configFileName << endl << endl; @@ -3846,7 +3846,7 @@ int processCommand(string* arguments) BRM::DBRM dbrm; getFlags(arguments, gracefulTemp, ackTemp, suspendAnswer, bNeedsConfirm); - cout << endl << "This command suspends the DDL/DML writes to the MariaDB Columnstore Database" << endl; + cout << endl << "This command suspends the DDL/DML writes to the MariaDB ColumnStore Database" << endl; try { @@ -3927,7 +3927,7 @@ int processCommand(string* arguments) break; } - // stop writes to MariaDB Columnstore Database + // stop writes to MariaDB ColumnStore Database oam.SuspendWrites(gracefulTemp, ackTemp); } catch (exception& e) @@ -3945,11 +3945,11 @@ int processCommand(string* arguments) case 33: // resumeDatabaseWrites { if ( arguments[1] != "y" ) { - if (confirmPrompt("This command resumes the DDL/DML writes to the MariaDB Columnstore Database")) + if (confirmPrompt("This command resumes the DDL/DML writes to the MariaDB ColumnStore Database")) break; } - // resume writes to MariaDB Columnstore Database + // resume writes to MariaDB ColumnStore Database try{ SystemProcessStatus systemprocessstatus; @@ -3974,7 +3974,7 @@ int processCommand(string* arguments) } } oam.setSystemStatus(ACTIVE); - cout << endl << "Resume MariaDB Columnstore Database Writes Request successfully completed" << endl; + cout << endl << "Resume MariaDB ColumnStore Database Writes Request successfully completed" << endl; } catch (exception& e) { @@ -4536,7 +4536,7 @@ int processCommand(string* arguments) } catch(...) { - cout << "ERROR: Problem setting AmazonElasticModule in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting AmazonElasticModule in the MariaDB ColumnStore System Configuration file" << endl; break; } @@ -4650,7 +4650,7 @@ int processCommand(string* arguments) } catch(...) { - cout << "ERROR: Problem setting AmazonElasticModule in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting AmazonElasticModule in the MariaDB ColumnStore System Configuration file" << endl; break; } } @@ -4889,7 +4889,7 @@ int processCommand(string* arguments) catch(...) {} if ( MySQLRep == "y" ) { - string warning = "MariaDB Columnstore Replication Feature is already enabled"; + string warning = "MariaDB ColumnStore Replication Feature is already enabled"; // confirm request if (confirmPrompt(warning)) break; @@ -4915,7 +4915,7 @@ int processCommand(string* arguments) if ( MySQLPasswordConfig == oam::UnassignedName ) { cout << endl; - string prompt = "Is there a 'MariaDB Columnstore' Password configured on the MariaDB Columnstore Front-end Modules in " + HOME + "/.my.cnf (y,n): "; + string prompt = "Is there a 'MariaDB ColumnStore' Password configured on the MariaDB ColumnStore Front-end Modules in " + HOME + "/.my.cnf (y,n): "; MySQLPasswordConfig = dataPrompt(prompt); } @@ -4937,7 +4937,7 @@ int processCommand(string* arguments) try { oam.enableMySQLRep(password); - cout << endl << " Successful Enabling of MariaDB Columnstore Replication " << endl << endl; + cout << endl << " Successful Enabling of MariaDB ColumnStore Replication " << endl << endl; //display Primary UM Module / Master Node string PrimaryUMModuleName; @@ -4946,7 +4946,7 @@ int processCommand(string* arguments) } catch(...) {} - cout << " MariaDB Columnstore Replication Master Node is " << PrimaryUMModuleName << endl << endl; + cout << " MariaDB ColumnStore Replication Master Node is " << PrimaryUMModuleName << endl << endl; } catch (exception& e) { @@ -5596,7 +5596,7 @@ int processCommand(string* arguments) if ( arguments[3] != "y") { cout << endl << "!!!!! DESTRUCTIVE COMMAND !!!!!" << endl; - string warning = "This command does a remove a module from the MariaDB Columnstore System"; + string warning = "This command does a remove a module from the MariaDB ColumnStore System"; // confirm request if (confirmPrompt(warning)) break; @@ -5661,7 +5661,7 @@ int processCommand(string* arguments) if ( arguments[2] != "y") { cout << endl << "!!!!! DESTRUCTIVE COMMAND !!!!!" << endl; - string warning = "This command does a stop and remove a module from the MariaDB Columnstore System"; + string warning = "This command does a stop and remove a module from the MariaDB ColumnStore System"; // confirm request if (confirmPrompt(warning)) break; @@ -5869,7 +5869,7 @@ int processCommand(string* arguments) catch(...) {} if ( MySQLRep == "n" ) { - string warning = "MariaDB Columnstore Replication Feature is already disable"; + string warning = "MariaDB ColumnStore Replication Feature is already disable"; // confirm request if (confirmPrompt(warning)) break; @@ -5883,7 +5883,7 @@ int processCommand(string* arguments) if ( MySQLPasswordConfig == oam::UnassignedName ) { cout << endl; - string prompt = "Is there a 'MariaDB Columnstore' Password configured on the MariaDB Columnstore Front-end Modules in " + HOME + "/.my.cnf (y,n): "; + string prompt = "Is there a 'MariaDB ColumnStore' Password configured on the MariaDB ColumnStore Front-end Modules in " + HOME + "/.my.cnf (y,n): "; MySQLPasswordConfig = dataPrompt(prompt); } @@ -5905,7 +5905,7 @@ int processCommand(string* arguments) try { oam.disableMySQLRep(); - cout << endl << " Successful Disable of MariaDB Columnstore Replication " << endl; + cout << endl << " Successful Disable of MariaDB ColumnStore Replication " << endl; } catch (exception& e) { @@ -6662,7 +6662,7 @@ int processCommand(string* arguments) { // confirm request if ( arguments[2] != "y" ) { - if (confirmPrompt("This command stops the processing of applications on a Module within the MariaDB Columnstore System")) + if (confirmPrompt("This command stops the processing of applications on a Module within the MariaDB ColumnStore System")) break; } } @@ -6788,7 +6788,7 @@ int processCommand(string* arguments) // confirm request if ( arguments[2] != "y" ) { - if (confirmPrompt("This command starts the processing of applications on a Module within the MariaDB Columnstore System")) + if (confirmPrompt("This command starts the processing of applications on a Module within the MariaDB ColumnStore System")) break; } @@ -6934,7 +6934,7 @@ int ProcessSupportCommand(int CommandID, std::string arguments[]) { // give warning for Process-Monitor if ( arguments[1] == "ProcessManager" ) { - if (confirmPrompt("ProcessManager is the Interface for the Console and should only be removed as part of a MariaDB Columnstore Package installation")) + if (confirmPrompt("ProcessManager is the Interface for the Console and should only be removed as part of a MariaDB ColumnStore Package installation")) break; } else @@ -6942,7 +6942,7 @@ int ProcessSupportCommand(int CommandID, std::string arguments[]) if ( arguments[3] != "y" ) { getFlags(arguments, gracefulTemp, ackTemp, suspendAnswer, bNeedsConfirm); // confirm request - if (confirmPrompt("This command stops the processing of an application on a Module within the MariaDB Columnstore System")) + if (confirmPrompt("This command stops the processing of an application on a Module within the MariaDB ColumnStore System")) break; } } @@ -6997,7 +6997,7 @@ int ProcessSupportCommand(int CommandID, std::string arguments[]) if (arguments[3] != "y") { // confirm request - if (confirmPrompt("This command restarts the processing of an application on a Module within the MariaDB Columnstore System")) + if (confirmPrompt("This command restarts the processing of an application on a Module within the MariaDB ColumnStore System")) break; } @@ -7062,7 +7062,7 @@ int ProcessSupportCommand(int CommandID, std::string arguments[]) string password = arguments[1]; if ( arguments[2] != "y") { cout << endl << "!!!!! DESTRUCTIVE COMMAND !!!!!" << endl; - string warning = "This command stops the Processing of applications and reboots all modules within the MariaDB Columnstore System"; + string warning = "This command stops the Processing of applications and reboots all modules within the MariaDB ColumnStore System"; // confirm request if (confirmPrompt(warning)) break; @@ -7154,7 +7154,7 @@ int ProcessSupportCommand(int CommandID, std::string arguments[]) // close the log file writeLog("End of a command session!!!"); logFile.close(); - cout << endl << "Exiting the MariaDB Columnstore Command Console" << endl; + cout << endl << "Exiting the MariaDB ColumnStore Command Console" << endl; exit (0); } } @@ -7185,7 +7185,7 @@ int ProcessSupportCommand(int CommandID, std::string arguments[]) string password = arguments[2]; if ( arguments[3] != "y") { cout << endl << "!!!!! DESTRUCTIVE COMMAND !!!!!" << endl; - string warning = "This command reboots a node within the MariaDB Columnstore System"; + string warning = "This command reboots a node within the MariaDB ColumnStore System"; // confirm request if (confirmPrompt(warning)) break; @@ -7224,7 +7224,7 @@ int ProcessSupportCommand(int CommandID, std::string arguments[]) // close the log file writeLog("End of a command session!!!"); logFile.close(); - cout << endl << "Exiting the MariaDB Columnstore Command Console" << endl; + cout << endl << "Exiting the MariaDB ColumnStore Command Console" << endl; exit (0); } } @@ -7258,7 +7258,7 @@ int ProcessSupportCommand(int CommandID, std::string arguments[]) { if ( arguments[1] != "y" ) { // confirm request - if (confirmPrompt("This command stops the dbrm processes within the MariaDB Columnstore System")) + if (confirmPrompt("This command stops the dbrm processes within the MariaDB ColumnStore System")) break; } @@ -7292,7 +7292,7 @@ int ProcessSupportCommand(int CommandID, std::string arguments[]) { if ( arguments[1] != "y" ) { // confirm request - if (confirmPrompt("This command restarts the dbrm processes within the MariaDB Columnstore System")) + if (confirmPrompt("This command restarts the dbrm processes within the MariaDB ColumnStore System")) break; } @@ -7326,7 +7326,7 @@ int ProcessSupportCommand(int CommandID, std::string arguments[]) } catch(...) { - cout << "ERROR: Problem getting systemStartupOffline from the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem getting systemStartupOffline from the MariaDB ColumnStore System Configuration file" << endl; return 1; } @@ -7358,7 +7358,7 @@ int ProcessSupportCommand(int CommandID, std::string arguments[]) } catch(...) { - cout << "ERROR: Problem setting systemStartupOffline in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting systemStartupOffline in the MariaDB ColumnStore System Configuration file" << endl; exit(-1); } cout << endl << " Successful setting of systemStartupOffline to '" << systemStartupOffline << "'" << endl << endl; @@ -7369,7 +7369,7 @@ int ProcessSupportCommand(int CommandID, std::string arguments[]) { if ( arguments[1] != "y" ) { // confirm request - if (confirmPrompt("This command stops the PrimProc processes within the MariaDB Columnstore System")) + if (confirmPrompt("This command stops the PrimProc processes within the MariaDB ColumnStore System")) break; } @@ -7403,7 +7403,7 @@ int ProcessSupportCommand(int CommandID, std::string arguments[]) { if ( arguments[1] != "y" ) { // confirm request - if (confirmPrompt("This command restarts the PrimProc processes within the MariaDB Columnstore System")) + if (confirmPrompt("This command restarts the PrimProc processes within the MariaDB ColumnStore System")) break; } @@ -7423,7 +7423,7 @@ int ProcessSupportCommand(int CommandID, std::string arguments[]) { if ( arguments[1] != "y" ) { // confirm request - if (confirmPrompt("This command stops the ExeMgr processes within the MariaDB Columnstore System")) + if (confirmPrompt("This command stops the ExeMgr processes within the MariaDB ColumnStore System")) break; } @@ -7457,7 +7457,7 @@ int ProcessSupportCommand(int CommandID, std::string arguments[]) { if ( arguments[1] != "y" ) { // confirm request - if (confirmPrompt("This command restarts the ExeMgr processes within the MariaDB Columnstore System")) + if (confirmPrompt("This command restarts the ExeMgr processes within the MariaDB ColumnStore System")) break; } @@ -7489,11 +7489,11 @@ int ProcessSupportCommand(int CommandID, std::string arguments[]) try { oam.distributeConfigFile(name); - cout << endl << " Successful Distribution of MariaDB Columnstore Config File" << endl << endl; + cout << endl << " Successful Distribution of MariaDB ColumnStore Config File" << endl << endl; } catch (exception& e) { - cout << endl << "**** Distribution of MariaDB Columnstore Config File Failed : " << e.what() << endl; + cout << endl << "**** Distribution of MariaDB ColumnStore Config File Failed : " << e.what() << endl; } } break; @@ -8026,13 +8026,13 @@ void printSystemStatus() if ( moduletypeconfig.ModuleCount > 1 ) { if ( PrimaryUMModuleName != oam::UnassignedName ) - cout << "Primary Front-End MariaDB Columnstore Module is '" << PrimaryUMModuleName << "'" << endl; + cout << "Primary Front-End MariaDB ColumnStore Module is '" << PrimaryUMModuleName << "'" << endl; } } else { if ( PrimaryUMModuleName != oam::UnassignedName ) - cout << "Primary Front-End MariaDB Columnstore Module is '" << PrimaryUMModuleName << "'" << endl; + cout << "Primary Front-End MariaDB ColumnStore Module is '" << PrimaryUMModuleName << "'" << endl; } } @@ -8054,7 +8054,7 @@ void printSystemStatus() catch(...) {} if ( MySQLRep == "y" ) - cout << "MariaDB Columnstore Replication Feature is enabled" << endl << endl; + cout << "MariaDB ColumnStore Replication Feature is enabled" << endl << endl; } catch (exception& e) { @@ -8117,7 +8117,7 @@ void printProcessStatus(std::string port) } } - cout << endl << "MariaDB Columnstore Process statuses" << endl << endl; + cout << endl << "MariaDB ColumnStore Process statuses" << endl << endl; cout << "Process Module Status Last Status Change Process ID" << endl; cout << "------------------ ------ --------------- ------------------------ ----------" << endl; try diff --git a/oamapps/postConfigure/helpers.cpp b/oamapps/postConfigure/helpers.cpp index ea1a50343..8638bebba 100644 --- a/oamapps/postConfigure/helpers.cpp +++ b/oamapps/postConfigure/helpers.cpp @@ -436,7 +436,7 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, std::st returnStatus = sendMsgProcMon( (*pt).DeviceName, msg1, requestID, 600 ); if ( returnStatus != API_SUCCESS) { - cout << endl << "ERROR: Error return in running the MariaDB Columnstore Master DB Distribute, check /tmp/master-dist*.logs on " << masterModule << endl; + cout << endl << "ERROR: Error return in running the MariaDB ColumnStore Master DB Distribute, check /tmp/master-dist*.logs on " << masterModule << endl; return returnStatus; } @@ -448,7 +448,7 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, std::st returnStatus = sendMsgProcMon( (*pt).DeviceName, msg, requestID, 30 ); if ( returnStatus != API_SUCCESS) { - cout << endl << "ERROR: Error return in running the MariaDB Columnstore Master replication, check /tmp/master-rep*.logs on " << masterModule << endl; + cout << endl << "ERROR: Error return in running the MariaDB ColumnStore Master replication, check /tmp/master-rep*.logs on " << masterModule << endl; return returnStatus; } @@ -479,7 +479,7 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, std::st returnStatus = sendMsgProcMon( (*pt).DeviceName, msg, requestID, 30 ); if ( returnStatus != API_SUCCESS) { - cout << endl << "ERROR: Error return in running the MariaDB Columnstore Slave replication, check /tmp/slave-rep*.logs on " << (*pt).DeviceName << endl; + cout << endl << "ERROR: Error return in running the MariaDB ColumnStore Slave replication, check /tmp/slave-rep*.logs on " << (*pt).DeviceName << endl; return returnStatus; } @@ -677,12 +677,12 @@ void checkMysqlPort( std::string& mysqlPort, Config* sysConfig ) int size = oldFile.tellg(); if ( size != 0 ) { if ( noPrompting ) { - cout << endl << "The MariaDB Columnstore port of '" + mysqlPort + "' is already in-use" << endl; + cout << endl << "The MariaDB ColumnStore port of '" + mysqlPort + "' is already in-use" << endl; cout << "For No-prompt install, use the command line argument of 'port' to enter a different number" << endl; exit(1); } - cout << "The MariaDB Columnstore port of '" + mysqlPort + "' is already in-use on local server" << endl; + cout << "The MariaDB ColumnStore port of '" + mysqlPort + "' is already in-use on local server" << endl; while(true) { @@ -697,7 +697,7 @@ void checkMysqlPort( std::string& mysqlPort, Config* sysConfig ) if ( atoi(mysqlPort.c_str()) < 1000 || atoi(mysqlPort.c_str()) > 9999) { - cout << " ERROR: Invalid MariaDB Columnstore Port ID supplied, must be between 1000-9999" << endl; + cout << " ERROR: Invalid MariaDB ColumnStore Port ID supplied, must be between 1000-9999" << endl; } else break; @@ -755,7 +755,7 @@ void checkSystemMySQLPort(std::string& mysqlPort, Config* sysConfig, std::string int size = oldFile.tellg(); if ( size != 0 ) { if ( noPrompting ) { - cout << endl << "The MariaDB Columnstore port of '" + mysqlPort + "' is already in-use" << endl; + cout << endl << "The MariaDB ColumnStore port of '" + mysqlPort + "' is already in-use" << endl; cout << "For No-prompt install, use the command line argument of 'port' to enter a different number" << endl; exit(1); } @@ -786,7 +786,7 @@ void checkSystemMySQLPort(std::string& mysqlPort, Config* sysConfig, std::string int rtnCode = system(cmd.c_str()); if (WEXITSTATUS(rtnCode) == 0) { if ( noPrompting ) { - cout << endl << "The MariaDB Columnstore port of '" + mysqlPort + "' is already in-use on " << remoteModuleName << endl; + cout << endl << "The MariaDB ColumnStore port of '" + mysqlPort + "' is already in-use on " << remoteModuleName << endl; cout << "For No-prompt install, use the command line argument of 'port' to enter a different number" << endl; cout << "exiting..." << endl; exit(1); @@ -804,7 +804,7 @@ void checkSystemMySQLPort(std::string& mysqlPort, Config* sysConfig, std::string if ( inUse ) { - cout << endl << "The MariaDB Columnstore port of '" + mysqlPort + "' is already in-use on " << inUseServer << endl; + cout << endl << "The MariaDB ColumnStore port of '" + mysqlPort + "' is already in-use on " << inUseServer << endl; while(true) { @@ -819,7 +819,7 @@ void checkSystemMySQLPort(std::string& mysqlPort, Config* sysConfig, std::string if ( atoi(mysqlPort.c_str()) < 1000 || atoi(mysqlPort.c_str()) > 9999) { - cout << " ERROR: Invalid MariaDB Columnstore Port ID supplied, must be between 1000-9999" << endl; + cout << " ERROR: Invalid MariaDB ColumnStore Port ID supplied, must be between 1000-9999" << endl; } else break; diff --git a/oamapps/postConfigure/installer.cpp b/oamapps/postConfigure/installer.cpp index fcf87df2e..8ea9af62f 100644 --- a/oamapps/postConfigure/installer.cpp +++ b/oamapps/postConfigure/installer.cpp @@ -180,7 +180,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem getting ServerTypeInstall from the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem getting ServerTypeInstall from the MariaDB ColumnStore System Configuration file" << endl; exit(1); } IserverTypeInstall = atoi(serverTypeInstall.c_str()); @@ -205,7 +205,7 @@ int main(int argc, char *argv[]) case (oam::INSTALL_COMBINE_DM_UM_PM): // combined #1 - dm/um/pm on a single server { 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); } @@ -214,7 +214,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting RotatingDestination in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting RotatingDestination in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -225,7 +225,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem getting DB Storage Data from the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem getting DB Storage Data from the MariaDB ColumnStore System Configuration file" << endl; return false; } @@ -240,7 +240,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting NumBlocksPct in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting NumBlocksPct in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -266,7 +266,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting TotalUmMemory in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting TotalUmMemory in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } } @@ -286,7 +286,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting NumBlocksPct in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting NumBlocksPct in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } } @@ -297,13 +297,13 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem reading NumBlocksPct/TotalUmMemory in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem reading NumBlocksPct/TotalUmMemory in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } } 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); } @@ -330,7 +330,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting TotalUmMemory in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting TotalUmMemory in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } } @@ -349,13 +349,13 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem reading NumBlocksPct/TotalUmMemory in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem reading NumBlocksPct/TotalUmMemory in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } } 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); } @@ -365,7 +365,7 @@ int main(int argc, char *argv[]) } 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); } @@ -418,7 +418,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem reading the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem reading the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -700,17 +700,17 @@ int main(int argc, char *argv[]) if ( IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM ) { //run the mysql / mysqld setup scripts - cout << endl << "Running the MariaDB Columnstore setup scripts" << endl << endl; + cout << endl << "Running the MariaDB ColumnStore setup scripts" << endl << endl; // call the mysql setup scripts mysqlSetup(); sleep(5); } - cout << "System Install successfully completed, starting MariaDB Columnstore" << endl; + cout << "System Install successfully completed, starting MariaDB ColumnStore" << endl; // - // perform start of MariaDB Columnstore of other servers in the system + // perform start of MariaDB ColumnStore of other servers in the system // list1 = childmodulelist.begin(); @@ -733,9 +733,9 @@ int main(int argc, char *argv[]) //start on local module int rtnCode = system(idbstartcmd.c_str()); if (rtnCode != 0) - cout << "Error starting MariaDB Columnstore local module" << endl; + cout << "Error starting MariaDB ColumnStore local module" << endl; else - cout << "Start MariaDB Columnstore request successful" << endl; + cout << "Start MariaDB ColumnStore request successful" << endl; } else { @@ -745,7 +745,7 @@ int main(int argc, char *argv[]) if ( calpont_rpm1 != "dummy.rpm" ) { //run the mysql / mysqld setup scripts - cout << endl << "Running the MariaDB Columnstore setup scripts" << endl << endl; + cout << endl << "Running the MariaDB ColumnStore setup scripts" << endl << endl; // call the mysql setup scripts mysqlSetup(); @@ -754,9 +754,9 @@ int main(int argc, char *argv[]) //start on local module int rtnCode = system(idbstartcmd.c_str()); if (WEXITSTATUS(rtnCode) != 0) - cout << "Error starting MariaDB Columnstore local module" << endl; + cout << "Error starting MariaDB ColumnStore local module" << endl; else - cout << "Start MariaDB Columnstore request successful" << endl; + cout << "Start MariaDB ColumnStore request successful" << endl; } else { @@ -765,7 +765,7 @@ int main(int argc, char *argv[]) // //run the mysql / mysqld setup scripts - cout << endl << "Running the MariaDB Columnstore setup scripts" << endl << endl; + cout << endl << "Running the MariaDB ColumnStore setup scripts" << endl << endl; // call the mysql setup scripts mysqlSetup(); @@ -781,7 +781,7 @@ int main(int argc, char *argv[]) // check for system going ACTIVE sleep(5); - cout << endl << "MariaDB Columnstore Database Platform Starting, please wait ."; + cout << endl << "MariaDB ColumnStore Database Platform Starting, please wait ."; cout.flush(); if ( waitForActive() ) { @@ -801,19 +801,19 @@ int main(int argc, char *argv[]) } } - cout << endl << "MariaDB Columnstore Install Successfully Completed, System is Active" << endl << 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; + cout << "Enter the following command to define MariaDB ColumnStore Alias Commands" << endl << endl; cout << ". " + installDir + "/bin/columnstoreAlias" << endl << endl; - cout << "Enter 'mcsmysql' to access the MariaDB Columnstore SQL console" << endl; - cout << "Enter 'mcsadmin' to access the MariaDB Columnstore Admin console" << endl << endl; + cout << "Enter 'mcsmysql' to access the MariaDB ColumnStore SQL console" << endl; + cout << "Enter 'mcsadmin' to access the MariaDB ColumnStore Admin console" << endl << endl; } else { cout << " FAILED" << endl; - cout << endl << "ERROR: MariaDB Columnstore Process failed to start, check log files in /var/log/mariadb/columnstore" << endl; + cout << endl << "ERROR: MariaDB ColumnStore Process failed to start, check log files in /var/log/mariadb/columnstore" << endl; } } diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index 2b5c78e11..e9a5f31f4 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -258,8 +258,8 @@ int main(int argc, char *argv[]) { if( string("-h") == argv[i] ) { cout << endl; - cout << "This is the MariaDB Columnstore System Configuration and Installation tool." << endl; - cout << "It will Configure the MariaDB Columnstore System based on Operator inputs and" << endl; + cout << "This is the MariaDB ColumnStore System Configuration and Installation tool." << endl; + cout << "It will Configure the MariaDB ColumnStore System based on Operator inputs and" << endl; cout << "will perform a Package Installation of all of the Modules within the" << endl; cout << "System that is being configured." << endl; cout << endl; @@ -277,9 +277,9 @@ int main(int argc, char *argv[]) cout << " -u Upgrade, Install using the Config File from -c, default to Columnstore.xml.rpmsave" << endl; cout << " If ssh-keys aren't setup, you should provide passwords as command line arguments" << endl; cout << " -p Unix Password, used with no-prompting option" << endl; - cout << " -mp MariaDB Columnstore Password" << endl; + cout << " -mp MariaDB ColumnStore Password" << endl; cout << " -s Single Threaded Remote Install" << 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; exit (0); } @@ -316,12 +316,12 @@ int main(int argc, char *argv[]) else if( string("-mp") == argv[i] ) { i++; if (i >= argc ) { - cout << " ERROR: MariaDB Columnstore Password not provided" << endl; + cout << " ERROR: MariaDB ColumnStore Password not provided" << endl; exit (1); } mysqlpw = argv[i]; if ( mysqlpw.find("-") != string::npos ) { - cout << " ERROR: Valid MariaDB Columnstore Password not provided" << endl; + cout << " ERROR: Valid MariaDB ColumnStore Password not provided" << endl; exit (1); } if ( mysqlpw == "dummymysqlpw" ) @@ -335,13 +335,13 @@ int main(int argc, char *argv[]) else if( string("-port") == argv[i] ) { i++; if (i >= argc ) { - cout << " ERROR: MariaDB Columnstore Port ID not supplied" << endl; + cout << " ERROR: MariaDB ColumnStore Port ID not supplied" << endl; exit (1); } mysqlPort = argv[i]; if ( atoi(mysqlPort.c_str()) < 1000 || atoi(mysqlPort.c_str()) > 9999) { - cout << " ERROR: Invalid MariaDB Columnstore Port ID supplied, must be between 1000-9999" << endl; + cout << " ERROR: Invalid MariaDB ColumnStore Port ID supplied, must be between 1000-9999" << endl; exit (1); } } @@ -370,8 +370,8 @@ int main(int argc, char *argv[]) oldFileName = installDir + "/etc/Columnstore.xml.rpmsave"; cout << endl; - cout << "This is the MariaDB Columnstore System Configuration and Installation tool." << endl; - cout << "It will Configure the MariaDB Columnstore System and will perform a Package" << endl; + cout << "This is the MariaDB ColumnStore System Configuration and Installation tool." << endl; + cout << "It will Configure the MariaDB ColumnStore System and will perform a Package" << endl; cout << "Installation of all of the Servers within the System that is being configured." << endl; cout << endl; @@ -410,9 +410,9 @@ int main(int argc, char *argv[]) // redirectStandardOutputToFile(postConfigureLog, false ); } - //check if MariaDB Columnstore is up and running + //check if MariaDB ColumnStore is up and running if (oam.checkSystemRunning()) { - cout << "MariaDB Columnstore is running, can't run postConfigure while MariaDB Columnstore is running. Exiting.." << endl; + cout << "MariaDB ColumnStore is running, can't run postConfigure while MariaDB ColumnStore is running. Exiting.." << endl; exit (0); } @@ -570,7 +570,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting DBRoot Count in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DBRoot Count in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -585,11 +585,11 @@ int main(int argc, char *argv[]) checkMysqlPort(mysqlPort, 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); } - cout << endl << "===== Performing Configuration Setup and MariaDB Columnstore Startup =====" << endl; + cout << endl << "===== Performing Configuration Setup and MariaDB ColumnStore Startup =====" << endl; cmd = installDir + "/bin/installer dummy.rpm dummy.rpm dummy.rpm dummy.rpm dummy.rpm initial dummy " + reuseConfig + " --nodeps ' ' 1 " + installDir; system(cmd.c_str()); @@ -616,12 +616,12 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting SingleServerInstall from the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting SingleServerInstall from the MariaDB ColumnStore System Configuration file" << endl; exit(1); } 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); } @@ -647,7 +647,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem getting ServerTypeInstall from the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem getting ServerTypeInstall from the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -678,7 +678,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting ServerTypeInstall in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting ServerTypeInstall in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -687,7 +687,7 @@ int main(int argc, char *argv[]) { cout << "Combined Server Installation will be performed." << endl; cout << "The Server will be configured as a Performance Module." << endl; - cout << "All MariaDB Columnstore Processes will run on the Performance Modules." << endl << endl; + cout << "All MariaDB ColumnStore Processes will run on the Performance Modules." << endl << endl; //module ProcessConfig.xml to setup all apps on the dm if( !updateProcessConfig(IserverTypeInstall) ) @@ -740,7 +740,7 @@ int main(int argc, char *argv[]) string answer = "n"; cout << "NOTE: Local Query Feature allows the ability to query data from a single Performance" << endl; - cout << " Module. Check MariaDB Columnstore Admin Guide for additional information." << endl << endl; + cout << " Module. Check MariaDB ColumnStore Admin Guide for additional information." << endl << endl; while(true) { if ( pmwithum ) @@ -800,7 +800,7 @@ int main(int argc, char *argv[]) } 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); } @@ -963,7 +963,7 @@ int main(int argc, char *argv[]) {} 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); } @@ -1020,7 +1020,7 @@ int main(int argc, char *argv[]) cout << endl << "NOTE: Local Query Feature is enabled" << endl; if ( mysqlRep ) - cout << endl << "NOTE: MariaDB Columnstore Replication Feature is enabled" << endl; + cout << endl << "NOTE: MariaDB ColumnStore Replication Feature is enabled" << endl; //Write out Updated System Configuration File try { @@ -1028,12 +1028,12 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting InitialInstallFlag from the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting InitialInstallFlag from the MariaDB ColumnStore System Configuration file" << endl; exit(1); } 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); } @@ -1065,7 +1065,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting ParentOAMModuleName the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting ParentOAMModuleName the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -1076,7 +1076,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting ParentStandbyOAMModuleName the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting ParentStandbyOAMModuleName the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -1110,7 +1110,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem reading the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem reading the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -1164,7 +1164,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting NumBlocksPct in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting NumBlocksPct in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -1181,12 +1181,12 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting TotalUmMemory in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting TotalUmMemory in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } 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); } } @@ -1207,7 +1207,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem reading NumBlocksPct/TotalUmMemory in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem reading NumBlocksPct/TotalUmMemory in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } } @@ -1238,7 +1238,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting NumBlocksPct in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting NumBlocksPct in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -1254,12 +1254,12 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting TotalUmMemory in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting TotalUmMemory in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } 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); } } @@ -1279,7 +1279,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem reading NumBlocksPct/TotalUmMemory in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem reading NumBlocksPct/TotalUmMemory in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } } @@ -1293,12 +1293,12 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting InitialInstallFlag from the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting InitialInstallFlag from the MariaDB ColumnStore System Configuration file" << endl; exit(1); } 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); } @@ -1366,7 +1366,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting Module Count in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting Module Count in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } } @@ -1411,7 +1411,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting Module Count in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting Module Count in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } } @@ -1558,7 +1558,7 @@ int main(int argc, char *argv[]) else { string enable = "y"; - cout << "Module '" + newModuleName + "' is Disabled. It needs to be enabled to startup MariaDB Columnstore." << endl; + cout << "Module '" + newModuleName + "' is Disabled. It needs to be enabled to startup MariaDB ColumnStore." << endl; prompt = "Do you want to Enable it or exit? [y,exit] (y) > "; pcommand = callReadline(prompt.c_str()); if (pcommand) @@ -1599,12 +1599,12 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting ModuleDisableState in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting ModuleDisableState in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } 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); } @@ -1807,7 +1807,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting Host Name in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting Host Name in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -1922,7 +1922,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting IP address in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting IP address in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -2057,7 +2057,7 @@ int main(int argc, char *argv[]) } 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); } @@ -2172,12 +2172,12 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting Volume/Device Names in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting Volume/Device Names in the MariaDB ColumnStore System Configuration file" << endl; return false; } 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); } @@ -2211,7 +2211,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting DBRoot count in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DBRoot count in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -2238,7 +2238,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting DBRoot ID in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DBRoot ID in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } } @@ -2416,7 +2416,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting DBRoot ID in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DBRoot ID in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -2428,7 +2428,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting DBRoot in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DBRoot in the MariaDB ColumnStore System Configuration file" << endl; return false; } @@ -2552,12 +2552,12 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting Volume/Device Names in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting Volume/Device Names in the MariaDB ColumnStore System Configuration file" << endl; return false; } 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); } @@ -2576,7 +2576,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting DBRoot count in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DBRoot count in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } //total dbroots on the system @@ -2584,7 +2584,7 @@ int main(int argc, char *argv[]) } 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); } @@ -2601,7 +2601,7 @@ int main(int argc, char *argv[]) } 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); } @@ -2612,7 +2612,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting DBRoot Count in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DBRoot Count in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -2628,7 +2628,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting ConnectionsPerPrimProc in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting ConnectionsPerPrimProc in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -2683,7 +2683,7 @@ int main(int argc, char *argv[]) } 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); } @@ -2700,7 +2700,7 @@ int main(int argc, char *argv[]) } 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); } @@ -2709,7 +2709,7 @@ int main(int argc, char *argv[]) if ( IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM && pmNumber == 1) { //run the mysql / mysqld setup scripts - cout << endl << "===== Running the MariaDB Columnstore MariaDB Columnstore setup scripts =====" << endl << endl; + cout << endl << "===== Running the MariaDB ColumnStore MariaDB ColumnStore setup scripts =====" << endl << endl; checkMysqlPort(mysqlPort, sysConfig); @@ -2777,7 +2777,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem getting EEPackageType from the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem getting EEPackageType from the MariaDB ColumnStore System Configuration file" << endl; exit(1); } } @@ -2803,19 +2803,19 @@ int main(int argc, char *argv[]) if ( EEPackageType == "rpm" ) { - cout << "Performing an MariaDB Columnstore System install using RPM packages" << endl; + cout << "Performing an MariaDB ColumnStore System install using RPM packages" << endl; cout << "located in the " + HOME + " directory." << endl << endl; } else { if ( EEPackageType == "binary" ) { - cout << "Performing an MariaDB Columnstore System install using a Binary package" << endl; + cout << "Performing an MariaDB ColumnStore System install using a Binary package" << endl; cout << "located in the " + HOME + " directory." << endl << endl; } else { - cout << "Performing an MariaDB Columnstore System install using using DEB packages" << endl; + cout << "Performing an MariaDB ColumnStore System install using using DEB packages" << endl; cout << "located in the " + HOME + " directory." << endl; } } @@ -2826,12 +2826,12 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting EEPackageType from the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting EEPackageType from the MariaDB ColumnStore System Configuration file" << endl; exit(1); } 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); } @@ -2944,7 +2944,7 @@ int main(int argc, char *argv[]) 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; + cout << endl << "===== Running the MariaDB ColumnStore MariaDB ColumnStore setup scripts =====" << endl << endl; // call the mysql setup scripts mysqlSetup(); @@ -3034,8 +3034,8 @@ int main(int argc, char *argv[]) cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "bin/getMySQLpw > /tmp/mysqlpw.log 2>&1"; rtnCode = system(cmd.c_str()); if (WEXITSTATUS(rtnCode) != 0) { - cout << endl << "MariaDB Columnstore login failure, MySQL Root password is set." << endl; - cout << "Need MariaDB Columnstore password configuration file " + HOME + "/.my.cnf on " << remoteModuleName << endl; + cout << endl << "MariaDB ColumnStore login failure, MySQL Root password is set." << endl; + cout << "Need MariaDB ColumnStore password configuration file " + HOME + "/.my.cnf on " << remoteModuleName << endl; exit(1); } @@ -3051,20 +3051,20 @@ int main(int argc, char *argv[]) cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/mysql/bin/mysql --defaults-file=" + installDir + "/mysql/my.cnf -u root " + pwprompt + " -e status' 1 > /tmp/idbmysql.log 2>&1"; rtnCode = system(cmd.c_str()); if (WEXITSTATUS(rtnCode) != 0) { - cout << endl << "MariaDB Columnstore login failure, password mismatch in " + HOME + ".my.cnf on " << remoteModuleName << endl; + cout << endl << "MariaDB ColumnStore login failure, password mismatch in " + HOME + ".my.cnf on " << remoteModuleName << endl; exit(1); } } else { if (!oam.checkLogStatus("/tmp/idbmysql.log", "Columnstore") ) { - cout << endl << "ERROR: MariaDB Columnstore runtime error, exit..." << endl << endl; + cout << endl << "ERROR: MariaDB ColumnStore runtime error, exit..." << endl << endl; system("cat /tmp/idbmysql.log"); exit (1); } else { - cout << endl << "Additional MariaDB Columnstore Installation steps Successfully Completed on '" + remoteModuleName + "'" << endl << endl; + cout << endl << "Additional MariaDB ColumnStore Installation steps Successfully Completed on '" + remoteModuleName + "'" << endl << endl; cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/mysql/mysql-Columnstore stop'"; int rtnCode = system(cmd.c_str()); @@ -3202,7 +3202,7 @@ int main(int argc, char *argv[]) if ( thread_remote_installer ) { //wait until remove install Thread Count is at zero or hit timeout - cout << endl << "MariaDB Columnstore Package being installed, please wait ..."; + cout << endl << "MariaDB ColumnStore Package being installed, please wait ..."; cout.flush(); /* block until all threads complete */ @@ -3227,7 +3227,7 @@ int main(int argc, char *argv[]) while(true) { - pcommand = callReadline("Would you like to configure MariaDB Columnstore GlusterFS Data Redundancy? [y,n] (" + start + ") > "); + pcommand = callReadline("Would you like to configure MariaDB ColumnStore GlusterFS Data Redundancy? [y,n] (" + start + ") > "); if (pcommand) { if (strlen(pcommand) > 0) start = pcommand; @@ -3243,7 +3243,7 @@ int main(int argc, char *argv[]) } if ( start == "y" ) { - cout << endl << "===== Configuring MariaDB Columnstore Data Redundancy Functionality =====" << endl << endl; + cout << endl << "===== Configuring MariaDB ColumnStore Data Redundancy Functionality =====" << endl << endl; int ret = system(glusterconfig.c_str()); if ( WEXITSTATUS(ret) != 0 ) { @@ -3261,12 +3261,12 @@ int main(int argc, char *argv[]) {} 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); } - //check if local MariaDB Columnstore system logging is working - cout << endl << "===== Checking MariaDB Columnstore System Logging Functionality =====" << endl << endl; + //check if local MariaDB ColumnStore system logging is working + cout << endl << "===== Checking MariaDB ColumnStore System Logging Functionality =====" << endl << endl; if ( rootUser) cmd = installDir + "/bin/syslogSetup.sh install > /dev/null 2>&1"; @@ -3282,29 +3282,29 @@ int main(int argc, char *argv[]) int ret = system(cmd.c_str()); if ( WEXITSTATUS(ret) != 0) - cerr << "WARNING: The MariaDB Columnstore system logging not correctly setup and working" << endl; + cerr << "WARNING: The MariaDB ColumnStore system logging not correctly setup and working" << endl; else - cout << "The MariaDB Columnstore system logging is setup and working on local server" << endl; + cout << "The MariaDB ColumnStore system logging is setup and working on local server" << endl; - cout << endl << "MariaDB Columnstore System Configuration and Installation is Completed" << endl; + cout << endl << "MariaDB ColumnStore System Configuration and Installation is Completed" << endl; // - // startup MariaDB Columnstore + // startup MariaDB ColumnStore // if ( IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM || pmNumber > 1 ) { // - // perform MariaDB Columnstore system startup + // perform MariaDB ColumnStore system startup // - cout << endl << "===== MariaDB Columnstore System Startup =====" << endl << endl; + cout << endl << "===== MariaDB ColumnStore System Startup =====" << endl << endl; string start = "y"; cout << "System Installation is complete. If any part of the install failed," << endl; cout << "the problem should be investigated and resolved before continuing." << endl << endl; while(true) { - pcommand = callReadline("Would you like to startup the MariaDB Columnstore System? [y,n] (y) > "); + pcommand = callReadline("Would you like to startup the MariaDB ColumnStore System? [y,n] (y) > "); if (pcommand) { if (strlen(pcommand) > 0) start = pcommand; @@ -3323,11 +3323,11 @@ int main(int argc, char *argv[]) if (hdfs) { - cout << endl << "----- Starting MariaDB Columnstore Service on all Modules -----" << endl << endl; + cout << endl << "----- Starting MariaDB ColumnStore Service on all Modules -----" << endl << endl; string cmd = "pdsh -a '" + installDir + "/bin/columnstore restart' > /tmp/postConfigure.pdsh 2>&1"; system(cmd.c_str()); if (oam.checkLogStatus("/tmp/postConfigure.pdsh", "exit") ) { - cout << endl << "ERROR: Starting MariaDB Columnstore Service failue, check /tmp/postConfigure.pdsh. exit..." << endl; + cout << endl << "ERROR: Starting MariaDB ColumnStore Service failue, check /tmp/postConfigure.pdsh. exit..." << endl; exit (1); } } @@ -3384,7 +3384,7 @@ int main(int argc, char *argv[]) string remoteHostName = (*list1).hostName; //run remote command script - cout << endl << "----- Starting MariaDB Columnstore on '" + remoteModuleName + "' -----" << endl << endl; + cout << endl << "----- Starting MariaDB ColumnStore on '" + remoteModuleName + "' -----" << endl << endl; if ( install == "n" ) { // didnt do a full install, push the config file @@ -3398,39 +3398,39 @@ int main(int argc, char *argv[]) if (WEXITSTATUS(rtnCode) != 0) cout << "Error with running remote_command.sh" << endl; else - cout << "MariaDB Columnstore successfully started" << endl; + cout << "MariaDB ColumnStore successfully started" << endl; } - //start MariaDB Columnstore on local server - cout << endl << "----- Starting MariaDB Columnstore on local server -----" << endl << endl; + //start MariaDB ColumnStore on local server + cout << endl << "----- Starting MariaDB ColumnStore on local server -----" << endl << endl; cmd = installDir + "/bin/columnstore restart > /dev/null 2>&1"; int rtnCode = system(cmd.c_str()); if (WEXITSTATUS(rtnCode) != 0) { - cout << "Error Starting MariaDB Columnstore local module" << endl; + cout << "Error Starting MariaDB ColumnStore local module" << endl; cout << "Installation Failed, exiting" << endl; exit (1); } else - cout << "MariaDB Columnstore successfully started" << endl; + cout << "MariaDB ColumnStore successfully started" << endl; } } else { - cout << endl << "You choose not to Start the MariaDB Columnstore Software at this time." << endl; + cout << endl << "You choose not to Start the MariaDB ColumnStore Software at this time." << endl; exit (1); } } else // Single Server start { - cout << endl << "===== MariaDB Columnstore System Startup =====" << endl << endl; + cout << endl << "===== MariaDB ColumnStore System Startup =====" << endl << endl; string start = "y"; cout << "System Installation is complete." << endl; - cout << "If an error occurred while running the MariaDB Columnstore setup scripts," << endl; + cout << "If an error occurred while running the MariaDB ColumnStore setup scripts," << endl; cout << "this will need to be corrected and postConfigure will need to be re-run." << endl << endl; while(true) { - pcommand = callReadline("Would you like to startup the MariaDB Columnstore System? [y,n] (y) > "); + pcommand = callReadline("Would you like to startup the MariaDB ColumnStore System? [y,n] (y) > "); if (pcommand) { if (strlen(pcommand) > 0) start = pcommand; @@ -3446,26 +3446,26 @@ int main(int argc, char *argv[]) } if ( start == "y" ) { - //start MariaDB Columnstore on local server - cout << endl << "----- Starting MariaDB Columnstore on local Server '" + parentOAMModuleName + "' -----" << endl << endl; + //start MariaDB ColumnStore on local server + cout << endl << "----- Starting MariaDB ColumnStore on local Server '" + parentOAMModuleName + "' -----" << endl << endl; string cmd = installDir + "/bin/columnstore restart > /dev/null 2>&1"; int rtnCode = system(cmd.c_str()); if (WEXITSTATUS(rtnCode) != 0) { - cout << "Error Starting MariaDB Columnstore local module" << endl; + cout << "Error Starting MariaDB ColumnStore local module" << endl; cout << "Installation Failed, exiting" << endl; exit (1); } else - cout << endl << "MariaDB Columnstore successfully started" << endl; + cout << endl << "MariaDB ColumnStore successfully started" << endl; } else { - cout << endl << "You choose not to Start the MariaDB Columnstore Software at this time." << endl; + cout << endl << "You choose not to Start the MariaDB ColumnStore Software at this time." << endl; exit (1); } } - cout << endl << "MariaDB Columnstore Database Platform Starting, please wait ."; + cout << endl << "MariaDB ColumnStore Database Platform Starting, please wait ."; cout.flush(); if ( waitForActive() ) { @@ -3491,7 +3491,7 @@ int main(int argc, char *argv[]) // int status = sendUpgradeRequest(IserverTypeInstall, pmwithum); // if ( status != 0 ) { -// cout << endl << "MariaDB Columnstore Install Failed" << endl << endl; +// cout << endl << "MariaDB ColumnStore Install Failed" << endl << endl; // exit(1); // } // else @@ -3510,33 +3510,33 @@ int main(int argc, char *argv[]) ( mysqlRep && (umNumber > 1) ) || ( mysqlRep && (pmNumber > 1) && (IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM) ) ) { - cout << endl << "Run MariaDB Columnstore Replication Setup.. "; + cout << endl << "Run MariaDB ColumnStore Replication Setup.. "; cout.flush(); //send message to procmon's to run upgrade script int status = sendReplicationRequest(IserverTypeInstall, password, mysqlPort, pmwithum); if ( status != 0 ) { - cout << endl << " MariaDB Columnstore Install Failed" << endl << endl; + cout << endl << " MariaDB ColumnStore Install Failed" << endl << endl; exit(1); } else cout << " DONE" << endl; } - cout << endl << "MariaDB Columnstore Install Successfully Completed, System is Active" << endl << 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; + cout << "Enter the following command to define MariaDB ColumnStore Alias Commands" << endl << endl; cout << ". " + installDir + "/bin/columnstoreAlias" << endl << endl; - cout << "Enter 'mcsmysql' to access the MariaDB Columnstore SQL console" << endl; - cout << "Enter 'mcsadmin' to access the MariaDB Columnstore Admin console" << endl << endl; + cout << "Enter 'mcsmysql' to access the MariaDB ColumnStore SQL console" << endl; + cout << "Enter 'mcsadmin' to access the MariaDB ColumnStore Admin console" << endl << endl; } else { cout << " FAILED" << endl; - cout << endl << "MariaDB Columnstore System failed to start, check log files in /var/log/mariadb/columnstore" << endl; + cout << endl << "MariaDB ColumnStore System failed to start, check log files in /var/log/mariadb/columnstore" << endl; exit(1); } @@ -3594,14 +3594,14 @@ bool checkSaveConfigFile() singleServerInstall = "2"; if ( !noPrompting ) { - cout << endl << "A copy of the MariaDB Columnstore Configuration file has been saved during Package install." << endl; + cout << endl << "A copy of the MariaDB ColumnStore Configuration file has been saved during Package install." << endl; if ( singleServerInstall == "1") cout << "It's Configured for a Single Server Install." << endl; else cout << "It's Configured for a Multi-Server Install." << endl; cout << "You have an option of utilizing the configuration data from that file or starting" << endl; - cout << "with the MariaDB Columnstore Configuration File that comes with the MariaDB Columnstore Package." << endl; + cout << "with the MariaDB ColumnStore Configuration File that comes with the MariaDB ColumnStore Package." << endl; cout << "You will only want to utilize the old configuration data when performing the same" << endl; cout << "type of install, i.e. Single or Multi-Server" << endl; } @@ -4116,7 +4116,7 @@ bool pkgCheck() while(true) { - pcommand = callReadline("Please place a copy of the MariaDB Columnstore Packages in directory " + HOME + " and press to continue or enter 'exit' to exit the install > "); + pcommand = callReadline("Please place a copy of the MariaDB ColumnStore Packages in directory " + HOME + " and press to continue or enter 'exit' to exit the install > "); if (pcommand) { if (strcmp(pcommand, "exit") == 0) { @@ -4150,7 +4150,7 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem getting DB Storage Data from the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem getting DB Storage Data from the MariaDB ColumnStore System Configuration file" << endl; return false; } @@ -4203,7 +4203,7 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem setting DataFilePlugin in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DataFilePlugin in the MariaDB ColumnStore System Configuration file" << endl; return false; } @@ -4212,12 +4212,12 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem setting DataFileEnvFile in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DataFileEnvFile in the MariaDB ColumnStore System Configuration file" << endl; return false; } 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; return false; } @@ -4262,18 +4262,18 @@ bool storageSetup(bool amazonInstall) // get Frontend Data storage type // - cout << "----- Setup User Module MariaDB Columnstore Data Storage Mount Configuration -----" << endl << endl; + cout << "----- Setup User Module MariaDB ColumnStore Data Storage Mount Configuration -----" << endl << endl; cout << "There are 2 options when configuring the storage: internal and external" << endl << endl; cout << " 'internal' - This is specified when a local disk is used for the Data storage." << endl << endl; - cout << " 'external' - This is specified when the MariaDB Columnstore Data directory is externally mounted." << endl << endl; + cout << " 'external' - This is specified when the MariaDB ColumnStore Data directory is externally mounted." << endl << endl; try { UMStorageType = sysConfig->getConfig(InstallSection, "UMStorageType"); } catch(...) { - cout << "ERROR: Problem getting UM DB Storage Data from the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem getting UM DB Storage Data from the MariaDB ColumnStore System Configuration file" << endl; return false; } @@ -4339,7 +4339,7 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem setting UMVolumeType in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting UMVolumeType in the MariaDB ColumnStore System Configuration file" << endl; return false; } @@ -4385,7 +4385,7 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem setting UMVolumeSize in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting UMVolumeSize in the MariaDB ColumnStore System Configuration file" << endl; return false; } @@ -4431,7 +4431,7 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem setting UMVolumeIOPS in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting UMVolumeIOPS in the MariaDB ColumnStore System Configuration file" << endl; return false; } } @@ -4442,7 +4442,7 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem setting UMStorageType in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting UMStorageType in the MariaDB ColumnStore System Configuration file" << endl; return false; } } @@ -4453,7 +4453,7 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem setting UMStorageType in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting UMStorageType in the MariaDB ColumnStore System Configuration file" << endl; return false; } } @@ -4621,7 +4621,7 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem setting DBRootStorageType in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DBRootStorageType in the MariaDB ColumnStore System Configuration file" << endl; return false; } @@ -4672,7 +4672,7 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem setting PMVolumeType in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting PMVolumeType in the MariaDB ColumnStore System Configuration file" << endl; return false; } @@ -4718,7 +4718,7 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem setting PMVolumeSize in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting PMVolumeSize in the MariaDB ColumnStore System Configuration file" << endl; return false; } @@ -4764,7 +4764,7 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem setting PMVolumeIOPS in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting PMVolumeIOPS in the MariaDB ColumnStore System Configuration file" << endl; return false; } } @@ -4775,7 +4775,7 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem setting PMVolumeSize in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting PMVolumeSize in the MariaDB ColumnStore System Configuration file" << endl; return false; } } @@ -4868,7 +4868,7 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem setting DataFilePlugin in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DataFilePlugin in the MariaDB ColumnStore System Configuration file" << endl; return false; } @@ -4877,7 +4877,7 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem setting DataFileEnvFile in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DataFileEnvFile in the MariaDB ColumnStore System Configuration file" << endl; return false; } @@ -4886,7 +4886,7 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem setting DataFileLog in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DataFileLog in the MariaDB ColumnStore System Configuration file" << endl; return false; } @@ -4895,7 +4895,7 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem setting ExtentsPerSegmentFile in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting ExtentsPerSegmentFile in the MariaDB ColumnStore System Configuration file" << endl; return false; } } @@ -4908,7 +4908,7 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem setting DataFilePlugin in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DataFilePlugin in the MariaDB ColumnStore System Configuration file" << endl; return false; } @@ -4917,18 +4917,18 @@ bool storageSetup(bool amazonInstall) } catch(...) { - cout << "ERROR: Problem setting DataFileEnvFile in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DataFileEnvFile in the MariaDB ColumnStore System Configuration file" << endl; return false; } 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; return false; } } 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; return false; } @@ -4963,12 +4963,12 @@ void setSystemName() } catch(...) { - cout << "ERROR: Problem setting SystemName from the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting SystemName from the MariaDB ColumnStore System Configuration file" << endl; exit(1); } 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); } } @@ -5051,7 +5051,7 @@ void offLineAppCheck() } catch(...) { - cout << "ERROR: Problem getting systemStartupOffline from the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem getting systemStartupOffline from the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -5085,7 +5085,7 @@ void offLineAppCheck() } catch(...) { - cout << "ERROR: Problem setting systemStartupOffline in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting systemStartupOffline in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } } @@ -5171,7 +5171,7 @@ bool singleServerDBrootSetup() } catch(...) { - cout << "ERROR: Problem setting DBRoot count in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DBRoot count in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -5194,7 +5194,7 @@ bool singleServerDBrootSetup() } catch(...) { - cout << "ERROR: Problem setting DBRoot ID in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DBRoot ID in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } } @@ -5268,7 +5268,7 @@ bool singleServerDBrootSetup() } catch(...) { - cout << "ERROR: Problem setting DBRoot ID in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DBRoot ID in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -5280,7 +5280,7 @@ bool singleServerDBrootSetup() } catch(...) { - cout << "ERROR: Problem setting DBRoot in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DBRoot in the MariaDB ColumnStore System Configuration file" << endl; return false; } } @@ -5292,7 +5292,7 @@ bool singleServerDBrootSetup() } catch(...) { - cout << "ERROR: Problem setting DBRoot count in the MariaDB Columnstore System Configuration file" << endl; + cout << "ERROR: Problem setting DBRoot count in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -5300,7 +5300,7 @@ bool singleServerDBrootSetup() DBRootCount = DBRootCount + dbroots.size(); 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); } From 3844b1e26afc55fd72f0d1669b197eee55252176 Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 21 Dec 2016 10:18:48 -0600 Subject: [PATCH 05/31] MCOL-475 - remove set username on ssh --- oam/install_scripts/rsync.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/oam/install_scripts/rsync.sh b/oam/install_scripts/rsync.sh index d7d73d2d0..d11720344 100755 --- a/oam/install_scripts/rsync.sh +++ b/oam/install_scripts/rsync.sh @@ -22,7 +22,6 @@ if {[info exists env(USER)]} { if { $PASSWORD == "ssh" } { - set USERNAME "" set PASSWORD "" } From b6a22feb6e519601c51df61b82c058f4b1d50336 Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 21 Dec 2016 10:25:14 -0600 Subject: [PATCH 06/31] MCOL-461 - remove -mp option --- oamapps/postConfigure/postConfigure.cpp | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index e9a5f31f4..6df9dbe11 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -271,13 +271,12 @@ int main(int argc, char *argv[]) cout << " Enter one of the options within [], if available, or" << endl; cout << " Enter a new value" << endl << endl; cout << endl; - cout << "Usage: postConfigure [-h][-c][-u][-p][-mp][-s][-port][-i]" << endl; + cout << "Usage: postConfigure [-h][-c][-u][-p][-s][-port][-i]" << endl; cout << " -h Help" << endl; cout << " -c Config File to use to extract configuration data, default is Columnstore.xml.rpmsave" << endl; cout << " -u Upgrade, Install using the Config File from -c, default to Columnstore.xml.rpmsave" << endl; cout << " If ssh-keys aren't setup, you should provide passwords as command line arguments" << endl; cout << " -p Unix Password, used with no-prompting option" << endl; - cout << " -mp MariaDB ColumnStore Password" << endl; cout << " -s Single Threaded Remote Install" << endl; cout << " -port MariaDB ColumnStore Port Address" << endl; cout << " -i Non-root Install directory, Only use for non-root installs" << endl; @@ -313,20 +312,6 @@ int main(int argc, char *argv[]) exit (1); } } - else if( string("-mp") == argv[i] ) { - i++; - if (i >= argc ) { - cout << " ERROR: MariaDB ColumnStore Password not provided" << endl; - exit (1); - } - mysqlpw = argv[i]; - if ( mysqlpw.find("-") != string::npos ) { - cout << " ERROR: Valid MariaDB ColumnStore Password not provided" << endl; - exit (1); - } - if ( mysqlpw == "dummymysqlpw" ) - mysqlpw = " "; - } else if( string("-u") == argv[i] ) noPrompting = true; // for backward compatibility @@ -356,7 +341,7 @@ int main(int argc, char *argv[]) else { cout << " ERROR: Invalid Argument = " << argv[i] << endl; - cout << " Usage: postConfigure [-h][-c][-u][-p][-mp][-s][-port][-i]" << endl; + cout << " Usage: postConfigure [-h][-c][-u][-p][-s][-port][-i]" << endl; exit (1); } } From fb09099a06e95bb27f9084b9964d2b9c86f54049 Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 21 Dec 2016 13:04:52 -0600 Subject: [PATCH 07/31] MCOL-481 - added mysql replication prompt --- oamapps/postConfigure/postConfigure.cpp | 88 +++++++++++++++++-------- 1 file changed, 60 insertions(+), 28 deletions(-) diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index 6df9dbe11..42a64fff4 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -667,6 +667,66 @@ int main(int argc, char *argv[]) exit(1); } + cout << endl << "NOTE: MySQL Replication can be enabled where MariaDB ColumnStore" << endl; + cout << " will setup the functionality across the multiple nodes." << endl; + cout << " Or the feature can be disabled. For example, if you have replication" << endl; + cout << " handled by another application" << endl << endl; + + try { + MySQLRep = sysConfig->getConfig(InstallSection, "MySQLRep"); + } + catch(...) + {} + + if ( MySQLRep == "y" ) + mysqlRep = true; + + string answer = "n"; + + while(true) { + if ( mysqlRep ) + prompt = "MariaDB ColumnStore MySQL Replication feature is Enabled, Do you want to disable? [y,n] (n) > "; + else + prompt = "MariaDB ColumnStore MySQL Replication feature? [y,n] (n) > "; + + 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 ( mysqlRep ) + { + if ( answer == "y" ) { + mysqlRep = false; + MySQLRep = "n"; + } + } + else + { + if ( answer == "y" ) { + mysqlRep = true; + MySQLRep = "y"; + } + } + + try { + sysConfig->setConfig(InstallSection, "MySQLRep", MySQLRep); + } + catch(...) + {} + + switch ( IserverTypeInstall ) { case (oam::INSTALL_COMBINE_DM_UM_PM): // combined #1 - dm/um/pm on a single server { @@ -687,16 +747,6 @@ int main(int argc, char *argv[]) pmwithum = false; - //MySQL replication - try { - MySQLRep = sysConfig->getConfig(InstallSection, "MySQLRep"); - } - catch(...) - {} - - if ( MySQLRep == "y" ) - mysqlRep = true; - break; } default: // normal, separate UM and PM @@ -712,16 +762,6 @@ int main(int argc, char *argv[]) if ( PMwithUM == "y" ) pmwithum = true; - //MySQL replication - try { - MySQLRep = sysConfig->getConfig(InstallSection, "MySQLRep"); - } - catch(...) - {} - - if ( MySQLRep == "y" ) - mysqlRep = true; - string answer = "n"; cout << "NOTE: Local Query Feature allows the ability to query data from a single Performance" << endl; @@ -761,8 +801,6 @@ int main(int argc, char *argv[]) if ( answer == "y" ) { pmwithum = true; PMwithUM = "y"; - mysqlRep = true; - MySQLRep = "y"; } } @@ -772,12 +810,6 @@ int main(int argc, char *argv[]) catch(...) {} - try { - sysConfig->setConfig(InstallSection, "MySQLRep", MySQLRep); - } - catch(...) - {} - break; } } From 270a67828060bcad287569f5164d54ac538df77e Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 21 Dec 2016 13:09:22 -0600 Subject: [PATCH 08/31] MCOL-481 - added mysql replication prompt --- procmgr/processmanager.cpp | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/procmgr/processmanager.cpp b/procmgr/processmanager.cpp index 0d7f2c64c..c5efc3c31 100644 --- a/procmgr/processmanager.cpp +++ b/procmgr/processmanager.cpp @@ -4816,14 +4816,10 @@ 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++) { @@ -5313,22 +5309,6 @@ 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"); From 4f5d9096fad884acd8d4bdff453f25ef8c8fb061 Mon Sep 17 00:00:00 2001 From: David Hill Date: Fri, 23 Dec 2016 15:39:18 -0600 Subject: [PATCH 09/31] MCOL-462 - change the api to aws ec2 apis --- oam/cloud/MCSInstanceCmds.sh | 284 +++++++----------------- oam/cloud/MCSVolumeCmds.sh | 41 ++-- oamapps/postConfigure/postConfigure.cpp | 145 +++--------- 3 files changed, 139 insertions(+), 331 deletions(-) mode change 100644 => 100755 oam/cloud/MCSInstanceCmds.sh mode change 100644 => 100755 oam/cloud/MCSVolumeCmds.sh diff --git a/oam/cloud/MCSInstanceCmds.sh b/oam/cloud/MCSInstanceCmds.sh old mode 100644 new mode 100755 index d105a5dc9..92575c8b5 --- a/oam/cloud/MCSInstanceCmds.sh +++ b/oam/cloud/MCSInstanceCmds.sh @@ -4,11 +4,11 @@ # # 1. Amazon EC2 -prefix=/usr/local +prefix=/home/mariadb-user #check command if [ "$1" = "" ]; then - echo "Enter Command Name: {launchInstance|getInstance|getZone|getPrivateIP|getKey|getAMI|getType|terminateInstance|startInstance|assignElasticIP|deassignElasticIP|getProfile|stopInstance|getGroup|getSubnet} + echo "Enter Command Name: {launchInstance|getInstance|getZone|getPrivateIP|getKey|getAMI|getType|terminateInstance|startInstance|assignElasticIP|deassignElasticIP|getProfile|stopInstance|getGroup|getSubnet|getVpc} }" exit 1 fi @@ -33,9 +33,9 @@ if [ "$1" = "launchInstance" ]; then instanceType="$3" fi if [ "$4" = "" ]; then - group="unassigned" + groupid="unassigned" else - group="$4" + groupid="$4" fi fi @@ -90,26 +90,6 @@ fi test -f /usr/local/mariadb/columnstore/post/functions && . /usr/local/mariadb/columnstore/post/functions -ec2=`$prefix/mariadb/columnstore/bin/getConfig Installation EC2_HOME` - -if [ $ec2 == "unassigned" ]; then - if [ "$1" = "getPrivateIP" ]; then - echo "stopped" - exit 1 - else - echo "unknown" - exit 1 - fi -fi - -java=`$prefix/mariadb/columnstore/bin/getConfig Installation JAVA_HOME` -path=`$prefix/mariadb/columnstore/bin/getConfig Installation EC2_PATH` - -export PATH=$path -export EC2_HOME=$ec2 -export JAVA_HOME=$java - -Region=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonRegion` subnet=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonSubNetID` #default instance to null @@ -118,8 +98,10 @@ instance="" describeInstanceFile="/tmp/describeInstance.txt" touch $describeInstanceFile +AWSCLI="aws ec2 " + describeInstance() { - ec2-describe-instances --region $Region > $describeInstanceFile 2>&1 + $AWSCLI describe-instances > $describeInstanceFile 2>&1 } #call at start up @@ -131,15 +113,7 @@ getInstance() { return fi - # first get local IP Address - localIP=`ifconfig eth0 | grep -m 1 "inet" | awk '{print substr($2,0,20)}'` - - #get local Instance ID - 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 -w $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + instance=`curl -s http://169.254.169.254/latest/meta-data/instance-id` echo $instance return @@ -151,44 +125,14 @@ getInstancePrivate() { return fi - # first get local IP Address - localIP=`ifconfig eth0 | grep -m 1 "inet" | awk '{print substr($2,0,20)}'` - - #get local Instance ID - 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 -w $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - + instance=`curl -s http://169.254.169.254/latest/meta-data/instance-id` + return } getZone() { - #get from Columnstore.xml if it's there, if not, get from instance then store - zone=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonZone` - - if [ "$zone" = "unassigned" ] || [ "$zone" = "" ]; then - #get local Instance ID - getInstancePrivate >/dev/null 2>&1 - #get zone - if [ "$subnet" == "unassigned" ]; then - 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 $11}'` - - else - 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 $11}'` - fi - $prefix/mariadb/columnstore/bin/setConfig Installation AmazonZone $zone - fi + zone=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone` echo $zone return @@ -196,15 +140,15 @@ getZone() { getPrivateIP() { #get instance info - grep -B1 -A4 -m 1 $instanceName $describeInstanceFile > /tmp/instanceInfo_$instanceName 2>&1 + grep -B1 -A7 -m 1 $instanceName $describeInstanceFile > /tmp/instanceInfo_$instanceName 2>&1 if [ `cat /tmp/instanceInfo_$instanceName | wc -c` -eq 0 ]; then describeInstance fi - grep -B1 -A4 -m 1 $instanceName $describeInstanceFile > /tmp/instanceInfo_$instanceName 2>&1 + grep -B1 -A7 -m 1 $instanceName $describeInstanceFile > /tmp/instanceInfo_$instanceName 2>&1 #check if running or terminated - cat /tmp/instanceInfo_$instanceName | grep running > /tmp/instanceStatus_$instanceName - if [ `cat /tmp/instanceStatus_$instanceName | wc -c` -eq 0 ]; then + cat /tmp/instanceInfo_$instanceName | grep STATE > /tmp/instanceStatus_$instanceName + if [ `cat /tmp/instanceStatus_$instanceName | wc -c` -ne 0 ]; then # not running cat /tmp/instanceInfo_$instanceName | grep pending > /tmp/instanceStatus_$instanceName if [ `cat /tmp/instanceStatus_$instanceName | wc -c` -ne 0 ]; then @@ -230,11 +174,7 @@ getPrivateIP() { fi #running, get priviate IP Address - if [ "$subnet" == "unassigned" ]; then - IpAddr=`head -n 2 /tmp/instanceInfo_$instanceName | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $14}'` - else - IpAddr=`head -n 2 /tmp/instanceInfo_$instanceName | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $14}'` - fi + IpAddr=`head -n 2 /tmp/instanceInfo_$instanceName | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $13}'` echo $IpAddr exit 0 @@ -242,23 +182,7 @@ getPrivateIP() { getType() { #get local Instance ID - getInstancePrivate >/dev/null 2>&1 - #get Type - if [ "$subnet" == "unassigned" ]; then - instanceType=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $9}'` - if [ "$instanceType" == "" ]; then - describeInstance - fi - instanceType=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $9}'` - - else - instanceType=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $9}'` - if [ "$instanceType" == "" ]; then - describeInstance - fi - instanceType=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $9}'` - - fi + instanceType=`curl -s http://169.254.169.254/latest/meta-data/instance-type` echo $instanceType return @@ -268,87 +192,54 @@ getKey() { #get local Instance ID getInstancePrivate >/dev/null 2>&1 #get Key - if [ "$subnet" == "unassigned" ]; then - key=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` - if [ "$key" == "" ]; then - describeInstance - fi - key=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` - - else - key=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` - if [ "$key" == "" ]; then - describeInstance - fi - key=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` - + if [ "$key" == "" ]; then + describeInstance fi + + key=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $10}'` echo $key return } +getVpc() { + #get local Instance ID + getInstancePrivate >/dev/null 2>&1 + #get VCP + if [ "$vcp" == "" ]; then + describeInstance + fi + + vpc=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $21}'` + + echo $vpc + return +} + getAMI() { #get local Instance ID - getInstancePrivate >/dev/null 2>&1 - #get AMI - ami=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $3}'` - if [ "$ami" == "" ]; then - describeInstance - fi - ami=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $3}'` + ami=`curl -s http://169.254.169.254/latest/meta-data/ami-id` echo $ami return } getGroup() { - #get local Instance ID - getInstancePrivate >/dev/null 2>&1 - #get group - if [ "$subnet" == "unassigned" ]; then - group=`grep -B1 -A4 -m 1 $instance $describeInstanceFile | grep -m 1 RESERVATION | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $4}'` - if [ "$group" == "" ]; then - describeInstance - fi - group=`grep -B1 -A4 -m 1 $instance $describeInstanceFile | grep -m 1 RESERVATION | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $4}'` - if [ "$group" == "" ]; then - group=`grep -B1 -A4 -m 1 $instance $describeInstanceFile | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $21}'` - fi - else - group=`grep -B1 -A6 -m 1 $instance $describeInstanceFile | grep -m 1 GROUP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - if [ "$group" == "" ]; then - describeInstance - fi - group=`grep -B1 -A6 -m 1 $instance $describeInstanceFile | grep -m 1 GROUP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - if [ "$group" == "" ]; then - group=`grep -B1 -A4 -m 1 $instance $describeInstanceFile | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $21}'` - fi - fi + # get vpc + getVpc >/dev/null 2>&1 - echo $group + #get group name + group=`curl -s http://169.254.169.254/latest/meta-data/security-groups` + + #get group id + groupid=`aws ec2 describe-security-groups --group-names | grep -A 1 $group | grep -m 1 $vpc | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $3}'` + echo $groupid return } getProfile() { - #get local Instance ID - getInstancePrivate >/dev/null 2>&1 - #get Type - if [ "$subnet" == "unassigned" ]; then - instanceProfile=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $23}'` - if [ "$instanceProfile" == "" ]; then - describeInstance - fi - instanceProfile=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $23}'` - - else - instanceProfile=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $22}'` - if [ "$instanceProfile" == "" ]; then - describeInstance - fi - instanceProfile=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $22}'` - - fi + # get profile + instanceProfile=`curl -s http://169.254.169.254/latest/meta-data/profile` echo $instanceProfile return @@ -357,7 +248,7 @@ getProfile() { launchInstance() { #get publickey getKey >/dev/null 2>&1 - if [ "$group" = "unassigned" ]; then + if [ "$groupid" = "unassigned" ]; then #get group getGroup >/dev/null 2>&1 fi @@ -372,63 +263,58 @@ launchInstance() { #get AMI Profile getProfile >/dev/null 2>&1 - if [ "$subnet" == "unassigned" ]; then - #NOT VPC - if [ "$instanceProfile" = "" ] || [ "$instanceProfile" = "default" ]; then - newInstance=`ec2-run-instances -k $key -g $group -t $instanceType -z $zone --region $Region $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - else - newInstance=`ec2-run-instances -k $key -g $group -t $instanceType -z $zone -p $instanceProfile --region $Region $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - fi - else # VPC - if [ "$instanceProfile" = "" ] || [ "$instanceProfile" = "default" ]; then - if [ "$group" != "default" ]; then - if [ "$IPaddress" = "autoassign" ]; then - newInstance=`ec2-run-instances -k $key -g $group -t $instanceType -z $zone --region $Region -s $subnet $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + #get Subnet + getSubnet >/dev/null 2>&1 + + if [ "$instanceProfile" = "" ] || [ "$instanceProfile" = "default-hvm" ]; then + if [ "$groupid" != "default" ]; then + if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ] ; then + newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --image-id $ami --security-group-ids $groupid | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` else - newInstance=`ec2-run-instances -k $key -g $group -t $instanceType -z $zone --region $Region -s $subnet --private-ip-address $IPaddress $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` fi else - if [ "$IPaddress" = "autoassign" ]; then - newInstance=`ec2-run-instances -k $key -t $instanceType -z $zone --region $Region -s $subnet $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then + newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --image-id $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` else - newInstance=`ec2-run-instances - -k $key -t $instanceType -z $zone --region $Region -s $subnet --private-ip-address $IPaddress $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + newInstance=`$AWSCLI run-instances - --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` fi fi else - if [ "$group" != "default" ]; then - if [ "$IPaddress" = "autoassign" ]; then - newInstance=`ec2-run-instances -k $key -g $group -t $instanceType -z $zone -p $instanceProfile --region $Region -s $subnet $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + if [ "$groupid" != "default" ]; then + if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then + newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --image-id $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` else - newInstance=`ec2-run-instances -k $key -g $group -t $instanceType -z $zone -p $instanceProfile --region $Region -s $subnet --private-ip-address $IPaddress $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` fi else - if [ "$IPaddress" = "autoassign" ]; then - newInstance=`ec2-run-instances -k $key -t $instanceType -z $zone -p $instanceProfile --region $Region -s $subnet $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then + newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --image-id $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` else - newInstance=`ec2-run-instances -k $key -t $instanceType -z $zone -p $instanceProfile --region $Region -s $subnet --private-ip-address $IPaddress $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` fi fi fi - fi + echo $newInstance return } terminateInstance() { #terminate Instance - ec2-terminate-instances --region $Region $instanceName > /tmp/termInstanceInfo_$instanceName 2>&1 + $AWSCLI terminate-instances --instance-ids $instanceName > /tmp/termInstanceInfo_$instanceName 2>&1 return } stopInstance() { #terminate Instance - ec2-stop-instances --region $Region $instanceName > /tmp/stopInstanceInfo_$instanceName 2>&1 + $AWSCLI stop-instances --instance-ids $instanceName > /tmp/stopInstanceInfo_$instanceName 2>&1 return } startInstance() { #terminate Instance - ec2-start-instances --region $Region $instanceName > /tmp/startInstanceInfo_$instanceName 2>&1 + $AWSCLI start-instances --instance-ids $instanceName > /tmp/startInstanceInfo_$instanceName 2>&1 cat /tmp/startInstanceInfo_$instanceName | grep INSTANCE > /tmp/startInstanceStatus_$instanceName if [ `cat /tmp/startInstanceStatus_$instanceName | wc -c` -eq 0 ]; then @@ -440,17 +326,12 @@ startInstance() { } assignElasticIP() { - #terminate Instance + EIP=`$AWSCLI describe-addresses --public-ips $IPAddress | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + + $AWSCLI associate-address --instance-id $instanceName --allocation-id $EIP > /tmp/assignElasticIPInfo_$IPAddress 2>&1 - if [ "$subnet" == "unassigned" ]; then - ec2-associate-address -i $instanceName $IPAddress > /tmp/assignElasticIPInfo_$IPAddress 2>&1 - else - EIP=`ec2-describe-addresses --region $Region $IPAddress | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $4}'` - ec2-associate-address --region $Region -i $instanceName -a $EIP > /tmp/assignElasticIPInfo_$IPAddress 2>&1 - fi - - cat /tmp/assignElasticIPInfo_$IPAddress | grep ADDRESS > /tmp/assignElasticIPStatus_$IPAddress - if [ `cat /tmp/assignElasticIPStatus_$IPAddress | wc -c` -eq 0 ]; then + cat /tmp/assignElasticIPInfo_$IPAddress | grep error > /tmp/assignElasticIPStatus_$IPAddress + if [ `cat /tmp/assignElasticIPStatus_$IPAddress | wc -c` -ne 0 ]; then echo "Failed, check /tmp/assignElasticIPInfo_$IPAddress" exit 1 fi @@ -460,11 +341,11 @@ assignElasticIP() { } deassignElasticIP() { - #terminate Instance - ec2-disassociate-address $IPAddress > /tmp/deassignElasticIPInfo_$IPAddress 2>&1 + EIP=`$AWSCLI describe-addresses --public-ips $IPAddress | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $3}'` - cat /tmp/deassignElasticIPInfo_$IPAddress | grep ADDRESS > /tmp/deassignElasticIPStatus_$IPAddress - if [ `cat /tmp/deassignElasticIPStatus_$IPAddress | wc -c` -eq 0 ]; then + $AWSCLI disassociate-address --association-id $EIP > /tmp/deassignElasticIPInfo_$IPAddress 2>&1 + cat /tmp/deassignElasticIPInfo_$IPAddress | grep error > /tmp/deassignElasticIPStatus_$IPAddress + if [ `cat /tmp/deassignElasticIPStatus_$IPAddress | wc -c` -ne 0 ]; then echo "Failed, check /tmp/deassignElasticIPStatus_$IPAddress" exit 1 fi @@ -477,11 +358,11 @@ getSubnet() { #get local Instance ID getInstancePrivate >/dev/null 2>&1 #get Subnet - subnet=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $16}'` + subnet=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $19}'` if [ "$subnet" == "" ]; then describeInstance fi - subnet=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $16}'` + subnet=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $19}'` if [[ $subnet == *"subnet"* ]] then @@ -540,8 +421,11 @@ case "$1" in getSubnet) getSubnet ;; + getVpc) + getVpc + ;; *) - echo $"Usage: $0 {launchInstance|getInstance|getZone|getPrivateIP|getType|getKey|getAMI|terminateInstance|startInstance|assignElasticIP|deassignElasticIP|getProfile|stopInstance|getGroup|getSubnet}" + echo $"Usage: $0 {launchInstance|getInstance|getZone|getPrivateIP|getType|getKey|getAMI|terminateInstance|startInstance|assignElasticIP|deassignElasticIP|getProfile|stopInstance|getGroup|getSubnet|getVpc}" exit 1 esac diff --git a/oam/cloud/MCSVolumeCmds.sh b/oam/cloud/MCSVolumeCmds.sh old mode 100644 new mode 100755 index 51d1a1ecc..1cefd1060 --- a/oam/cloud/MCSVolumeCmds.sh +++ b/oam/cloud/MCSVolumeCmds.sh @@ -4,7 +4,7 @@ # # 1. Amazon EC2 -prefix=/usr/local +prefix=/home/mariadb-user #check command if [ "$1" = "" ]; then @@ -95,22 +95,23 @@ fi test -f $prefix/mariadb/columnstore/post/functions && . $prefix/mariadb/columnstore/post/functions -ec2=`$prefix/mariadb/columnstore/bin/getConfig Installation EC2_HOME` +#ec2=`$prefix/mariadb/columnstore/bin/getConfig Installation EC2_HOME` -if [ $ec2 == "unassigned" ]; then - STATUS="unknown" - RETVAL=1 -fi +#if [ $ec2 == "unassigned" ]; then +# STATUS="unknown" +# RETVAL=1 +#fi -java=`$prefix/mariadb/columnstore/bin/getConfig Installation JAVA_HOME` -path=`$prefix/mariadb/columnstore/bin/getConfig Installation EC2_PATH` +#java=`$prefix/mariadb/columnstore/bin/getConfig Installation JAVA_HOME` +#path=`$prefix/mariadb/columnstore/bin/getConfig Installation EC2_PATH` -export PATH=$path -export EC2_HOME=$ec2 -export JAVA_HOME=$java +#export PATH=$path +#export EC2_HOME=$ec2 +#export JAVA_HOME=$java -Region=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonRegion` +#Region=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonRegion` +AWSCLI="aws ec2 " checkInfostatus() { #check if attached @@ -183,9 +184,9 @@ createvolume() { #create volume if [ $volumeType == "io1" ]; then - volume=`ec2-create-volume --region $Region -z $zone -s $volumeSize -t $volumeType -iops $volumeIOPS | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + volume=`$AWSCLI create-volume --availability-zone $zone --size $volumeSize --volume-type $volumeType -iops $volumeIOPS | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $6}'` else - volume=`ec2-create-volume --region $Region -z $zone -s $volumeSize -t $volumeType | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + volume=`$AWSCLI create-volume --availability-zone $zone --size $volumeSize --volume-type $volumeType | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $6}'` fi echo $volume @@ -194,7 +195,7 @@ createvolume() { describevolume() { #describe volume - ec2-describe-volumes --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1 + $AWSCLI describe-volumes --volume-ids $volumeName > /tmp/volumeInfo_$volumeName 2>&1 checkInfostatus echo $STATUS @@ -203,14 +204,14 @@ describevolume() { detachvolume() { #detach volume - ec2-detach-volume --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1 + $AWSCLI detach-volume --volume-id $volumeName > /tmp/volumeInfo_$volumeName 2>&1 checkInfostatus if [ $STATUS == "detaching" ]; then retries=1 while [ $retries -ne 60 ]; do #retry until it's attached - ec2-detach-volume --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1 + $AWSCLI detach-volume --volume-id $volumeName > /tmp/volumeInfo_$volumeName 2>&1 checkInfostatus if [ $STATUS == "available" ]; then @@ -240,7 +241,7 @@ detachvolume() { attachvolume() { #detach volume - ec2-attach-volume --region $Region $volumeName -i $instanceName -d $deviceName > /tmp/volumeInfo_$volumeName 2>&1 + $AWSCLI attach-volume --volume-id $volumeName --instance-id $instanceName --device $deviceName > /tmp/volumeInfo_$volumeName 2>&1 checkInfostatus if [ $STATUS == "attaching" -o $STATUS == "already-attached" ]; then @@ -274,13 +275,13 @@ attachvolume() { deletevolume() { #delete volume - ec2-delete-volume --region $Region $volumeName > /tmp/deletevolume_$volumeName 2>&1 + $AWSCLI delete-volume --volume-id $volumeName > /tmp/deletevolume_$volumeName 2>&1 return } createTag() { #create tag - ec2-create-tags --region $Region $resourceName --tag $tagName=$tagValue > /tmp/createTag_$volumeName 2>&1 + $AWSCLI create-tags --resources $resourceName --tags Key=$tagName,Value=$tagValue > /tmp/createTag_$volumeName 2>&1 return } diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index 42a64fff4..c18183f9f 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -167,7 +167,7 @@ bool hdfs = false; bool gluster = false; bool pmwithum = false; bool mysqlRep = false; -string MySQLRep = "n"; +string MySQLRep = "y"; string PMwithUM = "n"; bool amazonInstall = false; @@ -667,9 +667,9 @@ int main(int argc, char *argv[]) exit(1); } - cout << endl << "NOTE: MySQL Replication can be enabled where MariaDB ColumnStore" << endl; - cout << " will setup the functionality across the multiple nodes." << endl; - cout << " Or the feature can be disabled. For example, if you have replication" << endl; + cout << "NOTE: MySQL Replication feature can be enabled to have MariaDB ColumnStore" << endl; + cout << " setup the functionality of MySQL Replication on the system." << endl; + cout << " Or the feature can be disabled, if for example, if you have replication" << endl; cout << " handled by another application" << endl << endl; try { @@ -681,13 +681,13 @@ int main(int argc, char *argv[]) if ( MySQLRep == "y" ) mysqlRep = true; - string answer = "n"; + string answer = "y"; while(true) { if ( mysqlRep ) - prompt = "MariaDB ColumnStore MySQL Replication feature is Enabled, Do you want to disable? [y,n] (n) > "; + prompt = "MariaDB ColumnStore MySQL Replication feature is Enabled, do you want to leave enabled? [y,n] (y) > "; else - prompt = "MariaDB ColumnStore MySQL Replication feature? [y,n] (n) > "; + prompt = "MariaDB ColumnStore MySQL Replication feature, do you want to enable? [y,n] (y) > "; pcommand = callReadline(prompt.c_str()); if (pcommand) { @@ -706,15 +706,25 @@ int main(int argc, char *argv[]) } if ( mysqlRep ) - { + { // current enabled + if ( answer == "y" ) { + mysqlRep = true; + MySQLRep = "y"; + } + else + { + mysqlRep = false; + MySQLRep = "n"; + } + } + else + { // currently disabled if ( answer == "y" ) { mysqlRep = false; MySQLRep = "n"; } - } - else - { - if ( answer == "y" ) { + else + { mysqlRep = true; MySQLRep = "y"; } @@ -825,7 +835,7 @@ int main(int argc, char *argv[]) bool amazonInstall = false; string amazonSubNet = oam::UnassignedName; string cloud = oam::UnassignedName; - system("ec2-version > /tmp/amazon.log 2>&1"); + system("aws --version > /tmp/amazon.log 2>&1"); ifstream in("/tmp/amazon.log"); @@ -859,7 +869,7 @@ int main(int argc, char *argv[]) { while(true) { string enable = "y"; - prompt = "Amazon AMI Tools installed, do you want to have ColumnStore utilize them [y,n] (y) > "; + prompt = "Amazon AWS CLI Tools are installed, do you want to have ColumnStore utilize them [y,n] (y) > "; pcommand = callReadline(prompt.c_str()); if (pcommand) { @@ -892,73 +902,17 @@ int main(int argc, char *argv[]) if ( amazonInstall ) { bool noKey = false; - string AWS_ACCESS_KEY_ID; - char* p= getenv("AWS_ACCESS_KEY_ID"); - if (p && *p) { - AWS_ACCESS_KEY_ID = p; - if ( AWS_ACCESS_KEY_ID.empty() ) - noKey = true; - } - else - noKey = true; - if ( !noKey ) - { - string AWS_SECRET_ACCESS_KEY_ID; - char* p= getenv("AWS_SECRET_ACCESS_KEY_ID"); - if (p && *p) { - AWS_SECRET_ACCESS_KEY_ID = p; - if ( AWS_SECRET_ACCESS_KEY_ID.empty() ) - noKey = true; - } - else - noKey = true; - } - - if ( noKey ) - { // now call the script to see if keys were passed in IAM role - string cmd = installDir + "/bin/MCSgetCredentials > /dev/null 2>&1"; - - noKey = false; - int rtnCode = system(cmd.c_str()); - if (WEXITSTATUS(rtnCode) != 0) - noKey = true; - else - { - string AWS_ACCESS_KEY_ID; - char* p= getenv("AWS_ACCESS_KEY_ID"); - if (p && *p) { - AWS_ACCESS_KEY_ID = p; - if ( AWS_ACCESS_KEY_ID.empty() ) - noKey = true; - } - else - noKey = true; - - if ( !noKey ) - { - string AWS_SECRET_ACCESS_KEY_ID; - char* p= getenv("AWS_SECRET_ACCESS_KEY_ID"); - if (p && *p) { - AWS_SECRET_ACCESS_KEY_ID = p; - if ( AWS_SECRET_ACCESS_KEY_ID.empty() ) - noKey = true; - } - else - noKey = true; - } - } - - if ( noKey ) - { - cout << endl << "Error returned from MCSgetCredentials" << endl; - cout << "No EC2 AMI Access/Secret Credituals set, check Amazon Install Doc" << endl; - exit(1); - } + string awsCertFile = HOME + "/.aws/credentials"; + ifstream File (awsCertFile.c_str()); + if (!File) { + cout << "Error: AWS CLI Certificate file not found, " + awsCertFile << endl; + cout << "Check Amazon Install Documenation for additional information, exiting" << endl; + exit (1); } } - try { +/* try { AmazonRegion = sysConfig->getConfig(InstallSection, "AmazonRegion"); } catch(...) @@ -978,7 +932,7 @@ int main(int argc, char *argv[]) } catch(...) {} - +*/ if ( !writeConfig(sysConfig) ) { cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; exit(1); @@ -1433,35 +1387,11 @@ int main(int argc, char *argv[]) } } - if ( moduleType == "pm" ) { + if ( moduleType == "pm" ) pmNumber = moduleCount; - if ( pmNumber > 1 && ( IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM ) ) - { - mysqlRep = true; - MySQLRep = "y"; - try { - sysConfig->setConfig(InstallSection, "MySQLRep", "y"); - } - catch(...) - {} - } - } - - if ( moduleType == "um" ) { + if ( moduleType == "um" ) umNumber = moduleCount; - - if ( umNumber > 1 ) - { - mysqlRep = true; - MySQLRep = "y"; - try { - sysConfig->setConfig(InstallSection, "MySQLRep", "y"); - } - catch(...) - {} - } - } int moduleID = 1; @@ -3270,13 +3200,6 @@ int main(int argc, char *argv[]) } } - //store mysql rep enable flag - try { - sysConfig->setConfig(InstallSection, "MySQLRep", MySQLRep); - } - catch(...) - {} - if ( !writeConfig(sysConfig) ) { cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; exit(1); From b6111a4bb023a47a0c7656a1ef5959cc84f604b3 Mon Sep 17 00:00:00 2001 From: David Hill Date: Fri, 30 Dec 2016 11:07:29 -0600 Subject: [PATCH 10/31] MCOL-462 --- oam/install_scripts/post-install | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/oam/install_scripts/post-install b/oam/install_scripts/post-install index 966e40aa6..61a79b833 100755 --- a/oam/install_scripts/post-install +++ b/oam/install_scripts/post-install @@ -250,15 +250,15 @@ if [ $rc1 -ne 0 -a $rc2 -ne 0 ]; then fi #check and get amazon EC2 env variables -if [ -n "$EC2_HOME" ]; then - $installdir/bin/setConfig -d Installation EC2_HOME $EC2_HOME +#if [ -n "$EC2_HOME" ]; then +# $installdir/bin/setConfig -d Installation EC2_HOME $EC2_HOME - if [ -n "$EC2_HOME" ]; then - $installdir/bin/setConfig -d Installation JAVA_HOME $JAVA_HOME - fi +# if [ -n "$EC2_HOME" ]; then +# $installdir/bin/setConfig -d Installation JAVA_HOME $JAVA_HOME +# fi - $installdir/bin/setConfig -d Installation EC2_PATH $PATH:/home/ec2/bin:/opt/aws/bin -fi +# $installdir/bin/setConfig -d Installation EC2_PATH $PATH:/home/ec2/bin:/opt/aws/bin +#fi #log install message test -f $installdir/post/functions && . $installdir/post/functions From 855c79b22219ae94c6044ff4dc9614395fb606fe Mon Sep 17 00:00:00 2001 From: David Hill Date: Tue, 3 Jan 2017 09:14:41 -0600 Subject: [PATCH 11/31] MCOL-462 --- oam/cloud/MCSInstanceCmds.sh | 90 +++++++------------------ oam/cloud/MCSVolumeCmds.sh | 20 +----- oamapps/postConfigure/postConfigure.cpp | 2 +- 3 files changed, 28 insertions(+), 84 deletions(-) diff --git a/oam/cloud/MCSInstanceCmds.sh b/oam/cloud/MCSInstanceCmds.sh index 92575c8b5..4f137e721 100755 --- a/oam/cloud/MCSInstanceCmds.sh +++ b/oam/cloud/MCSInstanceCmds.sh @@ -108,25 +108,14 @@ describeInstance() { describeInstance getInstance() { - if [ "$instance" != "" ]; then - echo $instance + if [ "$instanceiName" != "" ]; then + echo $instanceName return fi - instance=`curl -s http://169.254.169.254/latest/meta-data/instance-id` + instanceName=`curl -s http://169.254.169.254/latest/meta-data/instance-id` - echo $instance - return -} - -getInstancePrivate() { - if [ "$instance" != "" ]; then - echo $instance - return - fi - - instance=`curl -s http://169.254.169.254/latest/meta-data/instance-id` - + echo $instanceName return } @@ -139,30 +128,19 @@ getZone() { } getPrivateIP() { - #get instance info - grep -B1 -A7 -m 1 $instanceName $describeInstanceFile > /tmp/instanceInfo_$instanceName 2>&1 - if [ `cat /tmp/instanceInfo_$instanceName | wc -c` -eq 0 ]; then - describeInstance - fi - grep -B1 -A7 -m 1 $instanceName $describeInstanceFile > /tmp/instanceInfo_$instanceName 2>&1 - #check if running or terminated - cat /tmp/instanceInfo_$instanceName | grep STATE > /tmp/instanceStatus_$instanceName - if [ `cat /tmp/instanceStatus_$instanceName | wc -c` -ne 0 ]; then + state=`aws ec2 describe-instances --instance-ids $instanceName --output text --query 'Reservations[*].Instances[*].State.Name'` + if [ "$state" != "running" ]; then # not running - cat /tmp/instanceInfo_$instanceName | grep pending > /tmp/instanceStatus_$instanceName - if [ `cat /tmp/instanceStatus_$instanceName | wc -c` -ne 0 ]; then - describeInstance + if [ "$state" != "stopped" ]; then echo "stopped" exit 1 else - cat /tmp/instanceInfo_$instanceName | grep terminated > /tmp/instanceStatus_$instanceName - if [ `cat /tmp/instanceStatus_$instanceName | wc -c` -ne 0 ]; then + if [ "$state" != "terminated" ]; then echo "terminated" exit 1 else - cat /tmp/instanceInfo_$instanceName | grep shutting-down > /tmp/instanceStatus_$instanceName - if [ `cat /tmp/instanceStatus_$instanceName | wc -c` -ne 0 ]; then + if [ "$state" != "shutting-down" ]; then echo "terminated" exit 1 else @@ -174,7 +152,7 @@ getPrivateIP() { fi #running, get priviate IP Address - IpAddr=`head -n 2 /tmp/instanceInfo_$instanceName | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $13}'` + IpAddr=`aws ec2 describe-instances --instance-ids $instanceName --output text --query 'Reservations[*].Instances[*].PrivateIpAddress'` echo $IpAddr exit 0 @@ -190,13 +168,9 @@ getType() { getKey() { #get local Instance ID - getInstancePrivate >/dev/null 2>&1 - #get Key - if [ "$key" == "" ]; then - describeInstance - fi + getInstance >/dev/null 2>&1 - key=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $10}'` + key=`aws ec2 describe-instances --instance-ids $instanceName --output text --query 'Reservations[*].Instances[*].KeyName'` echo $key return @@ -204,13 +178,9 @@ getKey() { getVpc() { #get local Instance ID - getInstancePrivate >/dev/null 2>&1 + getInstance >/dev/null 2>&1 #get VCP - if [ "$vcp" == "" ]; then - describeInstance - fi - - vpc=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $21}'` + vpc=`aws ec2 describe-instances --instance-ids $instanceName --output text --query 'Reservations[*].Instances[*].VpcId'` echo $vpc return @@ -225,14 +195,8 @@ getAMI() { } getGroup() { - # get vpc - getVpc >/dev/null 2>&1 - - #get group name - group=`curl -s http://169.254.169.254/latest/meta-data/security-groups` - #get group id - groupid=`aws ec2 describe-security-groups --group-names | grep -A 1 $group | grep -m 1 $vpc | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $3}'` + groupid=`aws ec2 describe-instances --instance-ids $instanceName --output text --query 'Reservations[*].Instances[*].SecurityGroups[*].GroupId'` echo $groupid return } @@ -269,29 +233,29 @@ launchInstance() { if [ "$instanceProfile" = "" ] || [ "$instanceProfile" = "default-hvm" ]; then if [ "$groupid" != "default" ]; then if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ] ; then - newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --image-id $ami --security-group-ids $groupid | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` + newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --image-id $ami --security-group-ids $groupid --query 'Instances[*].InstanceId' --output text` else - newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` + newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` fi else if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then - newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --image-id $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` + newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` else - newInstance=`$AWSCLI run-instances - --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` + newInstance=`$AWSCLI run-instances - --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` fi fi else if [ "$groupid" != "default" ]; then if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then - newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --image-id $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` + newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` else - newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` + newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` fi else if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then - newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --image-id $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` + newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` else - newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` + newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` fi fi fi @@ -356,13 +320,9 @@ deassignElasticIP() { getSubnet() { #get local Instance ID - getInstancePrivate >/dev/null 2>&1 + getInstance >/dev/null 2>&1 #get Subnet - subnet=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $19}'` - if [ "$subnet" == "" ]; then - describeInstance - fi - subnet=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $19}'` + subnet=`aws ec2 describe-instances --instance-ids $instanceName --output text --query 'Reservations[*].Instances[*].SubnetId'` if [[ $subnet == *"subnet"* ]] then diff --git a/oam/cloud/MCSVolumeCmds.sh b/oam/cloud/MCSVolumeCmds.sh index 1cefd1060..d9e1be800 100755 --- a/oam/cloud/MCSVolumeCmds.sh +++ b/oam/cloud/MCSVolumeCmds.sh @@ -95,22 +95,6 @@ fi test -f $prefix/mariadb/columnstore/post/functions && . $prefix/mariadb/columnstore/post/functions -#ec2=`$prefix/mariadb/columnstore/bin/getConfig Installation EC2_HOME` - -#if [ $ec2 == "unassigned" ]; then -# STATUS="unknown" -# RETVAL=1 -#fi - -#java=`$prefix/mariadb/columnstore/bin/getConfig Installation JAVA_HOME` -#path=`$prefix/mariadb/columnstore/bin/getConfig Installation EC2_PATH` - -#export PATH=$path -#export EC2_HOME=$ec2 -#export JAVA_HOME=$java - -#Region=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonRegion` - AWSCLI="aws ec2 " checkInfostatus() { @@ -184,9 +168,9 @@ createvolume() { #create volume if [ $volumeType == "io1" ]; then - volume=`$AWSCLI create-volume --availability-zone $zone --size $volumeSize --volume-type $volumeType -iops $volumeIOPS | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $6}'` + volume=`$AWSCLI create-volume --availability-zone $zone --size $volumeSize --volume-type $volumeType -iops $volumeIOPS --output text --query VolumeId` else - volume=`$AWSCLI create-volume --availability-zone $zone --size $volumeSize --volume-type $volumeType | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $6}'` + volume=`$AWSCLI create-volume --availability-zone $zone --size $volumeSize --volume-type $volumeType --output text --query VolumeId` fi echo $volume diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index c18183f9f..c56241421 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -1727,7 +1727,7 @@ int main(int argc, char *argv[]) else { if (newModuleIPAddr == "terminated") { - cout << "ERROR: Instance " + newModuleHostName + " doesn't have an Private IP Address, please correct and hit 'enter'" << endl << endl; + cout << "ERROR: Instance " + newModuleHostName + " doesn't have an Private IP Address, retrying" << endl << endl; if ( noPrompting ) exit(1); continue; From 2a8b29274f65aa6ca100f74e480adb665da20f05 Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 4 Jan 2017 09:13:38 -0600 Subject: [PATCH 12/31] MCOL-462 --- oam/cloud/MCSVolumeCmds.sh | 2 +- oamapps/postConfigure/postConfigure.cpp | 29 +++++++++++++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/oam/cloud/MCSVolumeCmds.sh b/oam/cloud/MCSVolumeCmds.sh index d9e1be800..b4bcb0b19 100755 --- a/oam/cloud/MCSVolumeCmds.sh +++ b/oam/cloud/MCSVolumeCmds.sh @@ -168,7 +168,7 @@ createvolume() { #create volume if [ $volumeType == "io1" ]; then - volume=`$AWSCLI create-volume --availability-zone $zone --size $volumeSize --volume-type $volumeType -iops $volumeIOPS --output text --query VolumeId` + volume=`$AWSCLI create-volume --availability-zone $zone --size $volumeSize --volume-type $volumeType --iops $volumeIOPS --output text --query VolumeId` else volume=`$AWSCLI create-volume --availability-zone $zone --size $volumeSize --volume-type $volumeType --output text --query VolumeId` fi diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index c56241421..a3c02bd9d 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -4241,6 +4241,11 @@ bool storageSetup(bool amazonInstall) UMStorageType = "internal"; else { + + cout << "NOTE: The volume type. This can be gp2 for General Purpose SSD, io1 for" << endl; + cout << " Provisioned IOPS SSD, st1 for Throughput Optimized HDD, sc1 for Cold" << endl; + cout << " HDD, or standard for Magnetic volumes." << endl << endl; + UMStorageType = "external"; cout << endl; @@ -4255,7 +4260,7 @@ bool storageSetup(bool amazonInstall) while(true) { - string prompt = "Enter EBS Volume Type (standard, gp2, io1) : (" + UMVolumeType + ") > "; + string prompt = "Enter EBS Volume Type (standard, gp2, io1, sc1, st1) : (" + UMVolumeType + ") > "; pcommand = callReadline(prompt); if (pcommand) { @@ -4263,7 +4268,7 @@ bool storageSetup(bool amazonInstall) callFree(pcommand); } - if ( UMVolumeType == "standard" || UMVolumeType == "gp2" || UMVolumeType == "io1" ) + if ( UMVolumeType == "standard" || UMVolumeType == "gp2" || UMVolumeType == "io1" || UMVolumeType == "sc1" || UMVolumeType == "st1") break; else { @@ -4289,6 +4294,12 @@ bool storageSetup(bool amazonInstall) if (UMVolumeType == "io1") minSize = "4"; + if (UMVolumeType == "sc1" || UMVolumeType == "st1") + minSize = "500"; + + if (UMVolumeType == "standard") + maxSize = "1024"; + cout << endl; try { oam.getSystemConfig("UMVolumeSize", UMVolumeSize); @@ -4576,6 +4587,10 @@ bool storageSetup(bool amazonInstall) // if external and amazon, prompt for storage size if ( storageType == "2" && amazonInstall) { + cout << "NOTE: The volume type. This can be gp2 for General Purpose SSD, io1 for" << endl; + cout << " Provisioned IOPS SSD, st1 for Throughput Optimized HDD, sc1 for Cold" << endl; + cout << " HDD, or standard for Magnetic volumes." << endl << endl; + cout << endl; try { oam.getSystemConfig("PMVolumeType", PMVolumeType); @@ -4588,7 +4603,7 @@ bool storageSetup(bool amazonInstall) while(true) { - string prompt = "Enter EBS Volume Type (standard, gp2, io1) : (" + PMVolumeType + ") > "; + string prompt = "Enter EBS Volume Type (standard, gp2, io1, sc1, st1) : (" + PMVolumeType + ") > "; pcommand = callReadline(prompt); if (pcommand) { @@ -4596,7 +4611,7 @@ bool storageSetup(bool amazonInstall) callFree(pcommand); } - if ( PMVolumeType == "standard" || PMVolumeType == "gp2" || PMVolumeType == "io1" ) + if ( PMVolumeType == "standard" || PMVolumeType == "gp2" || PMVolumeType == "io1" || PMVolumeType == "gp2" || PMVolumeType == "io1") break; else { @@ -4632,6 +4647,12 @@ bool storageSetup(bool amazonInstall) if (PMVolumeType == "io1") minSize = "4"; + if (PMVolumeType == "sc1" || PMVolumeType == "st1") + minSize = "500"; + + if (PMVolumeType == "standard") + maxSize = "1024"; + while(true) { string prompt = "Enter EBS Volume storage size in GB: [" + minSize + "," + maxSize + "] (" + PMVolumeSize + ") > "; From 4b68b5d6ba5b6241f121224ab2047fa35d5f712e Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 4 Jan 2017 13:18:41 -0600 Subject: [PATCH 13/31] MCOL-462 --- oam/oamcpp/liboamcpp.cpp | 4 ++++ oamapps/postConfigure/postConfigure.cpp | 17 ++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/oam/oamcpp/liboamcpp.cpp b/oam/oamcpp/liboamcpp.cpp index 7ef10b1cb..828c9df9d 100644 --- a/oam/oamcpp/liboamcpp.cpp +++ b/oam/oamcpp/liboamcpp.cpp @@ -5964,6 +5964,9 @@ namespace oam catch(...) {} writeLog("addUMdisk - Create new Volume for um" + itoa(moduleID), LOG_TYPE_DEBUG); + + cout << " Create AWS Volume for UM #" << itoa(moduleID) << endl; + volumeName = createEC2Volume(UMVolumeSize, "um"); if ( volumeName == "failed" ) { writeLog("addModule: create volume failed", LOG_TYPE_CRITICAL); @@ -5984,6 +5987,7 @@ namespace oam //format attached volume writeLog("addUMdisk - Format new Volume for: " + volumeName, LOG_TYPE_DEBUG); + cout << " Formatting disk for UM #" << itoa(moduleID) << ", please wait..." << endl; string cmd; int user; diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index a3c02bd9d..ee918cc3c 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -2103,7 +2103,6 @@ int main(int argc, char *argv[]) { //create new UM volume try{ - oam.addUMdisk(moduleID, volumeName, deviceName, UMVolumeSize); } catch(...) { @@ -4242,9 +4241,9 @@ bool storageSetup(bool amazonInstall) else { - cout << "NOTE: The volume type. This can be gp2 for General Purpose SSD, io1 for" << endl; + cout << endl << "NOTE: The volume type. This can be gp2 for General Purpose SSD, io1 for" << endl; cout << " Provisioned IOPS SSD, st1 for Throughput Optimized HDD, sc1 for Cold" << endl; - cout << " HDD, or standard for Magnetic volumes." << endl << endl; + cout << " HDD, or standard for Magnetic volumes." << endl; UMStorageType = "external"; @@ -4256,11 +4255,11 @@ bool storageSetup(bool amazonInstall) {} if ( UMVolumeType.empty() || UMVolumeType == "") - UMVolumeType = "standard"; + UMVolumeType = "gp2"; while(true) { - string prompt = "Enter EBS Volume Type (standard, gp2, io1, sc1, st1) : (" + UMVolumeType + ") > "; + string prompt = "Enter EBS Volume Type (gp2, io1, sc1, st1, standard) : (" + UMVolumeType + ") > "; pcommand = callReadline(prompt); if (pcommand) { @@ -4587,9 +4586,9 @@ bool storageSetup(bool amazonInstall) // if external and amazon, prompt for storage size if ( storageType == "2" && amazonInstall) { - cout << "NOTE: The volume type. This can be gp2 for General Purpose SSD, io1 for" << endl; + cout << endl << "NOTE: The volume type. This can be gp2 for General Purpose SSD, io1 for" << endl; cout << " Provisioned IOPS SSD, st1 for Throughput Optimized HDD, sc1 for Cold" << endl; - cout << " HDD, or standard for Magnetic volumes." << endl << endl; + cout << " HDD, or standard for Magnetic volumes." << endl; cout << endl; try { @@ -4599,11 +4598,11 @@ bool storageSetup(bool amazonInstall) {} if ( PMVolumeType.empty() || PMVolumeType == "") - PMVolumeType = "standard"; + PMVolumeType = "gp2"; while(true) { - string prompt = "Enter EBS Volume Type (standard, gp2, io1, sc1, st1) : (" + PMVolumeType + ") > "; + string prompt = "Enter EBS Volume Type (gp2, io1, sc1, st1, standard) : (" + PMVolumeType + ") > "; pcommand = callReadline(prompt); if (pcommand) { From da3b2b372f0137f902a6cfeb6fee0cfd507c38ca Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 4 Jan 2017 13:25:24 -0600 Subject: [PATCH 14/31] MCOL-462 --- oamapps/postConfigure/postConfigure.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index ee918cc3c..840901f61 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -898,6 +898,8 @@ int main(int argc, char *argv[]) break; } } + else + cout << "NOTE: Configured to have ColumnStore use the Amazon AWS CLI Tools" << endl << endl; if ( amazonInstall ) { From f2e23141eba21ed53bfb3a16902fc6b06449f6f0 Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 4 Jan 2017 14:38:56 -0600 Subject: [PATCH 15/31] MCOL-462 - add script to read keys --- oam/cloud/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oam/cloud/CMakeLists.txt b/oam/cloud/CMakeLists.txt index 8c18ca72c..3c4e302df 100644 --- a/oam/cloud/CMakeLists.txt +++ b/oam/cloud/CMakeLists.txt @@ -1,2 +1,2 @@ -install(PROGRAMS MCSInstanceCmds.sh MCSVolumeCmds.sh DESTINATION ${ENGINE_BINDIR} COMPONENT platform) +install(PROGRAMS MCSInstanceCmds.sh MCSVolumeCmds.sh MCSgetCredentials.sh DESTINATION ${ENGINE_BINDIR} COMPONENT platform) From a4fa1b325b57353355192bc66d7b1976c0ce6493 Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 4 Jan 2017 15:54:43 -0600 Subject: [PATCH 16/31] MCOL-462 --- oam/cloud/MCSInstanceCmds.sh | 94 +++++++++++++++++-------- oam/cloud/MCSVolumeCmds.sh | 23 +++--- oam/cloud/MCSgetCredentials.sh | 5 ++ oam/etc/Columnstore.xml | 1 - oam/install_scripts/post-install | 15 ++-- oamapps/postConfigure/postConfigure.cpp | 31 ++------ 6 files changed, 92 insertions(+), 77 deletions(-) diff --git a/oam/cloud/MCSInstanceCmds.sh b/oam/cloud/MCSInstanceCmds.sh index 4f137e721..d1a03b707 100755 --- a/oam/cloud/MCSInstanceCmds.sh +++ b/oam/cloud/MCSInstanceCmds.sh @@ -4,11 +4,11 @@ # # 1. Amazon EC2 -prefix=/home/mariadb-user +prefix=/usr/local #check command if [ "$1" = "" ]; then - echo "Enter Command Name: {launchInstance|getInstance|getZone|getPrivateIP|getKey|getAMI|getType|terminateInstance|startInstance|assignElasticIP|deassignElasticIP|getProfile|stopInstance|getGroup|getSubnet|getVpc} + echo "Enter Command Name: {launchInstance|getInstance|getZone|getPrivateIP|getKey|getAMI|getType|terminateInstance|startInstance|assignElasticIP|deassignElasticIP|getProfile|stopInstance|getGroup|getSubnet|getVpc|getRegion} }" exit 1 fi @@ -88,27 +88,24 @@ if [ "$1" = "deassignElasticIP" ]; then fi -test -f /usr/local/mariadb/columnstore/post/functions && . /usr/local/mariadb/columnstore/post/functions +$prefix/mariadb/columnstore/bin/MCSgetCredentials.sh >/dev/null 2>&1 -subnet=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonSubNetID` +test -f $prefix//mariadb/columnstore/post/functions && . $prefix//mariadb/columnstore/post/functions #default instance to null instance="" -describeInstanceFile="/tmp/describeInstance.txt" -touch $describeInstanceFile - AWSCLI="aws ec2 " -describeInstance() { - $AWSCLI describe-instances > $describeInstanceFile 2>&1 +getRegion() { + region=`curl --silent http://169.254.169.254/latest/dynamic/instance-identity/document/region | grep region | cut -d':' -f2 | sed 's/\"//g' | sed -e 's/^[ \t]*//'` + + echo $region + return } -#call at start up -describeInstance - getInstance() { - if [ "$instanceiName" != "" ]; then + if [ "$instanceName" != "" ]; then echo $instanceName return fi @@ -128,8 +125,11 @@ getZone() { } getPrivateIP() { + #get region + getRegion >/dev/null 2>&1 + #check if running or terminated - state=`aws ec2 describe-instances --instance-ids $instanceName --output text --query 'Reservations[*].Instances[*].State.Name'` + state=`aws ec2 describe-instances --instance-ids $instanceName --region $Region --output text --query 'Reservations[*].Instances[*].State.Name'` if [ "$state" != "running" ]; then # not running if [ "$state" != "stopped" ]; then @@ -152,7 +152,7 @@ getPrivateIP() { fi #running, get priviate IP Address - IpAddr=`aws ec2 describe-instances --instance-ids $instanceName --output text --query 'Reservations[*].Instances[*].PrivateIpAddress'` + IpAddr=`aws ec2 describe-instances --instance-ids $instanceName --region $Region --output text --query 'Reservations[*].Instances[*].PrivateIpAddress'` echo $IpAddr exit 0 @@ -167,20 +167,27 @@ getType() { } getKey() { + #get region + getRegion >/dev/null 2>&1 + #get local Instance ID getInstance >/dev/null 2>&1 - key=`aws ec2 describe-instances --instance-ids $instanceName --output text --query 'Reservations[*].Instances[*].KeyName'` + key=`aws ec2 describe-instances --instance-ids $instanceName --region $Region --output text --query 'Reservations[*].Instances[*].KeyName'` echo $key return } getVpc() { + #get region + getRegion >/dev/null 2>&1 + #get local Instance ID getInstance >/dev/null 2>&1 + #get VCP - vpc=`aws ec2 describe-instances --instance-ids $instanceName --output text --query 'Reservations[*].Instances[*].VpcId'` + vpc=`aws ec2 describe-instances --instance-ids $instanceName --output text --region $Region --query 'Reservations[*].Instances[*].VpcId'` echo $vpc return @@ -195,13 +202,19 @@ getAMI() { } getGroup() { + #get region + getRegion >/dev/null 2>&1 + #get group id - groupid=`aws ec2 describe-instances --instance-ids $instanceName --output text --query 'Reservations[*].Instances[*].SecurityGroups[*].GroupId'` + groupid=`aws ec2 describe-instances --instance-ids $instanceName --region $Region --output text --query 'Reservations[*].Instances[*].SecurityGroups[*].GroupId'` echo $groupid return } getProfile() { + #get region + getRegion >/dev/null 2>&1 + # get profile instanceProfile=`curl -s http://169.254.169.254/latest/meta-data/profile` @@ -210,6 +223,9 @@ getProfile() { } launchInstance() { + #get region + getRegion >/dev/null 2>&1 + #get publickey getKey >/dev/null 2>&1 if [ "$groupid" = "unassigned" ]; then @@ -233,29 +249,29 @@ launchInstance() { if [ "$instanceProfile" = "" ] || [ "$instanceProfile" = "default-hvm" ]; then if [ "$groupid" != "default" ]; then if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ] ; then - newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --image-id $ami --security-group-ids $groupid --query 'Instances[*].InstanceId' --output text` + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --image-id $ami --security-group-ids $groupid --query 'Instances[*].InstanceId' --output text` else - newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` fi else if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then - newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` else - newInstance=`$AWSCLI run-instances - --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` fi fi else if [ "$groupid" != "default" ]; then if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then - newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` else - newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` fi else if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then - newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` else - newInstance=`$AWSCLI run-instances --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` fi fi fi @@ -265,20 +281,29 @@ launchInstance() { } terminateInstance() { + #get region + getRegion >/dev/null 2>&1 + #terminate Instance - $AWSCLI terminate-instances --instance-ids $instanceName > /tmp/termInstanceInfo_$instanceName 2>&1 + $AWSCLI terminate-instances --instance-ids $instanceName --region $Region > /tmp/termInstanceInfo_$instanceName 2>&1 return } stopInstance() { + #get region + getRegion >/dev/null 2>&1 + #terminate Instance - $AWSCLI stop-instances --instance-ids $instanceName > /tmp/stopInstanceInfo_$instanceName 2>&1 + $AWSCLI stop-instances --instance-ids $instanceName --region $Region > /tmp/stopInstanceInfo_$instanceName 2>&1 return } startInstance() { + #get region + getRegion >/dev/null 2>&1 + #terminate Instance - $AWSCLI start-instances --instance-ids $instanceName > /tmp/startInstanceInfo_$instanceName 2>&1 + $AWSCLI start-instances --instance-ids $instanceName --region $Region > /tmp/startInstanceInfo_$instanceName 2>&1 cat /tmp/startInstanceInfo_$instanceName | grep INSTANCE > /tmp/startInstanceStatus_$instanceName if [ `cat /tmp/startInstanceStatus_$instanceName | wc -c` -eq 0 ]; then @@ -319,10 +344,13 @@ deassignElasticIP() { } getSubnet() { + #get region + getRegion >/dev/null 2>&1 + #get local Instance ID getInstance >/dev/null 2>&1 #get Subnet - subnet=`aws ec2 describe-instances --instance-ids $instanceName --output text --query 'Reservations[*].Instances[*].SubnetId'` + subnet=`aws ec2 describe-instances --instance-ids $instanceName --region $Region --output text --query 'Reservations[*].Instances[*].SubnetId'` if [[ $subnet == *"subnet"* ]] then @@ -384,8 +412,12 @@ case "$1" in getVpc) getVpc ;; + getRegion) + getRegion + ;; + *) - echo $"Usage: $0 {launchInstance|getInstance|getZone|getPrivateIP|getType|getKey|getAMI|terminateInstance|startInstance|assignElasticIP|deassignElasticIP|getProfile|stopInstance|getGroup|getSubnet|getVpc}" + echo $"Usage: $0 {launchInstance|getInstance|getZone|getPrivateIP|getType|getKey|getAMI|terminateInstance|startInstance|assignElasticIP|deassignElasticIP|getProfile|stopInstance|getGroup|getSubnet|getVpc|getRegion}" exit 1 esac diff --git a/oam/cloud/MCSVolumeCmds.sh b/oam/cloud/MCSVolumeCmds.sh index b4bcb0b19..cb87ae039 100755 --- a/oam/cloud/MCSVolumeCmds.sh +++ b/oam/cloud/MCSVolumeCmds.sh @@ -4,7 +4,7 @@ # # 1. Amazon EC2 -prefix=/home/mariadb-user +prefix=/usr/local #check command if [ "$1" = "" ]; then @@ -97,6 +97,11 @@ test -f $prefix/mariadb/columnstore/post/functions && . $prefix/mariadb/columnst AWSCLI="aws ec2 " +$prefix/mariadb/columnstore/bin/MCSgetCredentials.sh >/dev/null 2>&1 + +#get Region +Region=`$prefix/mariadb/columnstore/bin/MCSInstanceCmds.sh getRegion` + checkInfostatus() { #check if attached cat /tmp/volumeInfo_$volumeName | grep attached > /tmp/volumeStatus_$volumeName @@ -168,9 +173,9 @@ createvolume() { #create volume if [ $volumeType == "io1" ]; then - volume=`$AWSCLI create-volume --availability-zone $zone --size $volumeSize --volume-type $volumeType --iops $volumeIOPS --output text --query VolumeId` + volume=`$AWSCLI create-volume --region $Region --availability-zone $zone --size $volumeSize --volume-type $volumeType --iops $volumeIOPS --output text --query VolumeId` else - volume=`$AWSCLI create-volume --availability-zone $zone --size $volumeSize --volume-type $volumeType --output text --query VolumeId` + volume=`$AWSCLI create-volume --region $Region --availability-zone $zone --size $volumeSize --volume-type $volumeType --output text --query VolumeId` fi echo $volume @@ -179,7 +184,7 @@ createvolume() { describevolume() { #describe volume - $AWSCLI describe-volumes --volume-ids $volumeName > /tmp/volumeInfo_$volumeName 2>&1 + $AWSCLI describe-volumes --volume-ids $volumeName --region $Region > /tmp/volumeInfo_$volumeName 2>&1 checkInfostatus echo $STATUS @@ -188,14 +193,14 @@ describevolume() { detachvolume() { #detach volume - $AWSCLI detach-volume --volume-id $volumeName > /tmp/volumeInfo_$volumeName 2>&1 + $AWSCLI detach-volume --volume-id $volumeName --region $Region > /tmp/volumeInfo_$volumeName 2>&1 checkInfostatus if [ $STATUS == "detaching" ]; then retries=1 while [ $retries -ne 60 ]; do #retry until it's attached - $AWSCLI detach-volume --volume-id $volumeName > /tmp/volumeInfo_$volumeName 2>&1 + $AWSCLI detach-volume --volume-id $volumeName --region $Region > /tmp/volumeInfo_$volumeName 2>&1 checkInfostatus if [ $STATUS == "available" ]; then @@ -225,7 +230,7 @@ detachvolume() { attachvolume() { #detach volume - $AWSCLI attach-volume --volume-id $volumeName --instance-id $instanceName --device $deviceName > /tmp/volumeInfo_$volumeName 2>&1 + $AWSCLI attach-volume --volume-id $volumeName --instance-id $instanceName --device $deviceName --region $Region > /tmp/volumeInfo_$volumeName 2>&1 checkInfostatus if [ $STATUS == "attaching" -o $STATUS == "already-attached" ]; then @@ -259,13 +264,13 @@ attachvolume() { deletevolume() { #delete volume - $AWSCLI delete-volume --volume-id $volumeName > /tmp/deletevolume_$volumeName 2>&1 + $AWSCLI delete-volume --volume-id $volumeName --region $Region > /tmp/deletevolume_$volumeName 2>&1 return } createTag() { #create tag - $AWSCLI create-tags --resources $resourceName --tags Key=$tagName,Value=$tagValue > /tmp/createTag_$volumeName 2>&1 + $AWSCLI create-tags --resources $resourceName --tags Key=$tagName,Value=$tagValue --region $Region > /tmp/createTag_$volumeName 2>&1 return } diff --git a/oam/cloud/MCSgetCredentials.sh b/oam/cloud/MCSgetCredentials.sh index 6d03d51db..fd20e8fdb 100644 --- a/oam/cloud/MCSgetCredentials.sh +++ b/oam/cloud/MCSgetCredentials.sh @@ -1,6 +1,11 @@ #! /bin/sh # Get Amazon EC2 security-credentials, access and secret access keys # +#first check for local versions, then meta-data versions +if [ -f $HOME/.aws/credentials ]; then + exit 0 +fi + instance_profile=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/` # diff --git a/oam/etc/Columnstore.xml b/oam/etc/Columnstore.xml index 940e2ee77..a95afb7cf 100644 --- a/oam/etc/Columnstore.xml +++ b/oam/etc/Columnstore.xml @@ -445,7 +445,6 @@ unassigned unassigned unassigned - us-east-1 unassigned unassigned autoassign diff --git a/oam/install_scripts/post-install b/oam/install_scripts/post-install index 61a79b833..5d8a5101e 100755 --- a/oam/install_scripts/post-install +++ b/oam/install_scripts/post-install @@ -249,16 +249,11 @@ if [ $rc1 -ne 0 -a $rc2 -ne 0 ]; then echo " " >> ${bashFile} fi -#check and get amazon EC2 env variables -#if [ -n "$EC2_HOME" ]; then -# $installdir/bin/setConfig -d Installation EC2_HOME $EC2_HOME - -# if [ -n "$EC2_HOME" ]; then -# $installdir/bin/setConfig -d Installation JAVA_HOME $JAVA_HOME -# fi - -# $installdir/bin/setConfig -d Installation EC2_PATH $PATH:/home/ec2/bin:/opt/aws/bin -#fi +#check and get amazon env variables +aws=`which aws 2>/dev/null` +if [ -z "aws" ]; then + $installdir/bin/MCSgetCredentials.sh +fi #log install message test -f $installdir/post/functions && . $installdir/post/functions diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index 840901f61..c9bcf4694 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -905,36 +905,15 @@ int main(int argc, char *argv[]) { bool noKey = false; - string awsCertFile = HOME + "/.aws/credentials"; - ifstream File (awsCertFile.c_str()); - if (!File) { - cout << "Error: AWS CLI Certificate file not found, " + awsCertFile << endl; - cout << "Check Amazon Install Documenation for additional information, exiting" << endl; + string cmd="bin/MCSgetCredentials.sh" + int rtnCode = system(cmd.c_str()); + if ( WEXITSTATUS(rtnCode) != 0 ) { + cout << "Error: No IAM Profile with Security Certificates or AWS CLI Certificate file configured" << endl; + cout << "Check Amazon Install Documenation for additional information, exiting..." << endl; exit (1); } } -/* 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); From 27c43ff00e95384464b060abd148cbc00e9fa2c9 Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 4 Jan 2017 17:23:38 -0600 Subject: [PATCH 17/31] MCOL-462 --- oamapps/postConfigure/postConfigure.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index c9bcf4694..902f8389a 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -905,7 +905,7 @@ int main(int argc, char *argv[]) { bool noKey = false; - string cmd="bin/MCSgetCredentials.sh" + string cmd = installDir + "/bin/MCSgetCredentials.sh"; int rtnCode = system(cmd.c_str()); if ( WEXITSTATUS(rtnCode) != 0 ) { cout << "Error: No IAM Profile with Security Certificates or AWS CLI Certificate file configured" << endl; From 6d00528234e1c05bab461dc85554c0d0c2b87c12 Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 5 Jan 2017 10:19:32 -0600 Subject: [PATCH 18/31] MCOL-462 --- oam/cloud/MCSInstanceCmds.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/oam/cloud/MCSInstanceCmds.sh b/oam/cloud/MCSInstanceCmds.sh index d1a03b707..079e6c50e 100755 --- a/oam/cloud/MCSInstanceCmds.sh +++ b/oam/cloud/MCSInstanceCmds.sh @@ -98,9 +98,9 @@ instance="" AWSCLI="aws ec2 " getRegion() { - region=`curl --silent http://169.254.169.254/latest/dynamic/instance-identity/document/region | grep region | cut -d':' -f2 | sed 's/\"//g' | sed -e 's/^[ \t]*//'` + Region=`curl --silent http://169.254.169.254/latest/dynamic/instance-identity/document/region | grep region | cut -d':' -f2 | sed 's/\"//g' | sed -e 's/^[ \t]*//'` - echo $region + echo $Region return } @@ -206,7 +206,7 @@ getGroup() { getRegion >/dev/null 2>&1 #get group id - groupid=`aws ec2 describe-instances --instance-ids $instanceName --region $Region --output text --query 'Reservations[*].Instances[*].SecurityGroups[*].GroupId'` + groupid=`aws ec2 describe-instances --instance-ids $instanceName --region $Region --output text --query 'Reservations[*].Instances[*].SecurityGroups[*].GroupId' | grep -m 1 sg` echo $groupid return } @@ -305,7 +305,7 @@ startInstance() { #terminate Instance $AWSCLI start-instances --instance-ids $instanceName --region $Region > /tmp/startInstanceInfo_$instanceName 2>&1 - cat /tmp/startInstanceInfo_$instanceName | grep INSTANCE > /tmp/startInstanceStatus_$instanceName + cat /tmp/startInstanceInfo_$instanceName | grep InstanceId > /tmp/startInstanceStatus_$instanceName if [ `cat /tmp/startInstanceStatus_$instanceName | wc -c` -eq 0 ]; then echo "Failed, check /tmp/startInstanceInfo_$instanceName" exit 1 @@ -315,9 +315,12 @@ startInstance() { } assignElasticIP() { - EIP=`$AWSCLI describe-addresses --public-ips $IPAddress | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + #get region + getRegion >/dev/null 2>&1 + + EIP=`$AWSCLI describe-addresses --region $Region --public-ips $IPAddress --query 'Addresses[*].AllocationId' --output text` - $AWSCLI associate-address --instance-id $instanceName --allocation-id $EIP > /tmp/assignElasticIPInfo_$IPAddress 2>&1 + $AWSCLI associate-address --region $Region --instance-id $instanceName --allocation-id $EIP > /tmp/assignElasticIPInfo_$IPAddress 2>&1 cat /tmp/assignElasticIPInfo_$IPAddress | grep error > /tmp/assignElasticIPStatus_$IPAddress if [ `cat /tmp/assignElasticIPStatus_$IPAddress | wc -c` -ne 0 ]; then @@ -330,9 +333,12 @@ assignElasticIP() { } deassignElasticIP() { - EIP=`$AWSCLI describe-addresses --public-ips $IPAddress | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $3}'` + #get region + getRegion >/dev/null 2>&1 - $AWSCLI disassociate-address --association-id $EIP > /tmp/deassignElasticIPInfo_$IPAddress 2>&1 + EIP=`$AWSCLI describe-addresses --region $Region --public-ips $IPAddress --query 'Addresses[*].AssociationId' --output text` + + $AWSCLI disassociate-address --region $Region --association-id $EIP > /tmp/deassignElasticIPInfo_$IPAddress 2>&1 cat /tmp/deassignElasticIPInfo_$IPAddress | grep error > /tmp/deassignElasticIPStatus_$IPAddress if [ `cat /tmp/deassignElasticIPStatus_$IPAddress | wc -c` -ne 0 ]; then echo "Failed, check /tmp/deassignElasticIPStatus_$IPAddress" From b1048199c15a89fb2b3a40279cefb9a8d5aeff1b Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 5 Jan 2017 11:39:04 -0600 Subject: [PATCH 19/31] MCOL-462 --- oam/cloud/MCSgetCredentials.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/oam/cloud/MCSgetCredentials.sh b/oam/cloud/MCSgetCredentials.sh index fd20e8fdb..4125fb59f 100644 --- a/oam/cloud/MCSgetCredentials.sh +++ b/oam/cloud/MCSgetCredentials.sh @@ -6,22 +6,22 @@ if [ -f $HOME/.aws/credentials ]; then exit 0 fi -instance_profile=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/` +instance_profile=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/` # if [ -z "$instance_profile" ]; then exit 1; fi -aws_access_key_id=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep AccessKeyId | cut -d':' -f2 | sed 's/[^0-9A-Z]*//g'` +aws_access_key_id=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep AccessKeyId | cut -d':' -f2 | sed 's/[^0-9A-Z]*//g'` if [ -z "$aws_access_key_id" ]; then exit 1; fi -aws_secret_access_key=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep SecretAccessKey | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g'` +aws_secret_access_key=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep SecretAccessKey | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g'` -if [ -z "$aws_secret_access_key_id" ]; then +if [ -z "$aws_secret_access_key" ]; then exit 1; fi From dc70f3465a3546f77806a7b0b86d8a5f8a181894 Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 5 Jan 2017 13:10:51 -0600 Subject: [PATCH 20/31] MCOL-462 --- oam/etc/Columnstore.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oam/etc/Columnstore.xml b/oam/etc/Columnstore.xml index a95afb7cf..3729f2593 100644 --- a/oam/etc/Columnstore.xml +++ b/oam/etc/Columnstore.xml @@ -451,11 +451,11 @@ unassigned unassigned unassigned - standard + gp2 unassigned unassigned unassigned - standard + gp2 unassigned y y From 01b9e3024561d6a28bec3fa07e3f50bec5673fa6 Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 5 Jan 2017 14:06:18 -0600 Subject: [PATCH 21/31] MCOL-462 - change aws comment --- oamapps/postConfigure/postConfigure.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index 902f8389a..91fd67d71 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -867,9 +867,11 @@ int main(int argc, char *argv[]) { if ( cloud == oam::UnassignedName ) { + cout << "NOTE: Amazon AWS CLI Tools are installed and allow MariaDB ColumnStore to create Instances and ABS Volumes" << endl << endl; + while(true) { string enable = "y"; - prompt = "Amazon AWS CLI Tools are installed, do you want to have ColumnStore utilize them [y,n] (y) > "; + prompt = "Do you want to have ColumnStore use the Amazon AWS CLI Tools [y,n] (y) > "; pcommand = callReadline(prompt.c_str()); if (pcommand) { From d61e16ee3f343b653c41e08b8647b73c9e59e5a9 Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 5 Jan 2017 14:31:52 -0600 Subject: [PATCH 22/31] MCOL-462 - add check to getcred --- oam/cloud/MCSgetCredentials.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/oam/cloud/MCSgetCredentials.sh b/oam/cloud/MCSgetCredentials.sh index 4125fb59f..6bc877547 100644 --- a/oam/cloud/MCSgetCredentials.sh +++ b/oam/cloud/MCSgetCredentials.sh @@ -6,6 +6,14 @@ if [ -f $HOME/.aws/credentials ]; then exit 0 fi +#check for iam folder +iam=`curl -s http://169.254.169.254/latest/meta-data/ | grep iam` + + +if [ -z "$iam" ]; then + exit 1; +fi + instance_profile=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/` # From 76876ff193b71ea17256929e5fa933c8668af2f5 Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 5 Jan 2017 14:47:12 -0600 Subject: [PATCH 23/31] MCOL-462 - fixed rsyslog restart error --- oam/install_scripts/syslogSetup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oam/install_scripts/syslogSetup.sh b/oam/install_scripts/syslogSetup.sh index 5accb84a6..1fd71023a 100755 --- a/oam/install_scripts/syslogSetup.sh +++ b/oam/install_scripts/syslogSetup.sh @@ -176,7 +176,7 @@ if [ ! -z "$syslog_conf" ] ; then fi fi - $SUDO etc/init.d/rsyslog restart > /dev/null 2>&1 + $SUDO /etc/init.d/rsyslog restart > /dev/null 2>&1 $SUDO /etc/init.d/syslog restart > /dev/null 2>&1 $SUDO /etc/init.d/syslog-ng restart > /dev/null 2>&1 @@ -212,7 +212,7 @@ if [ ! -z "$syslog_conf" ] ; then $SUDO rm -f "$syslog_conf" fi - $SUDO etc/init.d/rsyslog restart > /dev/null 2>&1 + $SUDO /etc/init.d/rsyslog restart > /dev/null 2>&1 $SUDO /etc/init.d/syslog restart > /dev/null 2>&1 $SUDO /etc/init.d/syslog-ng restart > /dev/null 2>&1 From 9a7b048ba3855aa9befc79e675a9a9089f93f264 Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 5 Jan 2017 16:19:05 -0600 Subject: [PATCH 24/31] MCOL-462 --- oam/cloud/MCSInstanceCmds.sh | 80 ++++++++++++++++++++++------------ oam/cloud/MCSgetCredentials.sh | 18 +++----- oam/oamcpp/liboamcpp.cpp | 42 +++++++++++++----- 3 files changed, 88 insertions(+), 52 deletions(-) diff --git a/oam/cloud/MCSInstanceCmds.sh b/oam/cloud/MCSInstanceCmds.sh index 079e6c50e..a053d3f77 100755 --- a/oam/cloud/MCSInstanceCmds.sh +++ b/oam/cloud/MCSInstanceCmds.sh @@ -8,8 +8,7 @@ prefix=/usr/local #check command if [ "$1" = "" ]; then - echo "Enter Command Name: {launchInstance|getInstance|getZone|getPrivateIP|getKey|getAMI|getType|terminateInstance|startInstance|assignElasticIP|deassignElasticIP|getProfile|stopInstance|getGroup|getSubnet|getVpc|getRegion} -}" + echo "Enter Command Name: {launchInstance|getInstance|getZone|getPrivateIP|getKey|getAMI|getType|terminateInstance|startInstance|assignElasticIP|deassignElasticIP|getProfile|stopInstance|getGroup|getSubnet|getVpc|getRegion|getRole}" exit 1 fi @@ -104,6 +103,24 @@ getRegion() { return } +getRole() { + #check for iam folder + iam=`curl -s http://169.254.169.254/latest/meta-data/ | grep iam` + + if [ -z "$iam" ]; then + exit 1; + fi + + Role=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/` + + if [ -z "$role" ]; then + exit 1; + fi + + echo $Role + return +} + getInstance() { if [ "$instanceName" != "" ]; then echo $instanceName @@ -232,49 +249,52 @@ launchInstance() { #get group getGroup >/dev/null 2>&1 fi + #get AMI getAMI >/dev/null 2>&1 + #get Zone getZone >/dev/null 2>&1 if [ "$instanceType" = "unassigned" ]; then #get type getType >/dev/null 2>&1 fi - #get AMI Profile - getProfile >/dev/null 2>&1 #get Subnet getSubnet >/dev/null 2>&1 - if [ "$instanceProfile" = "" ] || [ "$instanceProfile" = "default-hvm" ]; then - if [ "$groupid" != "default" ]; then - if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ] ; then - newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --image-id $ami --security-group-ids $groupid --query 'Instances[*].InstanceId' --output text` - else - newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` - fi + #get IAM Role + getRole >/dev/null 2>&1 + + if [ "$Role" = "" ] || [ "$Role" = "default" ]; then + if [ "$groupid" != "default" ]; then + if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ] ; then + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --image-id $ami --security-group-ids $groupid --query 'Instances[*].InstanceId' --output text` else - if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then - newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` - else - newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` - fi + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` fi else - if [ "$groupid" != "default" ]; then - if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then - newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` - else - newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` - fi + if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` else - if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then - newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` - else - newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $instanceProfile --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` - fi + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` fi fi + else + if [ "$groupid" != "default" ]; then + if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $Role --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` + else + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $Role --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` + fi + else + if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $Role --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` + else + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $Role --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` + fi + fi + fi echo $newInstance return @@ -421,9 +441,11 @@ case "$1" in getRegion) getRegion ;; - + getRole) + getRole + ;; *) - echo $"Usage: $0 {launchInstance|getInstance|getZone|getPrivateIP|getType|getKey|getAMI|terminateInstance|startInstance|assignElasticIP|deassignElasticIP|getProfile|stopInstance|getGroup|getSubnet|getVpc|getRegion}" + echo $"Usage: $0 {launchInstance|getInstance|getZone|getPrivateIP|getType|getKey|getAMI|terminateInstance|startInstance|assignElasticIP|deassignElasticIP|getProfile|stopInstance|getGroup|getSubnet|getVpc|getRegion|getRole}" exit 1 esac diff --git a/oam/cloud/MCSgetCredentials.sh b/oam/cloud/MCSgetCredentials.sh index 6bc877547..2454529b6 100644 --- a/oam/cloud/MCSgetCredentials.sh +++ b/oam/cloud/MCSgetCredentials.sh @@ -6,28 +6,20 @@ if [ -f $HOME/.aws/credentials ]; then exit 0 fi -#check for iam folder -iam=`curl -s http://169.254.169.254/latest/meta-data/ | grep iam` +#get IAM Role +Role=`$prefix/mariadb/columnstore/bin/MCSInstanceCmds.sh getRole` - -if [ -z "$iam" ]; then +if [ -z "$Role" ]; then exit 1; fi -instance_profile=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/` -# - -if [ -z "$instance_profile" ]; then - exit 1; -fi - -aws_access_key_id=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep AccessKeyId | cut -d':' -f2 | sed 's/[^0-9A-Z]*//g'` +aws_access_key_id=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/${Role} | grep AccessKeyId | cut -d':' -f2 | sed 's/[^0-9A-Z]*//g'` if [ -z "$aws_access_key_id" ]; then exit 1; fi -aws_secret_access_key=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep SecretAccessKey | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g'` +aws_secret_access_key=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/${Role} | grep SecretAccessKey | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g'` if [ -z "$aws_secret_access_key" ]; then exit 1; diff --git a/oam/oamcpp/liboamcpp.cpp b/oam/oamcpp/liboamcpp.cpp index 828c9df9d..fc40b5462 100644 --- a/oam/oamcpp/liboamcpp.cpp +++ b/oam/oamcpp/liboamcpp.cpp @@ -5967,11 +5967,22 @@ namespace oam cout << " Create AWS Volume for UM #" << itoa(moduleID) << endl; - volumeName = createEC2Volume(UMVolumeSize, "um"); - if ( volumeName == "failed" ) { - writeLog("addModule: create volume failed", LOG_TYPE_CRITICAL); - exceptionControl("addUMdisk", API_FAILURE); - } + int retry = 0; + for ( ; retry < 5 ; retry++ ) + { + volumeName = createEC2Volume(UMVolumeSize, "um"); + + if ( volumeName == "failed" || volumeName.empty() ) + retry = retry; + else + break; + } + + if ( retry >= 5 ) + { + cout << " *** ERROR: Failed to create a Volume for um1 " << moduleID << endl; + exceptionControl("addUMdisk", API_FAILURE); + } //attach and format volumes device = "/dev/sdf"; @@ -5979,11 +5990,22 @@ namespace oam string localInstance = getEC2LocalInstance(); //attach volumes to local instance - writeLog("addUMdisk - Attach new Volume to local instance: " + volumeName, LOG_TYPE_DEBUG); - if (!attachEC2Volume(volumeName, device, localInstance)) { - writeLog("addUMdisk: volume failed to attach to local instance", LOG_TYPE_CRITICAL); - exceptionControl("addUMdisk", API_FAILURE); - } + writeLog("addUMdisk - Attach new Volume to local instance: " + volumeName, LOG_TYPE_DEBUG); + + retry = 0; + for ( ; retry < 5 ; retry++ ) + { + if (!attachEC2Volume(volumeName, device, localInstance)) + detachEC2Volume(volumeName); + else + break; + } + + if ( retry >= 5 ) + { + cout << " *** ERROR: Volume " << volumeName << " failed to attach to local instance" << endl; + exceptionControl("addUMdisk", API_FAILURE); + } //format attached volume writeLog("addUMdisk - Format new Volume for: " + volumeName, LOG_TYPE_DEBUG); From cc371071752a6f2800b20a60fcade535c40e5d49 Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 5 Jan 2017 16:38:01 -0600 Subject: [PATCH 25/31] MCOL-462 --- oam/cloud/MCSgetCredentials.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/oam/cloud/MCSgetCredentials.sh b/oam/cloud/MCSgetCredentials.sh index 2454529b6..ff1cd15ef 100644 --- a/oam/cloud/MCSgetCredentials.sh +++ b/oam/cloud/MCSgetCredentials.sh @@ -1,6 +1,8 @@ #! /bin/sh # Get Amazon EC2 security-credentials, access and secret access keys # +prefix=/usr/local + #first check for local versions, then meta-data versions if [ -f $HOME/.aws/credentials ]; then exit 0 From 753024a476e09d7e808514b51cfec34d1065681e Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 5 Jan 2017 16:58:03 -0600 Subject: [PATCH 26/31] MCOL-462 --- oam/cloud/MCSgetCredentials.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/oam/cloud/MCSgetCredentials.sh b/oam/cloud/MCSgetCredentials.sh index ff1cd15ef..05a6f1aae 100644 --- a/oam/cloud/MCSgetCredentials.sh +++ b/oam/cloud/MCSgetCredentials.sh @@ -1,18 +1,23 @@ #! /bin/sh # Get Amazon EC2 security-credentials, access and secret access keys # -prefix=/usr/local - #first check for local versions, then meta-data versions if [ -f $HOME/.aws/credentials ]; then exit 0 fi #get IAM Role -Role=`$prefix/mariadb/columnstore/bin/MCSInstanceCmds.sh getRole` +#check for iam folder +iam=`curl -s http://169.254.169.254/latest/meta-data/ | grep iam` + +if [ -z "$iam" ]; then + exit 1; +fi + +Role=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/` if [ -z "$Role" ]; then - exit 1; + exit 1; fi aws_access_key_id=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/${Role} | grep AccessKeyId | cut -d':' -f2 | sed 's/[^0-9A-Z]*//g'` From e6aafd98789c8dee0497b1c9fa6d4fa701f507b9 Mon Sep 17 00:00:00 2001 From: David Hill Date: Fri, 6 Jan 2017 11:04:06 -0600 Subject: [PATCH 27/31] MCOL-462 --- oam/cloud/MCSInstanceCmds.sh | 10 +++++----- oam/cloud/MCSgetCredentials.sh | 7 +++++++ oam/install_scripts/post-install | 2 +- oamapps/postConfigure/postConfigure.cpp | 4 ++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/oam/cloud/MCSInstanceCmds.sh b/oam/cloud/MCSInstanceCmds.sh index a053d3f77..768aadc1c 100755 --- a/oam/cloud/MCSInstanceCmds.sh +++ b/oam/cloud/MCSInstanceCmds.sh @@ -113,7 +113,7 @@ getRole() { Role=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/` - if [ -z "$role" ]; then + if [ -z "$Role" ]; then exit 1; fi @@ -283,15 +283,15 @@ launchInstance() { else if [ "$groupid" != "default" ]; then if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then - newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $Role --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile "Name=$Role" --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` else - newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $Role --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile "Name=$Role" --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` fi else if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then - newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $Role --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile "Name=$Role" --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` else - newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile $Role --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile "Name=$Role" --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` fi fi fi diff --git a/oam/cloud/MCSgetCredentials.sh b/oam/cloud/MCSgetCredentials.sh index 05a6f1aae..9660653f0 100644 --- a/oam/cloud/MCSgetCredentials.sh +++ b/oam/cloud/MCSgetCredentials.sh @@ -3,6 +3,7 @@ # #first check for local versions, then meta-data versions if [ -f $HOME/.aws/credentials ]; then + echo "$HOME/.aws/credentials found, use local credentials" exit 0 fi @@ -11,27 +12,33 @@ fi iam=`curl -s http://169.254.169.254/latest/meta-data/ | grep iam` if [ -z "$iam" ]; then + echo "No IAM in meta-data" exit 1; fi Role=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/` if [ -z "$Role" ]; then + echo "No Role in IAM meta-data" exit 1; fi aws_access_key_id=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/${Role} | grep AccessKeyId | cut -d':' -f2 | sed 's/[^0-9A-Z]*//g'` if [ -z "$aws_access_key_id" ]; then + echo "No Access-Key is blank in IAM meta-data" exit 1; fi aws_secret_access_key=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/${Role} | grep SecretAccessKey | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g'` if [ -z "$aws_secret_access_key" ]; then + echo "No Secret-Key is blank in IAM meta-data" exit 1; fi + +echo $aws_access_key_id $aws_secret_access_key # export AWS_ACCESS_KEY_ID=${aws_access_key_id} export AWS_SECRET_ACCESS_KEY=${aws_secret_access_key} diff --git a/oam/install_scripts/post-install b/oam/install_scripts/post-install index 5d8a5101e..160cacc97 100755 --- a/oam/install_scripts/post-install +++ b/oam/install_scripts/post-install @@ -252,7 +252,7 @@ fi #check and get amazon env variables aws=`which aws 2>/dev/null` if [ -z "aws" ]; then - $installdir/bin/MCSgetCredentials.sh + $installdir/bin/MCSgetCredentials.sh >/dev/null 2>&1 fi #log install message diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index 91fd67d71..efaa7c436 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -907,10 +907,10 @@ int main(int argc, char *argv[]) { bool noKey = false; - string cmd = installDir + "/bin/MCSgetCredentials.sh"; + string cmd = installDir + "/bin/MCSgetCredentials.sh >/dev/null 2>&1"; int rtnCode = system(cmd.c_str()); if ( WEXITSTATUS(rtnCode) != 0 ) { - cout << "Error: No IAM Profile with Security Certificates or AWS CLI Certificate file configured" << endl; + cout << endl << "Error: No IAM Profile with Security Certificates used or AWS CLI Certificate file configured" << endl; cout << "Check Amazon Install Documenation for additional information, exiting..." << endl; exit (1); } From fbe46f62f61c1e26bfff3a2674c2e4df6132b41c Mon Sep 17 00:00:00 2001 From: David Hill Date: Fri, 6 Jan 2017 14:03:30 -0600 Subject: [PATCH 28/31] MCOL-462 --- oam/cloud/MCSInstanceCmds.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oam/cloud/MCSInstanceCmds.sh b/oam/cloud/MCSInstanceCmds.sh index 768aadc1c..a9de70c42 100755 --- a/oam/cloud/MCSInstanceCmds.sh +++ b/oam/cloud/MCSInstanceCmds.sh @@ -283,9 +283,9 @@ launchInstance() { else if [ "$groupid" != "default" ]; then if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then - newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile "Name=$Role" --subnet-id $subnet --image-id $ami --query 'Instances[*].InstanceId' --output text` + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile "Name=$Role" --subnet-id $subnet --image-id $ami --security-group-ids $groupid --query 'Instances[*].InstanceId' --output text` else - newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile "Name=$Role" --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --query 'Instances[*].InstanceId' --output text` + newInstance=`$AWSCLI run-instances --region $Region --key-name $key --instance-type $instanceType --placement AvailabilityZone=$zone --iam-instance-profile "Name=$Role" --subnet-id $subnet --private-ip-address $IPaddress --image-id $ami --security-group-ids $groupid --query 'Instances[*].InstanceId' --output text` fi else if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; then From 72f020cc1afec03687439d26634826b5e53ad4e1 Mon Sep 17 00:00:00 2001 From: David Hill Date: Fri, 6 Jan 2017 15:11:43 -0600 Subject: [PATCH 29/31] MCOL-462 --- oam/etc/Columnstore.xml | 6 -- oamapps/mcsadmin/mcsadmin.cpp | 10 --- oamapps/postConfigure/postConfigure.cpp | 99 +++++++------------------ tools/configMgt/autoConfigure.cpp | 34 +-------- 4 files changed, 28 insertions(+), 121 deletions(-) diff --git a/oam/etc/Columnstore.xml b/oam/etc/Columnstore.xml index 3729f2593..f9ecbc116 100644 --- a/oam/etc/Columnstore.xml +++ b/oam/etc/Columnstore.xml @@ -443,10 +443,6 @@ unassigned mariadb1 unassigned - unassigned - unassigned - unassigned - unassigned autoassign unassigned unassigned @@ -466,8 +462,6 @@ 0 unassigned n - unassigned - unassigned 3306 unassigned /dev/xvd diff --git a/oamapps/mcsadmin/mcsadmin.cpp b/oamapps/mcsadmin/mcsadmin.cpp index d4ceeb76c..b5100265e 100644 --- a/oamapps/mcsadmin/mcsadmin.cpp +++ b/oamapps/mcsadmin/mcsadmin.cpp @@ -4863,16 +4863,6 @@ int processCommand(string* arguments) } catch(...) {} - if ( cloud == "amazon-vpc" ) - { - string AmazonSubNetID = oam::UnassignedName; - try{ - oam.getSystemConfig("AmazonSubNetID", AmazonSubNetID); - - cout << "AmazonSubNetID = " << AmazonSubNetID << endl; - } - catch(...) {} - } } cout << endl; diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index efaa7c436..640c9fd03 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -153,7 +153,6 @@ bool thread_remote_installer = true; string singleServerInstall = "1"; string reuseConfig ="n"; string oldFileName; -string AmazonRegion; string glusterCopies; string glusterInstalled = "n"; string hadoopInstalled = "n"; @@ -833,7 +832,6 @@ int main(int argc, char *argv[]) //amazon install setup check bool amazonInstall = false; - string amazonSubNet = oam::UnassignedName; string cloud = oam::UnassignedName; system("aws --version > /tmp/amazon.log 2>&1"); @@ -870,43 +868,41 @@ int main(int argc, char *argv[]) cout << "NOTE: Amazon AWS CLI Tools are installed and allow MariaDB ColumnStore to create Instances and ABS Volumes" << endl << endl; while(true) { - string enable = "y"; - prompt = "Do you want to have ColumnStore use the Amazon AWS CLI Tools [y,n] (y) > "; - pcommand = callReadline(prompt.c_str()); + string enable = "y"; + prompt = "Do you want to have ColumnStore use the Amazon AWS CLI Tools [y,n] (y) > "; + pcommand = callReadline(prompt.c_str()); - if (pcommand) { - if (strlen(pcommand) > 0) enable = pcommand; - callFree(pcommand); + if (pcommand) { + if (strlen(pcommand) > 0) enable = pcommand; + callFree(pcommand); - if (enable == "n") { - amazonInstall = false; + if (enable == "n") { + amazonInstall = false; - try { - sysConfig->setConfig(InstallSection, "Cloud", "disable"); - } - catch(...) - {}; + try { + sysConfig->setConfig(InstallSection, "Cloud", "disable"); + } + catch(...) + {}; + break; + } + } + + if ( enable != "y" ) + { + cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl; + if ( noPrompting ) + exit(1); + } break; - } } - - if ( enable != "y" ) - { - cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl; - if ( noPrompting ) - exit(1); - } - break; - } - } + } else cout << "NOTE: Configured to have ColumnStore use the Amazon AWS CLI Tools" << endl << endl; if ( amazonInstall ) { - bool noKey = false; - string cmd = installDir + "/bin/MCSgetCredentials.sh >/dev/null 2>&1"; int rtnCode = system(cmd.c_str()); if ( WEXITSTATUS(rtnCode) != 0 ) { @@ -921,55 +917,13 @@ int main(int argc, char *argv[]) exit(1); } - sleep(1); - - //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"; - } - - //set subnetID - try { - sysConfig->setConfig(InstallSection, "AmazonSubNetID", amazonSubNet); - } - catch(...) - {} - } - else - cloud = "amazon-vpc"; - try { - sysConfig->setConfig(InstallSection, "Cloud", cloud); + sysConfig->setConfig(InstallSection, "Cloud", "amazon-vpc"); } catch(...) {} } - else - { - try { - sysConfig->setConfig(InstallSection, "Cloud", oam::UnassignedName); - } - catch(...) - {} - } - + if ( pmwithum ) cout << endl << "NOTE: Local Query Feature is enabled" << endl; @@ -993,6 +947,7 @@ int main(int argc, char *argv[]) cout << endl; + // prompt for system name setSystemName(); cout << endl; diff --git a/tools/configMgt/autoConfigure.cpp b/tools/configMgt/autoConfigure.cpp index bb02d6d43..6dcc59487 100644 --- a/tools/configMgt/autoConfigure.cpp +++ b/tools/configMgt/autoConfigure.cpp @@ -147,20 +147,7 @@ int main(int argc, char *argv[]) {} bool build40 = false; - if ( !CoreFileFlag.empty() ) - build40 = true; - - //build 4.0.1 flag - string AmazonSubNetID; - try { - AmazonSubNetID = sysConfigNew->getConfig(InstallSection, "AmazonSubNetID"); - } - catch(...) - {} - - bool build401 = false; - if ( !AmazonSubNetID.empty() ) - build401 = true; + bool build401 = true; //set install config flag try { @@ -1283,18 +1270,13 @@ int main(int argc, char *argv[]) // if (build3) { //setup cloud parameters - string x509Cert; - string x509PriKey; string UMStorageType; - string rpw; string PMInstanceType; string UMInstanceType; string UMSecurityGroup; string UMVolumeSize; string PMVolumeSize; string AmazonAutoTagging; - string AmazonRegion; - string AmazonZone; string AmazonVPCNextPrivateIP; string AmazonDeviceName; string UMVolumeType; @@ -1305,20 +1287,14 @@ int main(int argc, char *argv[]) try { cloud = sysConfigOld->getConfig(InstallSection, "Cloud"); - x509Cert = sysConfigOld->getConfig(InstallSection, "AmazonX509Certificate"); - x509PriKey = sysConfigOld->getConfig(InstallSection, "AmazonX509PrivateKey"); UMStorageType = sysConfigOld->getConfig(InstallSection, "UMStorageType"); - rpw = sysConfigOld->getConfig(InstallSection, "rpw"); PMInstanceType = sysConfigOld->getConfig(InstallSection, "PMInstanceType"); UMInstanceType = sysConfigOld->getConfig(InstallSection, "UMInstanceType"); UMSecurityGroup = sysConfigOld->getConfig(InstallSection, "UMSecurityGroup"); UMVolumeSize = sysConfigOld->getConfig(InstallSection, "UMVolumeSize"); PMVolumeSize = sysConfigOld->getConfig(InstallSection, "PMVolumeSize"); AmazonAutoTagging = sysConfigOld->getConfig(InstallSection, "AmazonAutoTagging"); - AmazonRegion = sysConfigOld->getConfig(InstallSection, "AmazonRegion"); - AmazonZone = sysConfigOld->getConfig(InstallSection, "AmazonZone"); AmazonVPCNextPrivateIP = sysConfigOld->getConfig(InstallSection, "AmazonVPCNextPrivateIP"); - AmazonSubNetID = sysConfigOld->getConfig(InstallSection, "AmazonSubNetID"); AmazonDeviceName = sysConfigOld->getConfig(InstallSection, "AmazonDeviceName"); UMVolumeType = sysConfigOld->getConfig(InstallSection, "UMVolumeType"); UMVolumeIOPS = sysConfigOld->getConfig(InstallSection, "UMVolumeIOPS"); @@ -1355,13 +1331,10 @@ int main(int argc, char *argv[]) cloud = oam::UnassignedName; if ( cloud == "amazon") cloud = "amazon-ec2"; - if ( AmazonSubNetID.empty() ) - AmazonSubNetID = oam::UnassignedName; if ( AmazonVPCNextPrivateIP.empty() ) AmazonVPCNextPrivateIP = oam::UnassignedName; try { - sysConfigNew->setConfig(InstallSection, "AmazonSubNetID", AmazonSubNetID); sysConfigNew->setConfig(InstallSection, "AmazonVPCNextPrivateIP", AmazonVPCNextPrivateIP); } catch(...) @@ -1373,18 +1346,13 @@ int main(int argc, char *argv[]) try { sysConfigNew->setConfig(InstallSection, "Cloud", cloud); - sysConfigNew->setConfig(InstallSection, "AmazonX509Certificate", x509Cert); - sysConfigNew->setConfig(InstallSection, "AmazonX509PrivateKey", x509PriKey); sysConfigNew->setConfig(InstallSection, "UMStorageType", UMStorageType); - sysConfigNew->setConfig(InstallSection, "rpw", rpw); sysConfigNew->setConfig(InstallSection, "PMInstanceType", PMInstanceType); sysConfigNew->setConfig(InstallSection, "UMInstanceType", UMInstanceType); sysConfigNew->setConfig(InstallSection, "UMSecurityGroup", UMSecurityGroup); sysConfigNew->setConfig(InstallSection, "UMVolumeSize", UMVolumeSize); sysConfigNew->setConfig(InstallSection, "PMVolumeSize", PMVolumeSize); sysConfigNew->setConfig(InstallSection, "AmazonAutoTagging", AmazonAutoTagging); - sysConfigNew->setConfig(InstallSection, "AmazonRegion", AmazonRegion); - sysConfigNew->setConfig(InstallSection, "AmazonZone", AmazonZone); sysConfigNew->setConfig(InstallSection, "AmazonDeviceName", AmazonDeviceName); sysConfigNew->setConfig(InstallSection, "UMVolumeType", UMVolumeType); From 6e61a32594bb1cca153d7ca0b4f263a7f6e35e95 Mon Sep 17 00:00:00 2001 From: David Hill Date: Sat, 7 Jan 2017 15:48:49 -0600 Subject: [PATCH 30/31] MCOL-462 --- oam/cloud/MCSInstanceCmds.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oam/cloud/MCSInstanceCmds.sh b/oam/cloud/MCSInstanceCmds.sh index a9de70c42..006cf9f17 100755 --- a/oam/cloud/MCSInstanceCmds.sh +++ b/oam/cloud/MCSInstanceCmds.sh @@ -97,7 +97,7 @@ instance="" AWSCLI="aws ec2 " getRegion() { - Region=`curl --silent http://169.254.169.254/latest/dynamic/instance-identity/document/region | grep region | cut -d':' -f2 | sed 's/\"//g' | sed -e 's/^[ \t]*//'` + Region=`curl --silent http://169.254.169.254/latest/dynamic/instance-identity/document/region | grep region | cut -d':' -f2 | sed 's/\"//g' | sed 's/\,//g' | sed -e 's/^[ \t]*//'` echo $Region return From 4a642b37ca48a764069feba6f3556fde700f2c1f Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 11 Jan 2017 10:15:26 -0600 Subject: [PATCH 31/31] MCOL-462 - moved the setConfig - was always setting the amazon-vpc --- oamapps/postConfigure/postConfigure.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index 640c9fd03..3a9a7a2d8 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -894,7 +894,16 @@ int main(int argc, char *argv[]) cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl; if ( noPrompting ) exit(1); - } + } + else + { + try { + sysConfig->setConfig(InstallSection, "Cloud", "amazon-vpc"); + } + catch(...) + {} + } + break; } } @@ -916,12 +925,6 @@ int main(int argc, char *argv[]) cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; exit(1); } - - try { - sysConfig->setConfig(InstallSection, "Cloud", "amazon-vpc"); - } - catch(...) - {} } if ( pmwithum )