You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2015/12/22 17:28:35 UTC
[04/13] incubator-trafodion git commit: Additional changes for
floating ip. Support to start dcsmaster on remote node
Additional changes for floating ip.
Support to start dcsmaster on remote node
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/68157d51
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/68157d51
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/68157d51
Branch: refs/heads/master
Commit: 68157d51fd1dbbbff562b2564f664b7783372c12
Parents: fafc88f
Author: Anuradha Hegde <An...@esgyn.com>
Authored: Tue Dec 15 18:32:23 2015 +0000
Committer: Anuradha Hegde <An...@esgyn.com>
Committed: Tue Dec 15 18:32:23 2015 +0000
----------------------------------------------------------------------
core/sqf/sql/scripts/cleanlogs | 22 +++++++++---------
core/sqf/sql/scripts/dcscheck | 41 ++++++++++++++++++++++++----------
dcs/bin/dcs-config.sh | 10 +++++++++
dcs/bin/scripts/dcsbind.sh | 10 ++++-----
dcs/bin/scripts/dcsunbind.sh | 4 ++--
dcs/bin/scripts/parse_dcs_site.py | 7 ++++--
dcs/bin/start-dcs.sh | 11 ++++++++-
dcs/conf/dcs-env.sh | 8 ++++++-
dcs/conf/master | 0
9 files changed, 79 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/68157d51/core/sqf/sql/scripts/cleanlogs
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/cleanlogs b/core/sqf/sql/scripts/cleanlogs
index 505adb4..c4d5123 100755
--- a/core/sqf/sql/scripts/cleanlogs
+++ b/core/sqf/sql/scripts/cleanlogs
@@ -39,23 +39,23 @@ function usage() {
}
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]*"
+ $L_PDSH rm -f ${MY_SQROOT}/logs/*.err
+ $L_PDSH rm -f ${MY_SQROOT}/logs/*.log
+ $L_PDSH rm -f ${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]*"
+ $L_PDSH rm -f ${DCS_INSTALL_DIR}/logs/*.log
+ $L_PDSH rm -f ${DCS_INSTALL_DIR}/logs/*.log.[0-9]*
+ $L_PDSH rm -f ${DCS_INSTALL_DIR}/logs/*.out
+ $L_PDSH rm -f ${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]*"
+ $L_PDSH rm -f ${REST_INSTALL_DIR}/logs/*.log
+ $L_PDSH rm -f ${REST_INSTALL_DIR}/logs/*.log.[0-9]*
+ $L_PDSH rm -f ${REST_INSTALL_DIR}/logs/*.out
+ $L_PDSH rm -f ${REST_INSTALL_DIR}/logs/*.out.[0-9]*
}
function all_logs() {
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/68157d51/core/sqf/sql/scripts/dcscheck
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/dcscheck b/core/sqf/sql/scripts/dcscheck
index b227e35..fd7376f 100755
--- a/core/sqf/sql/scripts/dcscheck
+++ b/core/sqf/sql/scripts/dcscheck
@@ -33,6 +33,12 @@ actual_dcsserver_cnt=0
down_dcsserver_cnt=0
activeMaster=`hostname`
+if [ -e $SQ_PDSH ]; then
+ L_PDSH="$SQ_PDSH $MY_NODES "
+else
+ L_PDSH=
+fi
+
tmp_ps=`mktemp -t`
if [[ $? != 0 ]]; then
echo "Error while getting a temporary file. Exiting."
@@ -52,6 +58,11 @@ if [[ $sq_stat == 0 ]]; then
if [ -d $DCS_INSTALL_DIR ];then
+### Get the configured primary node for DcsMaster
+ if [ -s ${DCS_INSTALL_DIR}/conf/master ]; then
+ primary_dcsmaster=`cat ${DCS_INSTALL_DIR}/conf/master | /bin/egrep -v '^#|^$'`
+ fi
+
### 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`
@@ -68,18 +79,18 @@ if [[ $sq_stat == 0 ]]; then
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
+ actual_dcsmaster_cnt=`$L_PDSH $jpscmd |grep DcsMaster |wc -l`
+ actual_dcsserver_cnt=`$L_PDSH $jpscmd |grep DcsServer |wc -l`
### Get the node where the active master is running
- if [[ -e $SQ_PDSH && ! -z $ENABLE_HA ]]; then
+ if [[ ! -z $CLUSTERNAME ]]; then
+ if [[ ! -z $ENABLE_HA ]]; then
+ echo " This cluster \"$CLUSTERNAME\" is configured for HA"
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`
+ activeMaster=`$L_PDSH /sbin/ip addr show |grep $gv_float_interface$ |cut -d':' -f1`
+ else
+ activeMaster=`$L_PDSH $jpscmd |grep DcsMaster |cut -d":" -f1`
+ fi
fi
if ( [ "$cfg_dcsserver_cnt" '!=' "$actual_dcsserver_cnt" ] ); then
@@ -109,16 +120,22 @@ if [[ $sq_stat == 0 ]]; then
echo "ls $dcsznode"|$DCS_INSTALL_DIR/bin/dcs zkcli > $dcstmp
zkport=`cat $dcstmp | /usr/bin/head -n 1 | cut -d ":" -f2`
if [ ! -z "$zkport" ]; then
- echo "Zookeeper is listening on port $zkport"
+ echo "Zookeeper is listening on port \"$zkport\""
else
echo "Zookeeper is not started..."
exit 1
fi
masterport=`cat $dcstmp | /usr/bin/tail -n 1 | cut -d ":" -f4`
if [ ! -z "$masterport" ]; then
- echo "DcsMaster is listening host \"$activeMaster\" using port \"$masterport\""
+ echo "DcsMaster is listening on port \"$masterport\""
+ if [[ ! -z $primary_dcsmaster ]]; then
+ echo "Primary DcsMaster configured to run on node \"$primary_dcsmaster\""
+ fi
+ if [[ ! -z $activeMaster ]]; then
+ echo "Active DcsMaster is on node \"$activeMaster\""
+ fi
if [[ ! -z $list_of_backups ]]; then
- echo "Backup Masters configured to run on nodes: " $list_of_backups
+ echo "Backup DcsMasters configured to run on nodes \"$list_of_backups\""
fi
echo
fi
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/68157d51/dcs/bin/dcs-config.sh
----------------------------------------------------------------------
diff --git a/dcs/bin/dcs-config.sh b/dcs/bin/dcs-config.sh
index de1b860..023521a 100755
--- a/dcs/bin/dcs-config.sh
+++ b/dcs/bin/dcs-config.sh
@@ -94,6 +94,8 @@ done
DCS_CONF_DIR="${DCS_CONF_DIR:-$DCS_HOME/conf}"
# List of DCS servers.
DCS_SERVERS="${DCS_SERVERS:-$DCS_CONF_DIR/servers}"
+# DCS primary master.
+DCS_PRIMARY_MASTER="${DCS_PRIMARY_MASTER:-$DCS_CONF_DIR/master}"
# List of DCS secondary masters.
DCS_BACKUP_MASTERS="${DCS_BACKUP_MASTERS:-$DCS_CONF_DIR/backup-masters}"
@@ -102,6 +104,14 @@ if [ -f "${DCS_CONF_DIR}/dcs-env.sh" ]; then
. "${DCS_CONF_DIR}/dcs-env.sh"
fi
+# Source in sqenv.sh.
+if [ -f "${MY_SQROOT}/sqenv.sh" ]; then
+ savedir=`pwd`
+ cd $MY_SQROOT
+ . sqenv.sh
+ cd $savedir
+fi
+
# Newer versions of glibc use an arena memory allocator that causes virtual
# memory usage to explode. Tune the variable down to prevent vmem explosion.
export MALLOC_ARENA_MAX=${MALLOC_ARENA_MAX:-4}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/68157d51/dcs/bin/scripts/dcsbind.sh
----------------------------------------------------------------------
diff --git a/dcs/bin/scripts/dcsbind.sh b/dcs/bin/scripts/dcsbind.sh
index d33decc..038acc9 100755
--- a/dcs/bin/scripts/dcsbind.sh
+++ b/dcs/bin/scripts/dcsbind.sh
@@ -274,26 +274,26 @@ function configure_route_tables {
fi
- dcsEcho "Deleting and Adding from rule for the internal ip to the rules table"
+ 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"
+ 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"
+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"
+ 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"
+ dcsEcho "Failed to delete the TO rule in the rules table - status is $status"
exit $gv_error
fi
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/68157d51/dcs/bin/scripts/dcsunbind.sh
----------------------------------------------------------------------
diff --git a/dcs/bin/scripts/dcsunbind.sh b/dcs/bin/scripts/dcsunbind.sh
index 0794c1b..e881606 100755
--- a/dcs/bin/scripts/dcsunbind.sh
+++ b/dcs/bin/scripts/dcsunbind.sh
@@ -70,8 +70,8 @@ function Check_VirtualIP_InUse_And_Unbind {
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_float_interface=`python $DCS_INSTALL_DIR/bin/scripts/parse_dcs_site.py|cut -d$'\n' -f1`
+gv_port=23400
gv_externalip_set=1
gv_internalip_set=1
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/68157d51/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
index afe3d91..0fc7949 100755
--- a/dcs/bin/scripts/parse_dcs_site.py
+++ b/dcs/bin/scripts/parse_dcs_site.py
@@ -24,8 +24,11 @@
import os
from xml.dom import minidom
-name = os.environ.get('DCS_INSTALL_DIR')
-doc = minidom.parse(name+"/conf/dcs-site.xml")
+dcsconfig_dir = os.environ.get('DCS_CONF_DIR')
+if (dcsconfig_dir == null)
+ name = os.environ.get('DCS_INSTALL_DIR')
+ dcsconfig_dir=name+"/conf"
+doc = minidom.parse(dcsconfig_dir+"/dcs-site.xml")
props = doc.getElementsByTagName("property")
for prop in props:
pname = prop.getElementsByTagName("name")[0]
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/68157d51/dcs/bin/start-dcs.sh
----------------------------------------------------------------------
diff --git a/dcs/bin/start-dcs.sh b/dcs/bin/start-dcs.sh
index 5337704..32a4724 100755
--- a/dcs/bin/start-dcs.sh
+++ b/dcs/bin/start-dcs.sh
@@ -46,7 +46,16 @@ then
exit $errCode
fi
-if [ "$master" == "" ] || [ "$master" == "$(hostname -f)" ] ; then
+if [ -z "$master" ] ; then
+ if [ ! -z "${DCS_PRIMARY_MASTER}" ] && [ -s ${DCS_PRIMARY_MASTER} ] ; then
+ master_node=`cat ${DCS_PRIMARY_MASTER}| egrep -v '^#|^$'`
+ if [ ! -z "$master_node" ] ; then
+ master=`echo $master_node | awk '{print $1}'`
+ fi
+ fi
+fi
+
+if [ "$master" == "" ] || [ "$master" == "localhost" ] || [ "$master" == "$(hostname -f)" ] ; then
"$bin"/dcs-daemon.sh --config "${DCS_CONF_DIR}" start master
else
remote_cmd="cd ${DCS_HOME}; $bin/dcs-daemon.sh --config ${DCS_CONF_DIR} start master"
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/68157d51/dcs/conf/dcs-env.sh
----------------------------------------------------------------------
diff --git a/dcs/conf/dcs-env.sh b/dcs/conf/dcs-env.sh
index 0851940..ed62636 100644
--- a/dcs/conf/dcs-env.sh
+++ b/dcs/conf/dcs-env.sh
@@ -76,7 +76,13 @@ export DCS_OPTS="-XX:+UseConcMarkSweepGC"
# export DCS_REST_OPTS="$DCS_REST_OPTS $DCS_JMX_BASE -Dcom.sun.management.jmxremote.port=10103"
# export DCS_ZOOKEEPER_OPTS="$DCS_ZOOKEEPER_OPTS $DCS_JMX_BASE -Dcom.sun.management.jmxremote.port=10104"
-# File naming hosts on which DCS Servers will run. $DCS_HOME/conf/servers by default.
+# File naming host on which DCS Primary Master is configured to run. $DCS_HOME/conf/master by default.
+# export DCS_PRIMARY_MASTER=${DCS_HOME}/conf/master
+
+# File naming hosts on which DCS Backup Masters is configured to run. $DCS_HOME/conf/backup-masters by default.
+# export DCS_BACKUP_MASTERS=${DCS_HOME}/conf/backup-masters
+
+# File naming hosts on which DCS Servers will run. $DCS_HOME/conf/servers by default.
# export DCS_SERVERS=${DCS_HOME}/conf/servers
# Extra ssh options. Empty by default.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/68157d51/dcs/conf/master
----------------------------------------------------------------------
diff --git a/dcs/conf/master b/dcs/conf/master
new file mode 100644
index 0000000..e69de29