cdh6.3.2 环境变量配置
程序员文章站
2022-07-14 21:53:05
...
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
pathmunge () {
case ":${PATH}:" in
*:"$1":*)
;;
*)
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
esac
}
if [ -x /usr/bin/id ]; then
if [ -z "$EUID" ]; then
# ksh workaround
EUID=`/usr/bin/id -u`
UID=`/usr/bin/id -ru`
fi
USER="`/usr/bin/id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
fi
# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /usr/sbin
pathmunge /usr/local/sbin
else
pathmunge /usr/local/sbin after
pathmunge /usr/sbin after
fi
HOSTNAME=`/usr/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ] ; then
export HISTCONTROL=ignoreboth
else
export HISTCONTROL=ignoredups
fi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
umask 002
else
umask 022
fi
for i in /etc/profile.d/*.sh /etc/profile.d/sh.local ; do
if [ -r "$i" ]; then
if [ "${-#*i}" != "$-" ]; then
. "$i"
else
. "$i" >/dev/null
fi
fi
done
unset i
unset -f pathmunge
# ---------------------geomesa-env.sh --------------------
configPriority="0"
existingEnvVars=()
function setvar() {
if [[ "$configPriority" == "0" ]]; then
test -z "$(eval "echo \$$1")" && export $1=$2 || existingEnvVars=("${existingEnvVars[@]}" $1)
else
export $1=$2
fi
}
hadoopCDH="0"
setvar HADOOP_HOME /opt/cloudera/parcels/CDH/lib/hadoop
setvar HADOOP_CONF_DIR /etc/hadoop/conf
hadoopCDH="1"
setvar HADOOP_COMMON_HOME /opt/cloudera/parcels/CDH/lib/hadoop
setvar HADOOP_HDFS_HOME /opt/cloudera/parcels/CDH/lib/hadoop-hdfs
setvar YARN_HOME /opt/cloudera/parcels/CDH/lib/hadoop-yarn
setvar HADOOP_MAPRED_HOME /opt/cloudera/parcels/CDH/lib/hadoop-mapreduce
setvar ZOOKEEPER_HOME /opt/cloudera/parcels/CDH/lib/zookeeper
# ---------------------geomesa-env.sh --------------------
export JAVA_HOME=/usr/java/jdk1.8.0_181-cloudera
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export SCALA_HOME=/usr/local/scala
export MAVEN_HOME=/usr/local/apache-maven-3.6.0
# geomesa-hbase
export ZOOKEEPER_HOME=/opt/cloudera/parcels/CDH/lib/zookeeper
export HADOOP_HOME=/opt/cloudera/parcels/CDH/lib/hadoop
export YARN_HOME=/opt/cloudera/parcels/CDH/lib/hadoop-yarn
export HIVE_HOME=/opt/cloudera/parcels/CDH/lib/hive
export HBASE_HOME=/opt/cloudera/parcels/CDH/lib/hbase
export SPARK_HOME=/opt/cloudera/parcels/CDH/lib/spark
export GEOMESA_HBASE_HOME=/usr/local/geomesa-hbase_2.11-2.4.0
export OOZIE_HOME=/opt/cloudera/parcels/CDH/lib/oozie
export SQOOP_HOME=/opt/cloudera/parcels/CDH/lib/sqoop
export KAFKA_HOME=/opt/cloudera/parcels/CDH/lib/kafka
export SOLR_HOME=/opt/cloudera/parcels/CDH/lib/solr
export IMPALA_HOME=/opt/cloudera/parcels/CDH/lib/impala
export HADOOP_CONF_DIR=/etc/hadoop/conf
export HADOOP_COMMON_HOME=/opt/cloudera/parcels/CDH/lib/hadoop
export HADOOP_HDFS_HOME=/opt/cloudera/parcels/CDH/lib/hadoop-hdfs
export HADOOP_MAPRED_HOME=/opt/cloudera/parcels/CDH/lib/hadoop-mapreduce
export PATH=$PATH:$JAVA_HOME/bin:$CLASSPATH:$MAVEN_HOME/bin:$SCALA_HOME/bin:$ZOOKEEPER_HOME/bin:$HADOOP_HOME/bin:$YARN_HOME/bin
export PATH=$PATH:$HBASE_HOME/bin:$GEOMESA_HBASE_HOME/bin:$HIVE_HOME/bin:$SPARK_HOME/bin:$SPARK_HOME/sbin
export PATH=$PATH:$OOZIE_HOME/bin:$IMPALA_HOME/bin:$IMPALA_HOME/sbin:$SQOOP_HOME/bin:$KAFKA_HOME/bin:$SOLR_HOME/bin
说明:CDH的环境变量配置是非必须的