zookeeper-3.4.8配置kerberos详解大数据

ZooKeeper跟Hadoop Core、HBase有什么关系呢?ZooKeeper都提供了哪些服务呢?主要有:管理Hadoop集群中的NameNode,HBase中HBaseMaster的选举,Servers之间状态同步等。具体一点,细一点说,单只HBase中ZooKeeper实例负责的工作就有:存储HBase的Schema,实时监控HRegionServer,存储所有Region的寻址入口,当然还有最常见的功能就是保证HBase集群中只有一个Master。

ZooKeeper服务不认Ip,只认主机名,因此需要在/etc/hosts文件里增加一个ZooKeeper服务的IP地址与本机主机名的配置。如:10.5.31.10 amber-mts如果不配置,Zookerper会绑定到locahost的主机名,远程就不能链接。

zookeeper配置kerberos:https://yq.aliyun.com/articles/25626

修改zookeeper启动日志的输出位置:

修改bin/zkEnv.sh, 请留意红色加粗处, 这时日志已经可以成功按照你设置的目录进行输出了

#!/usr/bin/env bash 
# 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. 
# This script should be sourced into other zookeeper 
# scripts to setup the env variables 
# We use ZOOCFGDIR if defined, 
# otherwise we use /etc/zookeeper 
# or the conf directory that is 
# a sibling of this script's directory 
 
ZOOBINDIR="${ZOOBINDIR:-/usr/bin}" 
ZOOKEEPER_PREFIX="${ZOOBINDIR}/.." 
if [ "x$ZOOCFGDIR" = "x" ] 
then 
if [ -e "${ZOOKEEPER_PREFIX}/conf" ]; then 
  ZOOCFGDIR="$ZOOBINDIR/../conf" 
else 
  ZOOCFGDIR="$ZOOBINDIR/../etc/zookeeper" 
fi 
fi 
if [ -f "${ZOOCFGDIR}/zookeeper-env.sh" ]; then 
. "${ZOOCFGDIR}/zookeeper-env.sh" 
fi 
if [ "x$ZOOCFG" = "x" ] 
then 
  ZOOCFG="zoo.cfg" 
fi 
ZOOCFG="$ZOOCFGDIR/$ZOOCFG" 
if [ -f "$ZOOCFGDIR/java.env" ] 
then 
  . "$ZOOCFGDIR/java.env" 
fi 
if [ "x${ZOO_LOG_DIR}" = "x" ] 
then 
  ZOO_LOG_DIR="/apps/logs/zookeeper" 
fi 
if [ "x${ZOO_LOG4J_PROP}" = "x" ] 
then 
  ZOO_LOG4J_PROP="INFO,ROLLINGFILE" 
fi 
if [ "$JAVA_HOME" != "" ]; then 
JAVA="$JAVA_HOME/bin/java" 
else 
JAVA=java 
fi 
#add the zoocfg dir to classpath 
CLASSPATH="$ZOOCFGDIR:$CLASSPATH" 
for i in "$ZOOBINDIR"/../src/java/lib/*.jar 
do 
  CLASSPATH="$i:$CLASSPATH" 
done 
#make it work in the binary package 
#(use array for LIBPATH to account for spaces within wildcard expansion) 
if [ -e "${ZOOKEEPER_PREFIX}"/share/zookeeper/zookeeper-*.jar ]; then 
LIBPATH=("${ZOOKEEPER_PREFIX}"/share/zookeeper/*.jar) 
else 
#release tarball format 
for i in "$ZOOBINDIR"/../zookeeper-*.jar 
do 
  CLASSPATH="$i:$CLASSPATH" 
done 
LIBPATH=("${ZOOBINDIR}"/../lib/*.jar) 
fi 
for i in "${LIBPATH[@]}" 
do 
  CLASSPATH="$i:$CLASSPATH" 
done 
#make it work for developers 
for d in "$ZOOBINDIR"/../build/lib/*.jar 
do 
CLASSPATH="$d:$CLASSPATH" 
done 
#make it work for developers 
CLASSPATH="$ZOOBINDIR/../build/classes:$CLASSPATH" 
case "`uname`" in 
  CYGWIN*) cygwin=true ;; 
  *) cygwin=false ;; 
esac 
if $cygwin 
then 
  CLASSPATH=`cygpath -wp "$CLASSPATH"` 
fi 
#echo "CLASSPATH=$CLASSPATH

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/9529.html

(0)
上一篇 2021年7月19日
下一篇 2021年7月19日

相关推荐

发表回复

登录后才能评论