trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbirds...@apache.org
Subject [01/13] incubator-trafodion git commit: Floating IP support for AWS cluster
Date Tue, 22 Dec 2015 16:28:32 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 1f9b52a63 -> 5746be35a


Floating IP support for AWS cluster


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/1f0d872b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/1f0d872b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/1f0d872b

Branch: refs/heads/master
Commit: 1f0d872bd11262fbd5b66b3e11d3cab059faf050
Parents: ebe876d
Author: Anuradha Hegde <hegdean@adev04.esgyn.com>
Authored: Mon Dec 14 03:33:33 2015 +0000
Committer: Anuradha Hegde <hegdean@adev04.esgyn.com>
Committed: Mon Dec 14 03:33:33 2015 +0000

----------------------------------------------------------------------
 core/sqf/sql/scripts/cleanlogs    |  86 +++++++++++++++++++++
 core/sqf/sql/scripts/dcscheck     |  13 +++-
 core/sqf/sql/scripts/dcsstop      |   4 +
 core/sqf/sql/scripts/sqcheck      |  50 ++++++++++++-
 dcs/bin/scripts/dcsbind.sh        | 132 ++++++++++++++++++++++++++++++++-
 dcs/bin/scripts/dcsunbind.sh      |  93 +++++++++++++++++++++++
 dcs/bin/scripts/parse_dcs_site.py |  39 ++++++++++
 install/installer/setup_ssh_key   |  27 +++++++
 8 files changed, 439 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1f0d872b/core/sqf/sql/scripts/cleanlogs
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/cleanlogs b/core/sqf/sql/scripts/cleanlogs
new file mode 100755
index 0000000..505adb4
--- /dev/null
+++ b/core/sqf/sql/scripts/cleanlogs
@@ -0,0 +1,86 @@
+#!/bin/bash
+#
+# @@@ START COPYRIGHT @@@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# @@@ END COPYRIGHT @@@
+
+# This script cleans up the log files of various components
+if [ -e $SQ_PDSH ]; then
+   L_PDSH="/usr/bin/pdsh $MY_NODES "
+else
+   L_PDSH=
+fi
+
+function usage() {
+   prog=`basename $0` 
+   echo ""
+   echo "$prog { all | dcs | rest | core }"
+   echo "    all  --- Remove files from core, dcs and rest logs folder"
+   echo "    dcs  --- Remove files from $DCS_INSTALL_DIR/logs folder"
+   echo "    rest --- Remove files from $REST_INSTALL_DIR/logs folder"
+   echo "    core --- Remove log files residing in $MY_SQROOT/logs folder"
+}
+
+function core_logs() {
+   $L_PDSH "rm -rf ${MY_SQROOT}/logs/*.err"
+   $L_PDSH "rm -rf ${MY_SQROOT}/logs/*.log"
+   $L_PDSH "rm -rf ${MY_SQROOT}/logs/*log.[0-9]*"
+}
+
+function dcs_logs() {
+   $L_PDSH "rm -rf ${DCS_INSTALL_DIR}/logs/*.log"
+   $L_PDSH "rm -rf ${DCS_INSTALL_DIR}/logs/*.log.[0-9]*"
+   $L_PDSH "rm -rf ${DCS_INSTALL_DIR}/logs/*.out"
+   $L_PDSH "rm -rf ${DCS_INSTALL_DIR}/logs/*.out.[0-9]*"
+}
+
+function rest_logs() {
+   $L_PDSH "rm -rf ${REST_INSTALL_DIR}/logs/*.log"
+   $L_PDSH "rm -rf ${REST_INSTALL_DIR}/logs/*.log.[0-9]*"
+   $L_PDSH "rm -rf ${REST_INSTALL_DIR}/logs/*.out"
+   $L_PDSH "rm -rf ${REST_INSTALL_DIR}/logs/*.out.[0-9]*"
+}
+
+function all_logs() {
+   core_logs
+   dcs_logs
+   rest_logs
+}
+
+if [ ! -z ${MY_SQROOT} ]; then
+   case "$1" in 
+      core)
+        core_logs
+        ;;
+      dcs)
+        dcs_logs
+        ;;
+      rest)
+        rest_logs
+        ;;
+      all)
+        all_logs
+        ;;
+      *)
+        usage
+        exit 1
+   esac
+fi
+exit 0

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1f0d872b/core/sqf/sql/scripts/dcscheck
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/dcscheck b/core/sqf/sql/scripts/dcscheck
index ef132e1..b227e35 100755
--- a/core/sqf/sql/scripts/dcscheck
+++ b/core/sqf/sql/scripts/dcscheck
@@ -31,6 +31,7 @@ down_dcsmaster_cnt=0
 cfg_dcsserver_cnt=0
 actual_dcsserver_cnt=0
 down_dcsserver_cnt=0
