[TRAFODION 2001] Need to revert to old version of elasticity for installer
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/b349f404 Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/b349f404 Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/b349f404 Branch: refs/heads/master Commit: b349f4046dd64d7f349057a2916b18e036e46a3c Parents: 8a8c67a Author: Amanda Moran <ama...@apache.com> Authored: Wed Oct 19 22:20:05 2016 +0000 Committer: Amanda Moran <ama...@apache.com> Committed: Wed Oct 19 22:20:05 2016 +0000 ---------------------------------------------------------------------- install/installer/addNode_step1 | 89 ++++++++++++- install/installer/addNode_step2 | 119 +++++++++-------- install/installer/deleteNode | 244 ----------------------------------- 3 files changed, 143 insertions(+), 309 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b349f404/install/installer/addNode_step1 ---------------------------------------------------------------------- diff --git a/install/installer/addNode_step1 b/install/installer/addNode_step1 index 58fe80d..ce3ee52 100755 --- a/install/installer/addNode_step1 +++ b/install/installer/addNode_step1 @@ -54,7 +54,7 @@ if [[ $ENALBE_HA == "true" ]]; then NEW_BACKUP_DCS_NODES="$answer" for node in $NEW_BACKUP_DCS_NODES do - BACKUP_DCS_NODES="$BACKUP_DCS_NODES $node" + BACKUP_DCS_NODES="$BACKUP_DCS_NODES $node" done sudo chmod 777 $TRAF_CONFIG sed -i '/\<NEW_BACKUP_DCS_NODES\>/d' $TRAF_CONFIG @@ -62,13 +62,14 @@ if [[ $ENALBE_HA == "true" ]]; then sudo chmod 777 $TRAF_CONFIG sed -i '/\<BACKUP_DCS_NODES\>/d' $TRAF_CONFIG echo "export BACKUP_DCS_NODES=\"$BACKUP_DCS_NODES\"" >> $TRAF_CONFIG - sudo chmod 777 $TRAF_CONFIG + sudo chmod 777 $TRAF_CONFIG fi fi } + function addNewNodesConfig { source $TRAF_CONFIG @@ -85,7 +86,7 @@ do exit -1 fi NEW_NODES="$NEW_NODES $newNode" - + done for node in $NEW_NODES @@ -93,6 +94,7 @@ do MY_NEW_NODES="$MY_NEW_NODES -w $node" done + echo $MY_NEW_NODES export PDSH_SSH_CMD="ssh -q -n %h" @@ -200,6 +202,84 @@ sudo chmod 777 $TRAF_CONFIG } +function removeNodeExclude { + +source $TRAF_CONFIG +temp="" + +for node in $TRAF_EXCLUDE_LIST +do + if [[ ! $NODES =~ .*$node.* ]]; then + temp="$temp $node" + fi + +done +excludeCount=$(echo $TRAF_EXCLUDE_LIST | wc -w) +tempCount=$(echo $temp | wc -w) + + +if [[ "$excludeCount" -eq "$tempCount" ]]; then +#New node name + changeNodeName + NAME_CHANGE="true" + sudo chmod 777 $TRAF_CONFIG + sed -i '/NAME_CHANGE\=/d' $TRAF_CONFIG + echo "export NAME_CHANGE=\"$NAME_CHANGE\"" >> $TRAF_CONFIG + sudo chmod 777 $TRAF_CONFIG +else + TRAF_EXCLUDE_LIST=$temp + sudo chmod 777 $TRAF_CONFIG + sed -i '/TRAF_EXCLUDE_LIST\=/d' $TRAF_CONFIG + echo "export TRAF_EXCLUDE_LIST=\"$TRAF_EXCLUDE_LIST\"" >> $TRAF_CONFIG + sudo chmod 777 $TRAF_CONFIG +fi + +} + +function changeNodeName { + +source $TRAF_CONFIG + +for node in $NODES +do + + export oldNODENAME=$(echo $TRAF_EXCLUDE_LIST | head -n1 | awk '{print $1;}') + temp="" + + for nodes in $TRAF_EXCLUDE_LIST + do + if [[ "$oldNODENAME" != $nodes ]]; then + temp="$temp $nodes" + fi + done + export TRAF_EXCLUDE_LIST=$temp + + oldToNew="$oldNODENAME $node" + echo + echo "********************************************************************" + echo "***VERY IMPORTANT: User must change old user name to a new user name." + echo "***VERY IMPORTANT: open another session and sudo su trafodion" + echo "***VERY IMPORTANT: sqshell -a" + echo "***VERY IMPORTANT: node name $oldToNew" + sleep 5 + echo -n "***VERY IMPORTANT: Press any key when complete." + read answer + echo + echo "********************************************************************" + + sudo sed -i -e "s/\<$oldNODENAME\>/$node/g" $SQ_ROOT/tmp/cluster.conf + sudo sed -i -e "s/\<$oldNODENAME\>/$node/g" $SQ_ROOT/sql/scripts/sqconfig + sudo rm -rf $SQ_ROOT/tmp/se* + sudo rm -rf $SQ_ROOT/sql/scripts/se* + sudo chmod 777 $TRAF_CONFIG + sed -i '/TRAF_EXCLUDE_LIST\=/d' $TRAF_CONFIG + echo "export TRAF_EXCLUDE_LIST=\"$TRAF_EXCLUDE_LIST\"" >> $TRAF_CONFIG + sudo chmod 777 $TRAF_CONFIG + +done + +} + function createConfigDir { $TRAF_NEW_PDSH sudo mkdir -p /etc/trafodion @@ -244,10 +324,10 @@ $TRAF_NEW_PDSH rm -rf trafodion-util* } + function printMessage { source $TRAF_CONFIG -echo echo "***IMPORTANT: Go restart HBase on new nodes" echo "***IMPORTANT: Wait until that is done... then..." echo "***IMPORTANT: Ready to run addNode_step2" @@ -262,6 +342,7 @@ checkForHA addNewNodesConfig copyHBaseTrx createNewNodes +removeNodeExclude createConfigDir copyConfig checkHBaseTrx http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b349f404/install/installer/addNode_step2 ---------------------------------------------------------------------- diff --git a/install/installer/addNode_step2 b/install/installer/addNode_step2 index 6213b71..26ad9f1 100755 --- a/install/installer/addNode_step2 +++ b/install/installer/addNode_step2 @@ -153,8 +153,8 @@ function editTrafbashrc { source $TRAF_CONFIG sudo chmod 777 $HOME_DIR/$TRAF_USER/.bashrc -sudo sed -i -e "/export NODE_LIST/d" $HOME_DIR/$TRAF_USER/.bashrc -sudo sed -i -e "/export MY_NODES=/d" $HOME_DIR/$TRAF_USER/.bashrc +sudo sed -i -e "s@export NODE_LIST=.*@export NODE_LIST=\"$NODE_LIST\"@" $HOME_DIR/$TRAF_USER/.bashrc +sudo sed -i -e "s@export MY_NODES=.*@export MY_NODES=\"$MY_NODES\"@" $HOME_DIR/$TRAF_USER/.bashrc } @@ -172,6 +172,43 @@ $TRAF_PDSH sudo chmod 644 $HOME_DIR/$TRAF_USER/.bashrc } +function copyClusterConf { + +source $TRAF_CONFIG +echo "***INFO: Copying over new cluster.conf file" + +echo "***IMPORTANT*** Ignore copy errors to new node." +echo +sleep 5 + +sudo cp $SQ_ROOT/tmp/cluster.conf $PWD +sudo chown $(whoami).$(whoami) $PWD/cluster.conf +$TRAF_PDCP $PWD/cluster.conf $HOME +$TRAF_PDSH sudo cp $HOME/cluster.conf $SQ_ROOT/tmp/cluster.conf 2>&1 > /dev/null +$TRAF_PDSH sudo chown $TRAF_USER.trafodion $SQ_ROOT/tmp/cluster.conf 2>&1 > /dev/null +$TRAF_PDSH sudo rm $HOME/cluster.conf + +} + +function copySQconfig { + +source $TRAF_CONFIG +echo "***INFO: Copying over new sqconfig file" + +echo "***IMPORTANT*** Ignore copy errors to new node." +echo +sleep 5 + +sudo cp -r $SQ_ROOT/sql/scripts/sqconfig $PWD +sudo chown $(whoami).$(whoami) $PWD/sqconfig +$TRAF_PDCP $PWD/sqconfig $HOME +$TRAF_PDSH sudo cp $HOME/sqconfig $SQ_ROOT/sql/scripts/sqconfig 2>&1 > /dev/null +$TRAF_PDSH sudo chown $TRAF_USER.trafodion $SQ_ROOT/sql/scripts/sqconfig 2>&1 > /dev/null +$TRAF_PDSH sudo rm $HOME/sqconfig + + +} + function addTraftoHBase { echo "***INFO: Adding $TRAF_USER userid to $HBASE_GROUP group" @@ -188,13 +225,14 @@ echo "***INFO: Create DCS servers file" source $TRAF_CONFIG DCS_DIR=$(sudo ls $SQ_ROOT | grep dcs\*) +sudo cp $SQ_ROOT/$DCS_DIR/conf/servers $PWD +sudo chown $(whoami).$(whoami) $PWD/servers let per_node=$DCS_SERVERS_PARM/$node_count let extras=$DCS_SERVERS_PARM%$node_count count=1 for node_name in $NODE_LIST do - while read line do if [[ $line =~ .*$node_name.* ]]; then @@ -214,10 +252,12 @@ do done -$TRAF_PDCP $PWD/tempServers $HOME +$TRAF_PDCP $PWD/servers $HOME/tempServers $TRAF_PDSH sudo cp $HOME/tempServers $SQ_ROOT/$DCS_DIR/conf/servers $TRAF_PDSH sudo chown $TRAF_USER.trafodion $SQ_ROOT/$DCS_DIR/conf/servers + + } function editDCSBackUp { @@ -227,7 +267,7 @@ echo "***INFO: Create DCS Backup Master file" source $TRAF_CONFIG DCS_DIR=$(sudo ls $SQ_ROOT | grep dcs\*) -if [[ ! -z $NEW_BACKUP_DCS_NODES ]]; then +if [[ ! -z $NEW_BACKUP_DCS_NODES ]]; then for node_name in $BACKUP_DCS_NODES do echo $node_name >> $PWD/tempbackup @@ -240,13 +280,12 @@ if [[ ! -z $NEW_BACKUP_DCS_NODES ]]; then fi } - function copyAll { source $TRAF_CONFIG echo echo "***IMPORTANT: Copying files to $NEW_NODES" -echo "***IMPORTANT: This will take some time, it's a lot of file. Please wait...." +echo "***IMPORTANT: This will take some time, it's alot of file. Please wait...." echo sudo mkdir -p $HOME/tmpTraf/ $TRAF_NEW_PDSH sudo rm -rf $HOME_DIR/$TRAF_USER/.ssh @@ -312,72 +351,31 @@ function copySqcert { source $TRAF_CONFIG $TRAF_PDSH mkdir -p $HOME/tmpTraf -sudo cp -r $HOME_DIR/$TRAF_USER/sqcert $HOME/tmpTraf +sudo cp -r $HOME_DIR/$TRAF_USER/sqcert/* $HOME/tmpTraf sudo chown -R $(whoami).$(whoami) $HOME/tmpTraf $TRAF_PDCP -r $HOME/tmpTraf $HOME $TRAF_PDSH sudo mkdir -p $HOME_DIR/$TRAF_USER/sqcert $TRAF_PDSH sudo chown -R $TRAF_USER.trafodion $HOME_DIR/$TRAF_USER/sqcert 2>&1 > /dev/null -$TRAF_PDSH sudo cp -rf $HOME/tmpTraf/sqcert/* $HOME_DIR/$TRAF_USER/sqcert 2>&1 > /dev/null +$TRAF_PDSH sudo cp -rf $HOME/tmpTraf/sqcert $HOME_DIR/$TRAF_USER/sqcert 2>&1 > /dev/null $TRAF_PDSH sudo chown -R $TRAF_USER.trafodion $HOME_DIR/$TRAF_USER/sqcert 2>&1 > /dev/null $TRAF_PDSH rm -r $HOME/tmpTraf } -function copysqConfig { - -source $TRAF_CONFIG - -$TRAF_PDSH mkdir -p $HOME/tmpTraf -sudo cp -r $SQ_ROOT/sql/scripts/sqconfig $HOME/tmpTraf -sudo cp -r $SQ_ROOT/sql/scripts/sqconfig.db $HOME/tmpTraf -sudo chown -R $(whoami).$(whoami) $HOME/tmpTraf -$TRAF_PDCP -r $HOME/tmpTraf $HOME -$TRAF_PDSH sudo cp -rf $HOME/tmpTraf/sqconfig $SQ_ROOT/sql/scripts 2>&1 > /dev/null -$TRAF_PDSH sudo cp -rf $HOME/tmpTraf/sqconfig.db $SQ_ROOT/sql/scripts 2>&1 > /dev/null -$TRAF_PDSH sudo chown -R $TRAF_USER.trafodion $SQ_ROOT/sql/scripts 2>&1 > /dev/null -$TRAF_PDSH rm -r $HOME/tmpTraf - -} - - function printMessage { source $TRAF_CONFIG echo echo "***IMPORTANT: EXIT OUT OF ALL EXISTING SHELLS, need to pick up new environment variables" -echo "***IMPORTANT: All node(s) should be added!" +echo "***IMPORTANT: Node is ready to be added" +echo "***IMPORTANT: sudo su $TRAF_USER" +echo "***IMPORTANT: sqshell -a" +echo "***IMPORTANT: up <new node>" echo } -function addUpNodes { - -for node in $NEW_NODES -do - - nodeToAdd="node-name $node, cores $CORES, processors $PROCESSORS, roles connection,aggregation,storage" - - sudo su $TRAF_USER --login --command "cd $SQ_ROOT/sql/scripts; echo \"node add $nodeToAdd \" | sqshell -a" - sleep 30 - sudo su $TRAF_USER --login --command "cd $SQ_ROOT/sql/scripts; echo \"node up $node\" | sqshell -a" - sleep 30 - -done - -} - -function sqRegen { - -sudo su $TRAF_USER --login --command "cd $SQ_ROOT/sql/scripts; sqregen -config" - -} - -function dcsStart { - -sudo su $TRAF_USER --login --command "cd $SQ_ROOT/sql/scripts; dcsstart" -} - function cleanUp { $TRAF_PDSH rm -rf $HOME/hbase-site* @@ -391,11 +389,13 @@ $TRAF_PDSH rm -rf $HOME/trafodion.conf } + #Main echo echo "***IMPORTANT: Starting installation on $NEW_NODES" echo + installPackages copyLimits reserveDCSPorts @@ -407,15 +407,12 @@ copyTrafbashrc copyAll trafAcceptKeys editDCSServers -if [[ "$ENABLE_HA" == "true" ]]; then +if [[ "$ENABLE_HA" == "true" ]]; then editDCSBackUp fi addTraftoHBase +copyClusterConf +copySQconfig copySqcert -addUpNodes -sqRegen -copysqConfig -dcsStart -cleanUp printMessage - +cleanUp http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b349f404/install/installer/deleteNode ---------------------------------------------------------------------- diff --git a/install/installer/deleteNode b/install/installer/deleteNode deleted file mode 100755 index bf2d905..0000000 --- a/install/installer/deleteNode +++ /dev/null @@ -1,244 +0,0 @@ -#!/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 @@@ - - -export TRAF_CONFIG="/etc/trafodion/trafodion_config" -export NODES="" - -while [[ $# -gt 0 ]]; do - case "$1" in - --nodes) - NODES=$2 - shift - ;; - *) - echo "***ERROR: unknown parameter '$1'" - print_usage - exit -1 - esac - shift -done - -source $TRAF_CONFIG - -function deleteNodesConfig { - -source $TRAF_CONFIG - -DELETE_NODES="$NODES" -MY_DELETE_NODES="" - -for node in $NODES -do - MY_DELETE_NODES="$MY_DELETE_NODES -w $node" -done - -echo $MY_DELETE_NODES - -export PDSH_SSH_CMD="ssh -q -n %h" - -export TRAF_NEW_PDSH="pdsh -R exec $MY_DELETE_NODES $PDSH_SSH_CMD" -export TRAF_NEW_PDCP="pdcp -R ssh $MY_DELETE_NODES" - - -sudo chmod 777 $TRAF_CONFIG -sed -i '/DELETE_NODES\=/d' $TRAF_CONFIG -echo "export DELETE_NODES=\"$DELETE_NODES\"" >> $TRAF_CONFIG -sudo chmod 777 $TRAF_CONFIG -sed -i '/MY_DELETE_NODES\=/d' $TRAF_CONFIG -echo "export MY_DELETE_NODES=\"$MY_DELETE_NODES\"" >> $TRAF_CONFIG -sudo chmod 777 $TRAF_CONFIG -sed -i '/TRAF_NEW_PDSH\=/d' $TRAF_CONFIG -echo "export TRAF_NEW_PDSH=\"$TRAF_NEW_PDSH\"" >> $TRAF_CONFIG -sudo chmod 777 $TRAF_CONFIG -sed -i '/TRAF_NEW_PDCP\=/d' $TRAF_CONFIG -echo "export TRAF_NEW_PDCP=\"$TRAF_NEW_PDCP\"" >> $TRAF_CONFIG -sudo chmod 777 $TRAF_CONFIG -} - -function createNewNodes { - -source $TRAF_CONFIG -temp="" -tempW="" -for node in $NODE_LIST -do - if [[ ! $DELETE_NODES =~ .*$node.* ]]; then - temp="$temp $node" - tempW="$tempW $node" - fi -done - -NODE_LIST="$temp" -node_count=$(echo $NODE_LIST | wc -w) -MY_NODES="$tempW" - -temp1="" -tempW1="" - -for node in $ALL_NODE_LIST -do - if [[ ! $DELETE_NODES =~ .*$node.* ]]; then - temp1="$temp1 $node" - tempW1="$tempW1 -w $node" - fi -done - -ALL_NODE_LIST="$temp1" -echo $ALL_NODE_LIST -ALL_NODES="$tempW1" -echo $ALL_NODES - -TRAF_PDSH="pdsh -R exec $ALL_NODES $PDSH_SSH_CMD" -TRAF_PDCP="pdcp -R ssh $ALL_NODES" - -sudo chmod 777 $TRAF_CONFIG -sed -i '/TRAF_PDSH\=/d' $TRAF_CONFIG -echo "export TRAF_PDSH=\"$TRAF_PDSH\"" >> $TRAF_CONFIG -sudo chmod 777 $TRAF_CONFIG -sed -i '/TRAF_PDCP\=/d' $TRAF_CONFIG -echo "export TRAF_PDCP=\"$TRAF_PDCP\"" >> $TRAF_CONFIG -sudo chmod 777 $TRAF_CONFIG -sed -i '/\<ALL_NODES\>/d' $TRAF_CONFIG -echo "export ALL_NODES=\"$ALL_NODES\"" >> $TRAF_CONFIG -sudo chmod 777 $TRAF_CONFIG -sed -i '/\<NODE_LIST\>/d' $TRAF_CONFIG -echo "export NODE_LIST=\"$NODE_LIST\"" >> $TRAF_CONFIG -sudo chmod 777 $TRAF_CONFIG -sed -i '/node_count\=/d' $TRAF_CONFIG -echo "export node_count=\"$node_count\"" >> $TRAF_CONFIG -sudo chmod 777 $TRAF_CONFIG -sed -i '/\<ALL_NODE_LIST\>/d' $TRAF_CONFIG -echo "export ALL_NODE_LIST=\"$ALL_NODE_LIST\"" >> $TRAF_CONFIG -sudo chmod 777 $TRAF_CONFIG -sed -i '/\<MY_NODES\>/d' $TRAF_CONFIG -echo "export MY_NODES=\"$MY_NODES\"" >> $TRAF_CONFIG -sudo chmod 777 $TRAF_CONFIG -} - - -function copyConfig { - -source $TRAF_CONFIG - -cp $TRAF_CONFIG $PWD -$TRAF_PDCP $PWD/trafodion_config $HOME -$TRAF_PDSH sudo cp $HOME/trafodion_config /etc/trafodion/ -$TRAF_PDSH sudo chmod 777 $TRAF_CONFIG - -} - -function deleteNodes { - -for node in $DELETE_NODES -do - - sudo su $TRAF_USER --login --command "cd $SQ_ROOT/sql/scripts; echo \"node down $node\" | sqshell -a" - sleep 30 - sudo su $TRAF_USER --login --command "cd $SQ_ROOT/sql/scripts; echo \"node delete $node\" | sqshell -a" - sleep 30 - -done - - -} - -function sqRegen { - -sudo su $TRAF_USER --login --command "cd $SQ_ROOT/sql/scripts; sqregen -config" - -} - -function copysqConfig { - -source $TRAF_CONFIG - -$TRAF_PDSH mkdir -p $HOME/tmpTraf -sudo cp -r $SQ_ROOT/sql/scripts/sqconfig $HOME/tmpTraf -sudo cp -r $SQ_ROOT/sql/scripts/sqconfig.db $HOME/tmpTraf -sudo chown -R $(whoami).$(whoami) $HOME/tmpTraf -$TRAF_PDCP -r $HOME/tmpTraf $HOME -$TRAF_PDSH sudo cp -rf $HOME/tmpTraf/sqconfig $SQ_ROOT/sql/scripts 2>&1 > /dev/null -$TRAF_PDSH sudo cp -rf $HOME/tmpTraf/sqconfig.db $SQ_ROOT/sql/scripts 2>&1 > /dev/null -$TRAF_PDSH sudo chown -R $TRAF_USER.trafodion $SQ_ROOT/sql/scripts 2>&1 > /dev/null -$TRAF_PDSH rm -r $HOME/tmpTraf - -} - -function editDCSServers { - -source $TRAF_CONFIG -DCS_DIR=$(sudo ls $SQ_ROOT | grep dcs\*) - -let per_node=$DCS_SERVERS_PARM/$node_count -let extras=$DCS_SERVERS_PARM%$node_count -count=1 -for node_name in $NODE_LIST -do - if [ $count -le $extras ]; then - let node_servers=$per_node+1 - else - node_servers=$per_node - fi - echo $node_name $node_servers >> $PWD/tmpServers - (( count++ )) -done - - -$TRAF_PDCP $PWD/tmpServers $HOME -$TRAF_PDSH sudo cp $HOME/tmpServers $SQ_ROOT/$DCS_DIR/conf/servers -$TRAF_PDSH sudo chown $TRAF_USER.trafodion $SQ_ROOT/$DCS_DIR/conf/servers -$TRAF_PDSH sudo rm -rf $HOME/tmp* - -} - -function dcsStop { - -echo "This is where we will use the new dcsstop --node script" - -} - - -function printMessage { - -source $TRAF_CONFIG -echo -echo "***IMPORTANT: Node(s) removed!" -echo "***IMPORTANT: EXIT OUT OF ALL EXISTING SHELLS, need to pick up new environment variables" -echo -echo - -} - - -#Main - -deleteNodesConfig -createNewNodes -copyConfig -deleteNodes -sqRegen -copysqConfig -editDCSServers -dcsStop -printMessage -