You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by sh...@apache.org on 2018/01/23 19:04:51 UTC
incubator-hawq git commit: HAWQ-1580. Set PXF port number to 5888 for
GPDB
Repository: incubator-hawq
Updated Branches:
refs/heads/master 0d620e431 -> 037be68ff
HAWQ-1580. Set PXF port number to 5888 for GPDB
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/037be68f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/037be68f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/037be68f
Branch: refs/heads/master
Commit: 037be68ffacdac09dbecef22951ffa97bd9acb4a
Parents: 0d620e4
Author: Lav Jain <lj...@pivotal.io>
Authored: Tue Jan 23 11:04:44 2018 -0800
Committer: shivzone <sh...@gmail.com>
Committed: Tue Jan 23 11:04:44 2018 -0800
----------------------------------------------------------------------
pxf/build.gradle | 4 +
pxf/gradle/profiles/gpdb.properties | 1 +
pxf/gradle/profiles/hawq.properties | 3 +-
pxf/pxf-service/src/scripts/pxf-env.sh | 4 +-
pxf/pxf-service/src/scripts/pxf-service | 143 ++++++++++++---------------
5 files changed, 72 insertions(+), 83 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/037be68f/pxf/build.gradle
----------------------------------------------------------------------
diff --git a/pxf/build.gradle b/pxf/build.gradle
index 706caa9..20a9ff4 100644
--- a/pxf/build.gradle
+++ b/pxf/build.gradle
@@ -267,6 +267,7 @@ project('pxf-service') {
filter(ReplaceTokens,
tokens: ['pxfLogDir' : databaseProperties.pxfLogDir,
'pxfRunDir' : databaseProperties.pxfRunDir,
+ 'pxfPortNum' : databaseProperties.pxfPortNum,
'pxfDefaultUser': (databaseProperties.pxfDefaultUser == null ? "" : databaseProperties.pxfDefaultUser)])
into "/etc/pxf-${project.version}/conf"
}
@@ -296,6 +297,7 @@ project('pxf-service') {
into "/opt/pxf-${project.version}"
filter(ReplaceTokens,
tokens: [
+ 'pxfPortNum' : databaseProperties.pxfPortNum,
'pxfDefaultUser': (databaseProperties.pxfDefaultUser == null ? "" : databaseProperties.pxfDefaultUser)])
}
@@ -629,6 +631,7 @@ task install(type: Copy, dependsOn: [subprojects.build, tomcatGet]) {
rename('pxf-service', 'pxf')
filter(ReplaceTokens,
tokens: [
+ 'pxfPortNum' : databaseProperties.pxfPortNum,
'pxfDefaultUser': (databaseProperties.pxfDefaultUser == null ? "" : databaseProperties.pxfDefaultUser)])
}
@@ -639,6 +642,7 @@ task install(type: Copy, dependsOn: [subprojects.build, tomcatGet]) {
filter(ReplaceTokens,
tokens: ['pxfLogDir' : databaseProperties.pxfLogDir,
'pxfRunDir' : databaseProperties.pxfRunDir,
+ 'pxfPortNum' : databaseProperties.pxfPortNum,
'pxfDefaultUser': (databaseProperties.pxfDefaultUser == null ? "" : databaseProperties.pxfDefaultUser)]) into 'conf'
}
from("pxf-service/src/configs/tomcat") { into 'tomcat-templates' }
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/037be68f/pxf/gradle/profiles/gpdb.properties
----------------------------------------------------------------------
diff --git a/pxf/gradle/profiles/gpdb.properties b/pxf/gradle/profiles/gpdb.properties
index df16372..91775a3 100644
--- a/pxf/gradle/profiles/gpdb.properties
+++ b/pxf/gradle/profiles/gpdb.properties
@@ -17,3 +17,4 @@
pxfLogDir=${PXF_HOME}/logs
pxfRunDir=${PXF_HOME}/run
+pxfPortNum=5888
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/037be68f/pxf/gradle/profiles/hawq.properties
----------------------------------------------------------------------
diff --git a/pxf/gradle/profiles/hawq.properties b/pxf/gradle/profiles/hawq.properties
index e92c839..6c078ec 100644
--- a/pxf/gradle/profiles/hawq.properties
+++ b/pxf/gradle/profiles/hawq.properties
@@ -17,4 +17,5 @@
pxfDefaultUser=pxf
pxfLogDir=/var/log/pxf
-pxfRunDir=/var/run/pxf
\ No newline at end of file
+pxfRunDir=/var/run/pxf
+pxfPortNum=51200
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/037be68f/pxf/pxf-service/src/scripts/pxf-env.sh
----------------------------------------------------------------------
diff --git a/pxf/pxf-service/src/scripts/pxf-env.sh b/pxf/pxf-service/src/scripts/pxf-env.sh
index a830493..0f24c79 100644
--- a/pxf/pxf-service/src/scripts/pxf-env.sh
+++ b/pxf/pxf-service/src/scripts/pxf-env.sh
@@ -19,7 +19,7 @@
PARENT_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
# Default PXF_HOME
-export PXF_HOME=${PXF_HOME:=$PARENT_SCRIPT_DIR}
+export PXF_HOME=${PXF_HOME:=${PARENT_SCRIPT_DIR}}
# Path to HDFS native libraries
export LD_LIBRARY_PATH=/usr/lib/hadoop/lib/native:${LD_LIBRARY_PATH}
@@ -39,7 +39,7 @@ if [ ! -z '@pxfDefaultUser@' ]; then
fi
# Port
-export PXF_PORT=${PXF_PORT:-51200}
+export PXF_PORT=${PXF_PORT:-@pxfPortNum@}
# Memory
export PXF_JVM_OPTS="-Xmx2g -Xms1g"
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/037be68f/pxf/pxf-service/src/scripts/pxf-service
----------------------------------------------------------------------
diff --git a/pxf/pxf-service/src/scripts/pxf-service b/pxf/pxf-service/src/scripts/pxf-service
index bf2865a..d061279 100644
--- a/pxf/pxf-service/src/scripts/pxf-service
+++ b/pxf/pxf-service/src/scripts/pxf-service
@@ -21,25 +21,25 @@
#
-if [ -z $PXF_HOME ]; then
+if [ -z ${PXF_HOME} ]; then
parent_script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
- env_script=$parent_script_dir/conf/pxf-env.sh
+ env_script=${parent_script_dir}/conf/pxf-env.sh
else
- env_script=$PXF_HOME/conf/pxf-env.sh
+ env_script=${PXF_HOME}/conf/pxf-env.sh
fi
# load pxf-env.sh script
-if [ ! -f $env_script ]; then
+if [ ! -f ${env_script} ]; then
echo WARNING: failed to find $env_script
else
- source $env_script
+ source ${env_script}
fi
pxf_user=${PXF_USER}
-instance_port=${PXF_PORT:-51200}
+instance_port=${PXF_PORT:-@pxfPortNum@}
instance_name=pxf-service
-if [ -z $PXF_HOME ]; then
+if [ -z ${PXF_HOME} ]; then
# RPM based setup
pxf_root=/usr/lib/pxf
tomcat_root=/opt/apache-tomcat
@@ -48,11 +48,11 @@ if [ -z $PXF_HOME ]; then
instance_owner=$pxf_user:$pxf_user
else
# OSS/Source code based setup
- pxf_root=$PXF_HOME/lib
- tomcat_root=$PXF_HOME/apache-tomcat
- tomcat_templates=$PXF_HOME/tomcat-templates
- instance_root=$PXF_HOME
- instance_owner=$pxf_user
+ pxf_root=${PXF_HOME}/lib
+ tomcat_root=${PXF_HOME}/apache-tomcat
+ tomcat_templates=${PXF_HOME}/tomcat-templates
+ instance_root=${PXF_HOME}
+ instance_owner=${pxf_user}
fi
curl=`which curl`
@@ -70,25 +70,25 @@ function fail()
#
function createInstance()
{
- mkdir -p $instance_root
- mkdir -p $instance_root/$instance_name
- cp -r $tomcat_root/* $instance_root/$instance_name/.
+ mkdir -p ${instance_root}
+ mkdir -p ${instance_root}/${instance_name}
+ cp -r ${tomcat_root}/* ${instance_root}/${instance_name}/.
if [ $? -gt 0 ]; then
echo ERROR: instance creation failed
return 1
fi
- if [ ! -z $pxf_user ]; then
- chown -R $instance_owner $instance_root
+ if [ ! -z ${pxf_user} ]; then
+ chown -R ${instance_owner} ${instance_root}
fi
- chmod 700 $instance_root/$instance_name
+ chmod 700 ${instance_root}/${instance_name}
# copy configuration files into instance
- cp $tomcat_templates/bin/setenv.sh $instance_root/$instance_name/bin/setenv.sh
- cp $tomcat_templates/conf/catalina.properties $instance_root/$instance_name/conf/.
- cp $tomcat_templates/conf/server.xml $instance_root/$instance_name/conf/.
- cp $tomcat_templates/conf/web.xml $instance_root/$instance_name/conf/.
+ cp ${tomcat_templates}/bin/setenv.sh ${instance_root}/${instance_name}/bin/setenv.sh
+ cp ${tomcat_templates}/conf/catalina.properties ${instance_root}/${instance_name}/conf/.
+ cp ${tomcat_templates}/conf/server.xml ${instance_root}/${instance_name}/conf/.
+ cp ${tomcat_templates}/conf/web.xml ${instance_root}/${instance_name}/conf/.
return 0
}
@@ -98,8 +98,8 @@ function createInstance()
#
function deployWebapp()
{
- cp $pxf_root/pxf.war $instance_root/$instance_name/webapps/ || return 1
- cp $pxf_root/pxf-service-*[0-9].jar $instance_root/$instance_name/lib/ || return 1
+ cp ${pxf_root}/pxf.war ${instance_root}/${instance_name}/webapps/ || return 1
+ cp ${pxf_root}/pxf-service-*[0-9].jar ${instance_root}/${instance_name}/lib/ || return 1
return 0
}
@@ -124,7 +124,7 @@ function waitForTomcat()
return 1
fi
echo "tomcat not responding, re-trying after ${sleep_time} second (attempt number ${attempts})"
- sleep $sleep_time
+ sleep ${sleep_time}
done
return 0
@@ -139,11 +139,11 @@ function checkWebapp()
waitForTomcat $1 || return 1
echo Checking if PXF webapp is up and running...
- curlResponse=$($curl -s "http://localhost:${instance_port}/pxf/v0")
+ curlResponse=$(${curl} -s "http://localhost:${instance_port}/pxf/v0")
expectedResponse="Wrong version v0, supported version is v[0-9]+"
- if [[ $curlResponse =~ $expectedResponse ]]; then
- echo PXF webapp is up
+ if [[ ${curlResponse} =~ $expectedResponse ]]; then
+ echo PXF webapp is listening on port ${instance_port}
return 0
fi
@@ -159,7 +159,7 @@ function instanceExists()
return 1
fi
- $instance_root/$instance_name/bin/catalina.sh version > /dev/null 2>&1
+ ${instance_root}/${instance_name}/bin/catalina.sh version > /dev/null 2>&1
return $?
}
@@ -168,7 +168,7 @@ function doInit()
{
instanceExists
if [ $? -eq 0 ]; then
- echo WARNING: instance already exists in $instance_root, nothing to do...
+ echo WARNING: instance already exists in ${instance_root}, nothing to do...
return 0
fi
determineHadoopDistro
@@ -185,91 +185,74 @@ function doInit()
#
function configureWebapp()
{
- if [ -z $PXF_HOME ]; then
+ if [ -z ${PXF_HOME} ]; then
# webapp doesn't require patch
return 0
fi
- pushd $instance_root/$instance_name/webapps || return 1
+ pushd ${instance_root}/${instance_name}/webapps > /dev/null || return 1
rm -rf pxf
mkdir pxf
cd pxf
unzip -q ../pxf.war
- popd
+ popd > /dev/null
- context_file=$instance_root/$instance_name/webapps/pxf/META-INF/context.xml
- cat $context_file | \
- sed -e "s:classpathFiles=\"[a-zA-Z0-9\/\;.-]*\":classpathFiles=\"$PXF_HOME\/conf\/pxf-private.classpath\":" \
- -e "s:secondaryClasspathFiles=\"[a-zA-Z0-9\/\;.-]*\":secondaryClasspathFiles=\"$PXF_HOME\/conf\/pxf-public.classpath\":" > context.xml.tmp
- mv context.xml.tmp $context_file
+ context_file=${instance_root}/${instance_name}/webapps/pxf/META-INF/context.xml
+ sed -i -e "s:classpathFiles=\"[a-zA-Z0-9\/\;.-]*\":classpathFiles=\"${PXF_HOME}\/conf\/pxf-private.classpath\":" \
+ -e "s:secondaryClasspathFiles=\"[a-zA-Z0-9\/\;.-]*\":secondaryClasspathFiles=\"${PXF_HOME}\/conf\/pxf-public.classpath\":" ${context_file}
- web_file=$instance_root/$instance_name/webapps/pxf/WEB-INF/web.xml
- cat $web_file | \
- sed "s:<param-value>.*pxf-log4j.properties<\/param-value>:<param-value>$PXF_HOME\/conf\/pxf-log4j.properties<\/param-value>:" > web.xml.tmp
- mv web.xml.tmp $web_file
+ web_file=${instance_root}/${instance_name}/webapps/pxf/WEB-INF/web.xml
+ sed -i "s:<param-value>.*pxf-log4j.properties<\/param-value>:<param-value>$PXF_HOME\/conf\/pxf-log4j.properties<\/param-value>:" ${web_file}
# set port
- catalinaProperties=$instance_root/$instance_name/conf/catalina.properties
- cat $catalinaProperties | \
- sed "s|^[[:blank:]]*connector.http.port=.*$|connector.http.port=$instance_port|g" \
- > ${catalinaProperties}.tmp
-
- rm $catalinaProperties
- mv ${catalinaProperties}.tmp $catalinaProperties
+ catalinaProperties=${instance_root}/${instance_name}/conf/catalina.properties
+ sed -i "s|^[[:blank:]]*connector.http.port=.*$|connector.http.port=$instance_port|g" ${catalinaProperties}
# set container configs
- catalinaEnv=$instance_root/$instance_name/bin/setenv.sh
- cat $catalinaEnv | \
- sed -e "s|JVM_OPTS=.*$|JVM_OPTS=\"$PXF_JVM_OPTS\"|g" | \
- sed -e "s|-Dpxf.log.dir=[^[:space:]^\"]*|-Dpxf.log.dir=$PXF_LOGDIR |g" | \
- sed -e "s|^[[:blank:]]*CATALINA_PID=.*$|CATALINA_PID=$PXF_RUNDIR/catalina.pid|g" | \
- sed -e "s|^[[:blank:]]*CATALINA_OUT=.*$|CATALINA_OUT=$PXF_LOGDIR/catalina.out|g" \
- > ${catalinaEnv}.tmp
- rm $catalinaEnv
- mv ${catalinaEnv}.tmp $catalinaEnv
+ catalinaEnv=${instance_root}/${instance_name}/bin/setenv.sh
+ sed -i -e "s|JVM_OPTS=.*$|JVM_OPTS=\"${PXF_JVM_OPTS}\"|g" \
+ -e "s|-Dpxf.log.dir=[^[:space:]^\"]*|-Dpxf.log.dir=${PXF_LOGDIR} |g" \
+ -e "s|^[[:blank:]]*CATALINA_PID=.*$|CATALINA_PID=${PXF_RUNDIR}/catalina.pid|g" \
+ -e "s|^[[:blank:]]*CATALINA_OUT=.*$|CATALINA_OUT=${PXF_LOGDIR}/catalina.out|g" ${catalinaEnv}
# set log directories
- catalinaLog=$instance_root/$instance_name/conf/logging.properties
- cat $catalinaLog | \
- sed "s|juli.FileHandler.directory\s*=.*$|juli.FileHandler.directory = $PXF_LOGDIR|g" \
- > ${catalinaLog}.tmp
- rm $catalinaLog
- mv ${catalinaLog}.tmp $catalinaLog
+ catalinaLog=${instance_root}/$instance_name/conf/logging.properties
+ sed -i "s|juli.FileHandler.directory\s*=.*$|juli.FileHandler.directory = ${PXF_LOGDIR}|g" ${catalinaLog}
}
function commandWebapp()
{
command=$1
- pushd $instance_root
- if [ ! -z $pxf_user ]; then
+ pushd ${instance_root} > /dev/null
+ if [ ! -z ${pxf_user} ]; then
# Run command as a pxf_user
- su $pxf_user -c "$instance_root/$instance_name/bin/catalina.sh $command"
+ su ${pxf_user} -c "$instance_root/$instance_name/bin/catalina.sh $command"
else
# Run command as a current user
- $instance_root/$instance_name/bin/catalina.sh $command
+ ${instance_root}/${instance_name}/bin/catalina.sh ${command}
fi
if [ $? -ne 0 ]; then
return 1
fi
- popd
+ popd > /dev/null
}
function createLogsDir()
{
- mkdir -p $PXF_LOGDIR
- if [ ! -z $pxf_user ]; then
- chown -R $instance_owner $PXF_LOGDIR
+ mkdir -p ${PXF_LOGDIR}
+ if [ ! -z ${pxf_user} ]; then
+ chown -R ${instance_owner} ${PXF_LOGDIR}
fi
- chmod 700 $PXF_LOGDIR
+ chmod 700 ${PXF_LOGDIR}
return 0
}
function createRunDir()
{
- mkdir -p $PXF_RUNDIR
- if [ ! -z $pxf_user ]; then
- chown -R $instance_owner $PXF_RUNDIR
+ mkdir -p ${PXF_RUNDIR}
+ if [ ! -z ${pxf_user} ]; then
+ chown -R ${instance_owner} ${PXF_RUNDIR}
fi
- chmod 700 $PXF_RUNDIR
+ chmod 700 ${PXF_RUNDIR}
return 0
}
@@ -379,8 +362,8 @@ function validateParameters()
fi
# validate pxf user
- if [ ! -z $pxf_user ]; then
- id $pxf_user &> /dev/null;
+ if [ ! -z ${pxf_user} ]; then
+ id ${pxf_user} &> /dev/null;
if [ "$?" -ne "0" ]
then
echo "ERROR: User $pxf_user doesn't exist. Please set valid user via \$PXF_USER variable"
@@ -395,7 +378,7 @@ function validateParameters()
fi
# validate JAVA_HOME
- if [ ! -x $JAVA_HOME/bin/java ]; then
+ if [ ! -x ${JAVA_HOME}/bin/java ]; then
echo ERROR: \$JAVA_HOME is invalid
exit 1
fi