+activeMaster=`hostname`
 
 tmp_ps=`mktemp -t`
 if [[ $? != 0 ]]; then
@@ -55,6 +56,7 @@ if [[ $sq_stat == 0 ]]; then
   if [ -s ${DCS_INSTALL_DIR}/conf/backup-masters ]; then
      let backup_dcsmaster_cnt=`/bin/egrep -cv '#|^$' ${DCS_INSTALL_DIR}/conf/backup-masters`
      let cfg_dcsmaster_cnt=$backup_dcsmaster_cnt+1
+     list_of_backups=`cat ${DCS_INSTALL_DIR}/conf/backup-masters | /bin/egrep -v '^#|^$'`
    else
      let cfg_dcsmaster_cnt=1
    fi
@@ -74,6 +76,12 @@ if [[ $sq_stat == 0 ]]; then
      actual_dcsserver_cnt=`$jpscmd |grep DcsServer |wc -l`
    fi
 
+### Get the node where the active master is running
+   if [[ -e $SQ_PDSH && ! -z $ENABLE_HA ]]; then
+        gv_float_interface=`python $DCS_INSTALL_DIR/bin/scripts/parse_dcs_site.py|cut -d$'\n'
-f1`
+        activeMaster=`$SQ_PDSH $MY_NODES /sbin/ip addr show |grep $gv_float_interface$ |cut
-d':' -f1`
+   fi
+
    if ( [ "$cfg_dcsserver_cnt" '!=' "$actual_dcsserver_cnt" ] ); then
      let down_dcsserver_cnt=cfg_dcsserver_cnt-actual_dcsserver_cnt
    else
@@ -108,7 +116,10 @@ if [[ $sq_stat == 0 ]]; then
    fi
    masterport=`cat $dcstmp | /usr/bin/tail -n 1 | cut -d ":" -f4`
    if [ ! -z "$masterport" ]; then
-     echo "DcsMaster is listening on port $masterport"
+     echo "DcsMaster is listening host \"$activeMaster\" using port \"$masterport\""
+     if [[ ! -z $list_of_backups ]]; then
+        echo "Backup Masters configured to run on nodes: " $list_of_backups
+     fi
      echo
    fi
    rm -f $dcstmp $tmp_chk $tmp_ps

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1f0d872b/core/sqf/sql/scripts/dcsstop
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/dcsstop b/core/sqf/sql/scripts/dcsstop
index 70fbdfa..a102e6f 100755
--- a/core/sqf/sql/scripts/dcsstop
+++ b/core/sqf/sql/scripts/dcsstop
@@ -34,6 +34,10 @@ if [ ! -e ${DCS_STOP_CMD} ]; then
    exit 1;
 fi
 
+if [[ ! -z $ENABLE_HA ]]; then
+   ${DCS_INSTALL_DIR}/bin/scripts/dcsunbind.sh
+fi
+
 echo "Shutting down the DCS environment now"
 cd ${DCS_INSTALL_DIR}
 ${DCS_STOP_CMD}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1f0d872b/core/sqf/sql/scripts/sqcheck
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/sqcheck b/core/sqf/sql/scripts/sqcheck
index 19d2c80..914ea0e 100755
--- a/core/sqf/sql/scripts/sqcheck
+++ b/core/sqf/sql/scripts/sqcheck
@@ -106,6 +106,49 @@ function fillArray {
     done
 }
 
