You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by ar...@apache.org on 2015/12/15 19:50:54 UTC

[3/8] incubator-trafodion git commit: [[TRAFODION 1689]] and [[TRAFODION 1690]]

[[TRAFODION 1689]] and [[TRAFODION 1690]]

Fixes for DCS HA and DCS_DIR bug


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

Branch: refs/heads/master
Commit: eab5e35bf7e01885563f3487205184269d0a8e84
Parents: ec5e643
Author: Amanda Moran <am...@apache.com>
Authored: Wed Dec 9 23:04:58 2015 +0000
Committer: Amanda Moran <am...@apache.com>
Committed: Wed Dec 9 23:04:58 2015 +0000

----------------------------------------------------------------------
 install/installer/dcs_installer            | 53 ++++++++++++++-
 install/installer/traf_add_sudoAccess      | 54 +++++++++++++++
 install/installer/traf_config_setup        | 87 ++++++++++++++++++++++++-
 install/installer/trafodion_config_default |  9 +++
 4 files changed, 200 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eab5e35b/install/installer/dcs_installer
----------------------------------------------------------------------
diff --git a/install/installer/dcs_installer b/install/installer/dcs_installer
index 902b314..aea2b7b 100755
--- a/install/installer/dcs_installer
+++ b/install/installer/dcs_installer
@@ -25,6 +25,16 @@
 #  Install DCS on a Trafodion cluster
 #==========================================
 
