进入hbase/bin目录
cp hbase.distro hbase.distro-bak //先备份原有文件
vi hbase.distro
切到182行,在add_to_cp_if_exists “${HBASE_HOME}/hbase-server/target” 这里下面加上两行
# Needed for GetJavaProperty check below
add_to_cp_if_exists "${HBASE_HOME}/hbase-server/target/classes"
把下面大概186,187行的
#add the hbase jars for each module
for f in $HBASE_HOME/hbase-jars/hbase*.jar; do
if [[ $f = *sources.jar ]]
then
: # Skip sources.jar
elif [ -f $f ]
then
CLASSPATH=${CLASSPATH}:$f;
fi
done
这部分注释掉
切到大概310行左右,在
if [ -n "${HADOOP_IN_PATH}" ] && [ -f "${HADOOP_IN_PATH}" ]; then
下面加上一段:
# If built hbase, temporarily add hbase-server*.jar to classpath for GetJavaProperty
# Exclude hbase-server*-tests.jar
temporary_cp=
for f in "${HBASE_HOME}"/lib/hbase-server*.jar; do
if [[ ! "${f}" =~ ^.*\-tests\.jar$ ]]; then
temporary_cp=":$f"
fi
done
然后把
HADOOP_JAVA_LIBRARY_PATH=$(HADOOP_CLASSPATH="$CLASSPATH" "${HADOOP_IN_PATH}" \
改成
HADOOP_JAVA_LIBRARY_PATH=$(HADOOP_CLASSPATH="$CLASSPATH${temporary_cp}" "${HADOOP_IN_PATH}" \
即可。
详见附件文件