+function getDcsInfo {
+ dcsznode=/$USER/dcs/master
+ jpscmd=$JAVA_HOME/bin/jps
+
+ if [ -d $DCS_INSTALL_DIR ];then
+
+### Get the configured number of DcsMaster's
+  if [ -s ${DCS_INSTALL_DIR}/conf/backup-masters ]; then
+     let backup_dcsmaster_cnt=`/bin/egrep -cv '#|^$' ${DCS_INSTALL_DIR}/conf/backup-masters`
+     let cfg_dcsmaster_cnt=$backup_dcsmaster_cnt+1
+   else
+     let cfg_dcsmaster_cnt=1
+   fi
+
+### Get the configured number of DcsServer and mxosrvr
+   if [ -f ${DCS_INSTALL_DIR}/conf/servers ]; then
+      let cfg_mxo_cnt=`cat $DCS_INSTALL_DIR/conf/servers|awk '{if ($2=="") k=1;else k=$2;cnt+=k}
END {print cnt}'`
+      let cfg_dcsserver_cnt=`cat $DCS_INSTALL_DIR/conf/servers|awk '{if ($2=="") p=1;else
p+=1;} END {print p}'`
+   fi
+
+### Check if there are any DcsMaster and DcsServer's that are started 
+   if [ -e $SQ_PDSH ]; then
+     actual_dcsmaster_cnt=`$SQ_PDSH $MY_NODES $jpscmd |grep DcsMaster |wc -l` 
+     actual_dcsserver_cnt=`$SQ_PDSH $MY_NODES $jpscmd |grep DcsServer |wc -l` 
+   else
+     actual_dcsmaster_cnt=`$jpscmd |grep DcsMaster |wc -l`
+     actual_dcsserver_cnt=`$jpscmd |grep DcsServer |wc -l`
+   fi
+
+   if ( [ "$cfg_dcsserver_cnt" '!=' "$actual_dcsserver_cnt" ] ); then
+     let down_dcsserver_cnt=cfg_dcsserver_cnt-actual_dcsserver_cnt
+   else
+     down_dcsserver_cnt=''
+   fi
+
+   if ( [ "$cfg_dcsmaster_cnt" '!=' "$actual_dcsmaster_cnt" ] ); then
+     let down_dcsmaster_cnt=cfg_dcsmaster_cnt-actual_dcsmaster_cnt
+   else
+     down_dcsmaster_cnt=''
+   fi
+ fi
+}
+
 begin_time_seconds=$(date +%s)
 
 declare -i max_checks
@@ -307,6 +350,7 @@ fi
   fi
 
   #MXOSRVR
+  getDcsInfo
   let act_mxo_cnt=`< $sq_tmp_ps egrep -a -i ' mxosrvr' | wc -l`
   if ( [ "$cfg_mxo_cnt" '!=' "$act_mxo_cnt" ] ); then 
     let act_mxo_down_cnt=cfg_mxo_cnt-act_mxo_cnt
@@ -478,13 +522,17 @@ else
     if [[ $sqck_component == "all" ]]; then
         echo -e "DTM\t\t$cfg_dtm_cnt\t\t$act_dtm_cnt\t    ${down_dtms[*]}"
         echo -e "RMS\t\t$cfg_rms_cnt\t\t$act_rms_cnt\t    ${down_rms[*]}"
