You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-11-03 17:13:17 +03:00
MCOL-462
This commit is contained in:
@@ -108,25 +108,14 @@ describeInstance() {
|
|||||||
describeInstance
|
describeInstance
|
||||||
|
|
||||||
getInstance() {
|
getInstance() {
|
||||||
if [ "$instance" != "" ]; then
|
if [ "$instanceiName" != "" ]; then
|
||||||
echo $instance
|
echo $instanceName
|
||||||
return
|
return
|
||||||
fi
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,30 +128,19 @@ getZone() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPrivateIP() {
|
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
|
#check if running or terminated
|
||||||
cat /tmp/instanceInfo_$instanceName | grep STATE > /tmp/instanceStatus_$instanceName
|
state=`aws ec2 describe-instances --instance-ids $instanceName --output text --query 'Reservations[*].Instances[*].State.Name'`
|
||||||
if [ `cat /tmp/instanceStatus_$instanceName | wc -c` -ne 0 ]; then
|
if [ "$state" != "running" ]; then
|
||||||
# not running
|
# not running
|
||||||
cat /tmp/instanceInfo_$instanceName | grep pending > /tmp/instanceStatus_$instanceName
|
if [ "$state" != "stopped" ]; then
|
||||||
if [ `cat /tmp/instanceStatus_$instanceName | wc -c` -ne 0 ]; then
|
|
||||||
describeInstance
|
|
||||||
echo "stopped"
|
echo "stopped"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
cat /tmp/instanceInfo_$instanceName | grep terminated > /tmp/instanceStatus_$instanceName
|
if [ "$state" != "terminated" ]; then
|
||||||
if [ `cat /tmp/instanceStatus_$instanceName | wc -c` -ne 0 ]; then
|
|
||||||
echo "terminated"
|
echo "terminated"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
cat /tmp/instanceInfo_$instanceName | grep shutting-down > /tmp/instanceStatus_$instanceName
|
if [ "$state" != "shutting-down" ]; then
|
||||||
if [ `cat /tmp/instanceStatus_$instanceName | wc -c` -ne 0 ]; then
|
|
||||||
echo "terminated"
|
echo "terminated"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
@@ -174,7 +152,7 @@ getPrivateIP() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
#running, get priviate IP Address
|
#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
|
echo $IpAddr
|
||||||
exit 0
|
exit 0
|
||||||
@@ -190,13 +168,9 @@ getType() {
|
|||||||
|
|
||||||
getKey() {
|
getKey() {
|
||||||
#get local Instance ID
|
#get local Instance ID
|
||||||
getInstancePrivate >/dev/null 2>&1
|
getInstance >/dev/null 2>&1
|
||||||
#get Key
|
|
||||||
if [ "$key" == "" ]; then
|
|
||||||
describeInstance
|
|
||||||
fi
|
|
||||||
|
|
||||||
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
|
echo $key
|
||||||
return
|
return
|
||||||
@@ -204,13 +178,9 @@ getKey() {
|
|||||||
|
|
||||||
getVpc() {
|
getVpc() {
|
||||||
#get local Instance ID
|
#get local Instance ID
|
||||||
getInstancePrivate >/dev/null 2>&1
|
getInstance >/dev/null 2>&1
|
||||||
#get VCP
|
#get VCP
|
||||||
if [ "$vcp" == "" ]; then
|
vpc=`aws ec2 describe-instances --instance-ids $instanceName --output text --query 'Reservations[*].Instances[*].VpcId'`
|
||||||
describeInstance
|
|
||||||
fi
|
|
||||||
|
|
||||||
vpc=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $21}'`
|
|
||||||
|
|
||||||
echo $vpc
|
echo $vpc
|
||||||
return
|
return
|
||||||
@@ -225,14 +195,8 @@ getAMI() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getGroup() {
|
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
|
#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
|
echo $groupid
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -269,29 +233,29 @@ launchInstance() {
|
|||||||
if [ "$instanceProfile" = "" ] || [ "$instanceProfile" = "default-hvm" ]; then
|
if [ "$instanceProfile" = "" ] || [ "$instanceProfile" = "default-hvm" ]; then
|
||||||
if [ "$groupid" != "default" ]; then
|
if [ "$groupid" != "default" ]; then
|
||||||
if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ] ; 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
|
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
|
else
|
||||||
if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; 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 | 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
|
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
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "$groupid" != "default" ]; then
|
if [ "$groupid" != "default" ]; then
|
||||||
if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; 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
|
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
|
||||||
else
|
else
|
||||||
if [ "$IPaddress" = "autoassign" ] || [ "$IPaddress" = "unassigned" ]; 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
|
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
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -356,13 +320,9 @@ deassignElasticIP() {
|
|||||||
|
|
||||||
getSubnet() {
|
getSubnet() {
|
||||||
#get local Instance ID
|
#get local Instance ID
|
||||||
getInstancePrivate >/dev/null 2>&1
|
getInstance >/dev/null 2>&1
|
||||||
#get Subnet
|
#get Subnet
|
||||||
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" == "" ]; then
|
|
||||||
describeInstance
|
|
||||||
fi
|
|
||||||
subnet=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $19}'`
|
|
||||||
|
|
||||||
if [[ $subnet == *"subnet"* ]]
|
if [[ $subnet == *"subnet"* ]]
|
||||||
then
|
then
|
||||||
|
|||||||
@@ -95,22 +95,6 @@ fi
|
|||||||
|
|
||||||
test -f $prefix/mariadb/columnstore/post/functions && . $prefix/mariadb/columnstore/post/functions
|
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 "
|
AWSCLI="aws ec2 "
|
||||||
|
|
||||||
checkInfostatus() {
|
checkInfostatus() {
|
||||||
@@ -184,9 +168,9 @@ createvolume() {
|
|||||||
|
|
||||||
#create volume
|
#create volume
|
||||||
if [ $volumeType == "io1" ]; then
|
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
|
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
|
fi
|
||||||
|
|
||||||
echo $volume
|
echo $volume
|
||||||
|
|||||||
@@ -1727,7 +1727,7 @@ int main(int argc, char *argv[])
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (newModuleIPAddr == "terminated") {
|
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 )
|
if ( noPrompting )
|
||||||
exit(1);
|
exit(1);
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user