+export TRAF_CONFIG="/etc/trafodion/trafodion_config"
+
+if [ $node_count -eq 1 ]; then
+    TRAF_PDSH=""
+    TRAF_PDCP=""
+else
+    TRAF_PDSH="pdsh -R exec $MY_NODES $PDSH_SSH_CMD"
+    TRAF_PDCP="pdcp -R ssh $MY_NODES"
+fi
+
 function print_usage {
 cat << EOF
 This script will install/configure the specified DCS build.
@@ -136,8 +146,7 @@ echo "***INFO: untarring build file $DCS_BUILD_FILE"
 tar -xzf $DCS_BUILD_FILE
 
 # get the dcs install directory name which is imbedded in the tar file
-DCS_DIR=$(tar -tf $DCS_BUILD_FILE | grep --max-count=1 bin | sed -e "s@\(^.*\)/bin/@\1@")
-
+DCS_DIR=$(tar -tf $DCS_BUILD_FILE | grep LICENSE | sed -e "s@\(^.*\)/LICENSE.txt@\1@")
 DCS_DIR=$DCS_INSTALL_PATH/$DCS_DIR
 
 # set env var in sqenvcom.sh for DCS install directory
@@ -181,6 +190,36 @@ cat dcs-site.xml | sed -e "s@</configuration>@  <property>\n    <name>dcs.dns.in
 cp dcs-site.temp dcs-site.xml
 rm dcs-site.temp 2>/dev/null
 
+if [[ "$ENABLE_HA" == "true" ]]; then
+   rm dcs-site.temp 2>/dev/null
+   cat dcs-site.xml | sed -e "s@</configuration>@  <property>\n    <name>dcs.master.floating.ip</name>\n    <value>true</value>\n  </property>\n</configuration>@" > dcs-site.temp
+   cp dcs-site.temp dcs-site.xml
+   rm dcs-site.temp 2>/dev/null
+
+   rm dcs-site.temp 2>/dev/null
+   cat dcs-site.xml | sed -e "s@</configuration>@  <property>\n    <name>dcs.master.floating.ip.external.interface</name>\n    <value>$INTERFACE</value>\n  </property>\n</configuration>@" > dcs-site.temp
+   cp dcs-site.temp dcs-site.xml
+   rm dcs-site.temp 2>/dev/null
+
+   rm dcs-site.temp 2>/dev/null
+   cat dcs-site.xml | sed -e "s@</configuration>@  <property>\n    <name>dcs.master.floating.ip.external.ip.address</name>\n    <value>$FLOATING_IP</value>\n  </property>\n</configuration>@" > dcs-site.temp
+   cp dcs-site.temp dcs-site.xml
+   rm dcs-site.temp 2>/dev/null
+fi
+
+if [[ "$ENABLE_HA" == "true" ]]; then
+   echo "***INFO: modifying $DCS_DIR/conf/backup-masters file"
+   
+   for node in $BACKUP_DCS_NODES
+   do
+       echo $node >> $DCS_DIR/conf/backup-masters
+   done
+   
+   if [[ $node_count -gt 1 ]]; then
+      $TRAF_PDCP $DCS_DIR/conf/backup-masters $DCS_DIR/conf/backup-masters
+   fi
+fi
+
 
 echo "***INFO: creating $DCS_DIR/conf/servers file"
 rm servers 2>/dev/null
@@ -198,5 +237,15 @@ do
     (( count++ ))
 done
 
+if [[ "$ENABLE_HA" == "true" ]]; then
+   newHName="HNAME=$FLOATING_IP:23400"
+   sed -i -e "s/HNAME=localhost:23400/$newHName/g" $SQ_ROOT/trafci/bin/trafci
+
+   if [[ $node_count -gt 1 ]]; then
+      $TRAF_PDCP $SQ_ROOT/trafci/bin/trafci $SQ_ROOT/trafci/bin/trafci
+   fi
+fi
+
+
 echo "***INFO: End of DCS install."
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eab5e35b/install/installer/traf_add_sudoAccess
----------------------------------------------------------------------
diff --git a/install/installer/traf_add_sudoAccess b/install/installer/traf_add_sudoAccess
new file mode 100755
index 0000000..eda398b
--- /dev/null
+++ b/install/installer/traf_add_sudoAccess
@@ -0,0 +1,54 @@
+#!/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 @@@
+
+TRAF_CONFIG=/etc/trafodion/trafodion_config
+source $TRAF_CONFIG
+
+if [ $node_count -eq 1 ]; then
+    TRAF_PDSH=""
+    TRAF_PDCP=""
+else
+    TRAF_PDSH="pdsh -R exec $MY_NODES $PDSH_SSH_CMD"
+    TRAF_PDCP="pdcp -R ssh $MY_NODES"
+fi
+
+
+sudoFile="trafodion"
+echo "***INFO: Creating $TRAF_USER sudo access file"
+echo
+
+echo "## Trafodion Floating IP commands" > $sudoFile
+echo "Cmnd_Alias IP = /sbin/ip" >>  $sudoFile
+echo "Cmnd_Alias ARP = /sbin/arping" >> $sudoFile
+ 
+echo "## Allow Trafodion id to run commands needed to configure floating IP" >> $sudoFile
+echo "%trafodion ALL = NOPASSWD: IP, ARP" >> $sudoFile
+
+
+if [[ $node_count -gt "1" ]]; then
+   $TRAF_PDCP $sudoFile $HOME
+   $TRAF_PDSH sudo cp $HOME/$sudoFile /etc/sudoers.d/
+   $TRAF_PDSH sudo rm -f $HOME/$sudoFile
+else 
+   sudo cp $TRAF_USR /etc/sudoers.d
+fi
+ 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eab5e35b/install/installer/traf_config_setup
----------------------------------------------------------------------
diff --git a/install/installer/traf_config_setup b/install/installer/traf_config_setup
index 6dd7dfe..23ded39 100755
--- a/install/installer/traf_config_setup
+++ b/install/installer/traf_config_setup
@@ -58,6 +58,9 @@ INIT_TRAFODION="N"
 START="N"
 SQCONFIG=""
 DCS_SERVERS_PARM="2"
+ENABLE_HA="false"
+FLOATING_IP=""
+BACKUP_DCS_NODES=""
 LDAP_SECURITY="N"
 SCANNER_MODE="N"
 
@@ -257,6 +260,7 @@ package=$(tar -tzf $TRAF_PACKAGE | grep build-version.txt | wc -l )
 if [ $package -eq 0 ]; then
    
    # assume user specified a trafodion core tar file
+   UTT_INSTALL="Y"
    TRAF_BUILD=$TRAF_PACKAGE
    TRAF_PACKAGE=""
    
@@ -307,6 +311,7 @@ if [ $package -eq 0 ]; then
    
 else
    # user specifed a package file
+   UTT_INSTALL="N"
    TRAF_BUILD=""
    DCS_BUILD=""
    REST_BUILD=""
@@ -317,6 +322,7 @@ echo "export TRAF_PACKAGE=\"$TRAF_PACKAGE\"" >> $LOCAL_TRAF_CONFIG
 echo "export TRAF_BUILD=\"$TRAF_BUILD\"" >> $LOCAL_TRAF_CONFIG
 echo "export DCS_BUILD=\"$DCS_BUILD\"" >> $LOCAL_TRAF_CONFIG
 echo "export REST_BUILD=\"$REST_BUILD\"" >> $LOCAL_TRAF_CONFIG
+echo "export UTT_INSTALL=\"$UTT_INSTALL\"" >> $LOCAL_TRAF_CONFIG
 
 #==============================================
 #Hadoop user name
@@ -456,7 +462,7 @@ fi
 #DCS Servers
 
 DCS_SERVERS_PARM=$(($node_count * 8))
-echo -n "Total number of client connections per node, default [$DCS_SERVERS_PARM]: "
+echo -n "Total number of client connections per cluster, default [$DCS_SERVERS_PARM]: "
 read answer
 
 if [ ! -z $answer ]; then
@@ -466,6 +472,85 @@ fi
 echo "export DCS_SERVERS_PARM=\"$DCS_SERVERS_PARM\"" >> $LOCAL_TRAF_CONFIG
 
 #==============================================
+#Enable HA
+
+echo -n "Enable High Avalability (Y/N), default is N: "
+read answer
+
+if [[ ! -z $answer ]]; then
+   if [[ "${answer}" =~ ^[Yy]$ ]]; then
+      ENABLE_HA="true"
+   else
+      ENABLE_HA="false"
+   fi
+else
+   ENABLE_HA="false"
+fi
+
+echo "export ENABLE_HA=\"$ENABLE_HA\"" >> $LOCAL_TRAF_CONFIG
+
+#==============================================
+#Add Floating IP if HA Enabled
+if [[ "$ENABLE_HA" == "true" ]]; then
+   echo -n "Enter Floating IP address for DCS HA, default [$FLOATING_IP]: "
+   read answer
+
+   if [ -z $answer ]; then
+      if [[ -z $FLOATING_IP ]]; then
+         echo "***ERROR: Floating IP address not given." 
+         echo "***ERROR: Install will contiune but WITHOUT High Avalability"
+         echo "***ERROR: HA can be configured later, or kill this script and start over."
+         sed -i '/ENABLE_HA\=/d' $LOCAL_TRAF_CONFIG
+         echo "export ENABLE_HA=\"false\"" >> $LOCAL_TRAF_CONFIG     
+      fi      
+   else
+      FLOATING_IP="$answer"
+   fi
+   echo "export FLOATING_IP=\"$FLOATING_IP\"" >> $LOCAL_TRAF_CONFIG
+fi
+
+
+#==============================================
+#Add Floating IP if HA Enabled
+if [[ "$ENABLE_HA" == "true" ]]; then
+   echo -n "Enter interface for Floating IP address (example: eth0), default [$INTERFACE]: "
+   read answer
+
+   if [ -z $answer ]; then
+      if [[ -z $INTERFACE ]]; then
+         echo "***ERROR: Floating IP interface was not given."
+         echo "***ERROR: Install will contiune but WITHOUT High Avalability"
+         echo "***ERROR: HA can be configured later, or kill this script and start over."
+         sed -i '/ENABLE_HA\=/d' $LOCAL_TRAF_CONFIG
+         echo "export ENABLE_HA=\"false\"" >> $LOCAL_TRAF_CONFIG
+      fi
+   else
+      INTERFACE="$answer"
+   fi
+   echo "export INTERFACE=\"$INTERFACE\"" >> $LOCAL_TRAF_CONFIG
+fi
+
+#==============================================
+#Add Backup DCS Master nodes if HA Enabled
+if [[ "$ENABLE_HA" == "true" ]]; then
+   echo -n "Enter DCS Backup Master Nodes for DCS HA, default [$BACKUP_DCS_NODES]: "
+   read answer 
+  
+   if [[ -z "$answer" ]]; then 
+      if [[ -z "$BACKUP_DCS_NODES" ]]; then
+         echo "***ERROR: Backup DCS Nodes not given."
+         echo "***ERROR: Install will contiune but WITHOUT High Avalability"
+         echo "***ERROR: HA can be configured later, or kill this script and start over."
+         sed -i '/ENABLE_HA\=/d' $LOCAL_TRAF_CONFIG
+         echo "export ENABLE_HA=\"false\"" >> $LOCAL_TRAF_CONFIG 
+      fi
+   else
+      BACKUP_DCS_NODES="$answer"
+   fi
+   echo "export BACKUP_DCS_NODES=\"$BACKUP_DCS_NODES\"" >> $LOCAL_TRAF_CONFIG
+fi 
+
+#==============================================
 #Simple security
 if [[ $SCANNER_MODE == "N" ]]; then
    echo -n "Enable simple LDAP security (Y/N), default is N: "

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eab5e35b/install/installer/trafodion_config_default
----------------------------------------------------------------------
diff --git a/install/installer/trafodion_config_default b/install/installer/trafodion_config_default
index 26495f1..d5554bb 100755
--- a/install/installer/trafodion_config_default
+++ b/install/installer/trafodion_config_default
@@ -143,3 +143,12 @@ export LDAP_SECURITY="N"
 #Name of LDAP Config file
 export LDAP_AUTH_FILE="traf_authentication_config_${HOSTNAME}"
 
+#HA configuraton enabled, if want to enable set to true and add valid floating IP address.
+export ENABLE_HA="false"
+
+#Floating IP address for HA configuration only if ENABLE_HA is set to true
+export FLOATING_IP=""
+
+#If HA enabled the set the DCS Backup nodes
+export BACKUP_DCS_NODES=""
+