+        echo -e "DcsMaster\t$cfg_dcsmaster_cnt\t\t$actual_dcsmaster_cnt\t    $down_dcsmaster_cnt"
+        echo -e "DcsServer\t$cfg_dcsserver_cnt\t\t$actual_dcsserver_cnt\t    $down_dcsserver_cnt"
         echo -e "MXOSRVR\t\t$cfg_mxo_cnt\t\t$act_mxo_cnt\t    ${act_mxo_down_cnt}\n"
     elif [[ $sqck_component == "dtm" ]]; then
         echo -e "DTM\t\t$cfg_dtm_cnt\t\t$act_dtm_cnt\t    ${down_dtms[*]}\n"
     elif [[ $sqck_component == "rms" ]]; then
         echo -e "RMS\t\t$cfg_rms_cnt\t\t$act_rms_cnt\t    ${down_rms[*]}\n"
     elif [[ $sqck_component == "dcs" ]]; then
-        echo -e "MXOSRVR\t\t$cfg_mxo_cnt\t\t$act_mxo_cnt\t    ${act_mxo_down_cnt}\n"
+        echo -e "DcsMaster\t$cfg_dcsmaster_cnt\t\t$actual_dcsmaster_cnt\t    $down_dcsmaster_cnt"
+        echo -e "DcsServer\t$cfg_dcsserver_cnt\t\t$actual_dcsserver_cnt\t    $down_dcsserver_cnt"
+echo - e "MXOSRVR\t\t$cfg_mxo_cnt\t\t$act_mxo_cnt\t    ${act_mxo_down_cnt}\n"
     fi
 fi
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1f0d872b/dcs/bin/scripts/dcsbind.sh
----------------------------------------------------------------------
diff --git a/dcs/bin/scripts/dcsbind.sh b/dcs/bin/scripts/dcsbind.sh
index ee928b1..d33decc 100755
--- a/dcs/bin/scripts/dcsbind.sh
+++ b/dcs/bin/scripts/dcsbind.sh
@@ -90,6 +90,7 @@ if  [ -z $gv_float_external_ip ] ; then
    exit $gv_ok
 fi
 
+
 }
 
 function check_node {
@@ -229,12 +230,104 @@ fi
 
 }
 
+function configure_route_tables {
+    gv_default_interface=eth0
+    bcast=`/sbin/ip addr show $gv_default_interface | grep "inet .*$gv_default_interface\$"
| awk '{print $4}'`
+    status=$?
+    if [ $status -ne 0 ]; then
+       dcsEcho "Failed to get the broadcast address for $gv_default_interface - status is
$status"
+       exit $gv_error
+    fi
+    dcsEcho "broadcast address to use $bcast"
+
+    mask=`/sbin/ip addr show $gv_default_interface | grep "inet .*$gv_default_interface\$"
| awk '{print $2}' | cut -d'/' -f2`
+    status=$?
+    if [ $status -ne 0 ]; then
+       dcsEcho "Failed to get the mask for $gv_default_interface - status is $status"
+       exit $gv_error
+    fi
+    dcsEcho "mask to use $mask"
+
+    dcsEcho "Associating the internal ip address to the interface"
+    sudo /sbin/ip addr add $gv_float_internal_ip/$mask broadcast $bcast dev $gv_float_external_interface
+    status=$?
+    if [[ $status -ne 0 && $status -ne 2 ]]; then
+       dcsEcho "Failed to associate the floating ip to the interface - status is $status"
+       exit $gv_error
+    fi
+
+    dcsEcho "Bringing the interface up"
+    sudo /sbin/ip link set $gv_float_external_interface up
+    status=$?
+    if [[ $status -ne 0 && $status -ne 2 ]]; then
+       dcsEcho "Failed to bring interface up - status is $status"
+       exit $gv_error
+    fi
+
+    dcsEcho "Adding gateway address to the interface"
+    GATEWAY_IP=`netstat -rn |grep "^0.0.0.0"|awk '{print $2}'`
+    sudo /sbin/ip route add default via $GATEWAY_IP dev $gv_float_external_interface tab
2
+    status=$?
+    if [[ $status -ne 0 && $status -ne 2 ]]; then
+       dcsEcho "Failed to add the gateway address to the interface - status is $status"
+       exit $gv_error
+    fi
+
+
+    dcsEcho "Deleting and Adding from rule for the internal ip to the rules table"
+    sudo /sbin/ip rule del from $gv_float_internal_ip/32 tab 2
+    status=$?
+    if [[ $status -ne 0 && $status -ne 2 ]]; then
+       dcsEcho "Failed to delete from rule in the rules table - status is $status"
+       exit $gv_error
+    fi
+
+    sudo /sbin/ip rule add from $gv_float_internal_ip/32 tab 2
+    status=$?
+    if [[ $status -ne 0 && $status -ne 2 ]]; then
+dcsEcho "Failed to add the from rule to the rules table - status is $status"
+       exit $gv_error
+    fi
+
+    dcsEcho "Deleting and Adding to rule for the internal ip to the rules table"
+    sudo /sbin/ip rule del to $gv_float_internal_ip/32 tab 2
+    status=$?
+    if [[ $status -ne 0 && $status -ne 2 ]]; then
+       dcsEcho "Failed to delete the to rule in the rules table - status is $status"
+       exit $gv_error
+    fi
+
+    sudo /sbin/ip rule add to $gv_float_internal_ip/32 tab 2
+    status=$?
+    if [[ $status -ne 0 && $status -ne 2 ]]; then
+       dcsEcho "Failed to add the to rule to the rules table - status is $status"
+       exit $gv_error
+    fi
+
+    dcsEcho "Flushing the route cache"
+    sudo /sbin/ip route flush cache
+    status=$?
+    if [ $status -ne 0 ]; then
+       dcsEcho "Failed to flush the cache - status is $status"
+       exit $gv_error
+    fi
+
+    dcsEcho "Probing the network"
+    sudo /sbin/arping -U -w 3 -c 3 -I $gv_float_external_interface $gv_float_external_ip
+    status=$?
+    if [ $status -ne 0 ]; then
+       dcsEcho "Failed to send packets across the network - status is $status"
+       exit $gv_error
+    fi
+}
+
 #########################################################
 # MAIN portion of dcsbind begins here
 #########################################################
 
 gv_float_external_interface=""
 gv_float_external_ip=""
+gv_float_internal_ip=""
 gv_port=0
 
 gv_ok=0
@@ -250,11 +343,44 @@ GetOpts $1 $2 $3 $4 $5 $6 $7 $8 $9
 
 dcsEcho "dcsbind invoked with parameters -i $gv_float_external_interface -a $gv_float_external_ip
-p $gv_port"
 
-
 ValidateParams
 CheckSudo
 GetFloatingIpAdrress
-Check_VirtualIP_InUse_Unbind
-BindFloatIp
+
+gv_float_internal_ip=`echo $gv_float_external_ip`
+
+dcsEcho "gv_float_external_ip :" $gv_float_external_ip
+dcsEcho "gv_float_internal_ip :" $gv_float_internal_ip
+
+#Check if AWS_CLOUD environment variable defined
+if [[ -z $AWS_CLOUD ]]; then
+    Check_VirtualIP_InUse_Unbind
+    BindFloatIp
+else
+    device_index_to_use=`echo $gv_float_external_interface | sed -e "s@eth\([0-9][0-9]*\)@\1@"`
+    dcsEcho "Using device index $device_index_to_use for $gv_float_external_interface"
+
+    # Get instance Id of the instance
+    INSTANCEID=`aws ec2 describe-instances |grep -i instances |grep -i $gv_myhostname |cut
-f8`
+    dcsEcho "Using Instance id $INSTANCEID"
+
+    # Get the network interface configured for the vpc
+    NETWORKINTERFACE=`aws ec2 describe-network-interfaces| grep -i networkinterfaces| grep
-i $gv_float_internal_ip|cut -f5`
+    dcsEcho "Using network interface $NETWORKINTERFACE"
+
+    # Get the attachment id for the network interface
+    ATTACH_ID=`aws ec2 describe-network-interfaces --network-interface-ids $NETWORKINTERFACE
|grep -i attachment |cut -f3`
+    if [ ! -z "$ATTACH_ID" ]; then
+        dcsEcho "Detaching attachment Id:" $ATTACH_ID
+        aws ec2 detach-network-interface --attachment-id $ATTACH_ID
+    fi
+
+    dcsEcho "Going to attach network interface $NETWORKINTERFACE to the another instance"
+    sleep 10
+    NEWATTACH_ID=`aws ec2 attach-network-interface --network-interface-id $NETWORKINTERFACE
--instance-id $INSTANCEID --device-index $device_index_to_use`
+    dcsEcho "New attachment Id " $NEWATTACH_ID
+    sleep 10
+    configure_route_tables
+fi
 
 exit $gv_ok

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1f0d872b/dcs/bin/scripts/dcsunbind.sh
----------------------------------------------------------------------
diff --git a/dcs/bin/scripts/dcsunbind.sh b/dcs/bin/scripts/dcsunbind.sh
new file mode 100755
index 0000000..0794c1b
--- /dev/null
+++ b/dcs/bin/scripts/dcsunbind.sh
@@ -0,0 +1,93 @@
+#!/bin/bash
+#
+# @@@ START COPYRIGHT @@@
+#
+#Licensed to the Apache Software Foundation (ASF) under one
+#or more contributor license agreements.  See the NOTICE file
+#distributed with this work for additional information
+#regarding copyright ownership.  The ASF licenses this file
+#to you under the Apache License, Version 2.0 (the
+#"License"); you may not use this file except in compliance
+#with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing,
+#software distributed under the License is distributed on an
+#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#KIND, either express or implied.  See the License for the
+#specific language governing permissions and limitations
+#under the License.
+#
+# @@@ END COPYRIGHT @@@
+#
+#
+
+function check_node {
+    for myinterface in `$SQ_PDSH -N -w $1 /sbin/ip link show|awk -F': ' '/^[0-9]+:.*/ {print
$2;}'`; do
+	ip_output=$($SQ_PDSH -N -w $1 /sbin/ip addr show $myinterface)
+	if [ $gv_externalip_set -eq 1 -a $external_only -eq 1 ]; then
+            myifport=`echo "$ip_output" | grep $gv_float_external_ip`
+	    status=$?
+	    if [ $status -eq 0 ]; then
+	       tempinterface=`echo $gv_float_external_interface:$gv_port`
+	       # check if another interface is bound to this virtual ip address
+	       echo "$myifport" | grep "$tempinterface"  > /dev/null
+	       if [ $? -eq 1 -o "$1" != "$gv_myhostname" ]; then
+                   unbindip = `echo "$myifport" | awk '{print $2}' `
+		   unbindlb=`echo "$myifport"|awk '{print $NF}'`
+		   echo "External ip $gv_float_external_ip is already in use on node $1 bound to interface
$myinterface($unbindlb) - unbind..."
+		   $SQ_PDSH -S -w $1 sudo /sbin/ip addr del $unbindip dev $myinterface label $unbindlb
+                   status=$?
+		   if [ $status -ne 0 ]; then
+		      echo "Failed to unbind - status is $status"
+		      exit -1 
+                   else
+                      echo "Unbind successful"
+                   fi
+	       else
+	           echo "External ip $gv_float_external_ip is already bound to $myinterface on node
$1 - skip unbind"
+	       fi # endif node+name match
+	    fi # endif looking for external ip
+        fi #endif checking external ip is set or not
+    done
+}
+
+function Check_VirtualIP_InUse_And_Unbind {
+    echo "check all nodes to see if external virtual ip address is in use and unbind if necessary"
+    mynode=""
+    externalNodes=`$SQ_PDSH $MY_NODES /sbin/ip addr show | grep $gv_float_external_ip | awk
-F' ' '/^.+:[[:space:]]+.*/ {print $1;}' | cut -d':' -f1 | sed '/^$/d'`
+    if [ ! -z "$externalNodes" ]; then
+	external_only=1
+	internal_only=0
+	for mynode in $externalNodes; do
+	   check_node $mynode
+	done
+    fi
+}
+
+#Main program
+
+gv_float_internal_ip=`python $DCS_INSTALL_DIR/bin/scripts/parse_dcs_site.py|cut -d$'\n' -f2`
+gv_float_external_ip=`python $DCS_INSTALL_DIR/bin/scripts/parse_dcs_site.py|cut -d$'\n' -f2`
+gv_float_interface=`python $HOME/ah/parse_dcs_site.py|cut -d$'\n' -f1`
+gv_port=0
+gv_externalip_set=1
+gv_internalip_set=1
+
+if [[ ! -z $AWS_CLOUD ]]; then
+   #Get the network interface
+   NETWORKINTERFACE=`aws ec2 describe-network-interfaces| grep -i networkinterfaces| grep
-i $gv_float_internal_ip|cut -f5`
+
+   # Get the attachment id for the network interface
+   ATTACH_ID=`aws ec2 describe-network-interfaces --network-interface-ids $NETWORKINTERFACE
|grep -i attachment |cut -f3`
+
+   echo "Detaching attachment Id:" $ATTACH_ID
+   if [ ! -z "$ATTACH_ID" ]; then
+      aws ec2 detach-network-interface --attachment-id $ATTACH_ID
+      echo "Detached interface :" $NETWORKINTERFACE
+   fi
+else
+   Check_VirtualIP_InUse_And_Unbind
+fi
+exit 0

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1f0d872b/dcs/bin/scripts/parse_dcs_site.py
----------------------------------------------------------------------
diff --git a/dcs/bin/scripts/parse_dcs_site.py b/dcs/bin/scripts/parse_dcs_site.py
new file mode 100755
index 0000000..afe3d91
--- /dev/null
+++ b/dcs/bin/scripts/parse_dcs_site.py
@@ -0,0 +1,39 @@
+#
+# @@@ START COPYRIGHT @@@
+#
+#Licensed to the Apache Software Foundation (ASF) under one
+#or more contributor license agreements.  See the NOTICE file
+#distributed with this work for additional information
+#regarding copyright ownership.  The ASF licenses this file
+#to you under the Apache License, Version 2.0 (the
+#"License"); you may not use this file except in compliance
+#with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing,
+#software distributed under the License is distributed on an
+#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#KIND, either express or implied.  See the License for the
+#specific language governing permissions and limitations
+#under the License.
+#
+# @@@ END COPYRIGHT @@@
+#
+#
+import os
+from xml.dom import minidom
+
+name = os.environ.get('DCS_INSTALL_DIR')
+doc = minidom.parse(name+"/conf/dcs-site.xml")
+props = doc.getElementsByTagName("property")
+for prop in props:
+        pname = prop.getElementsByTagName("name")[0]
+        if (pname.firstChild.data == "dcs.master.floating.ip.external.ip.address"):
+           pvalue = prop.getElementsByTagName("value")[0]
+           float_ipaddress=pvalue.firstChild.data
+           print("%s" % (float_ipaddress))
+        if (pname.firstChild.data == "dcs.master.floating.ip.external.interface"):
+           pvalue = prop.getElementsByTagName("value")[0]
+           float_interface=pvalue.firstChild.data
+           print("%s" % (float_interface))

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1f0d872b/install/installer/setup_ssh_key
----------------------------------------------------------------------
diff --git a/install/installer/setup_ssh_key b/install/installer/setup_ssh_key
new file mode 100755
index 0000000..cd8d443
--- /dev/null
+++ b/install/installer/setup_ssh_key
@@ -0,0 +1,27 @@
+#!/bin/bash
+# @@@ START COPYRIGHT @@@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# @@@ END COPYRIGHT @@@
+
+echo -e 'y\n' | ssh-keygen -t rsa -N "" -f $HOME/.ssh/id_rsa
+cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
+echo localhost $(cat /etc/ssh/ssh_host_rsa_key.pub) >> $HOME/.ssh/known_hosts
+echo "NoHostAuthenticationForLocalhost=yes" >> $HOME/.ssh/config
+chmod 600 $HOME/.ssh/config


Mime
View raw message