1.环境
CDH 安装完毕 freeipa安装完毕 hosts都做了解析,CDH机器所在的dns解析都要修改为freeipa为第一个
2.CDH节点安装kerberos客户端
yum -y install ipa-client ipa-client-install --domain=baidu.com --no-ntp --realm=BAIDU.COM -mkhomedir
3.查看freeipa节点
4.krb5.conf
还要他
5.freeipa添加用户(添加cloudera-scm用于CDH的大数据认证)
6.生成cloudera-scm用户的keytab(在freeipa机器生成 准备拷贝到CDH的master节点需要用)
7.CDH master节点
###需要将第6步骤 生成的 cloudera-scm.keytab 放在当前目录 (/opt/cloudera/freeipa) mkdir -p /opt/cloudera/freeipa cd /opt/cloudera/freeipa vim getkeytabs.sh #set -e set -x CMKEYTAB="/opt/cloudera/freeipa/cloudera-scm.keytab" CMUSER="cloudera-scm" REALM="BAIDU.COM" IPASERVER="www.baidu.com" DEST="$1" FULLPRINC="$2" # Passwd based kinit #echo PASSWORD | kinit $CMUSER@$REALM # Or per keytab (keytab needs to be generated before) kinit -k -t $CMKEYTAB $CMUSER@$REALM PRINC=$( echo $FULLPRINC | sed "s/\@$( echo $REALM )//" ) echo $PRINC echo Retrieving keytab for $FULLPRINC for $DEST echo Checking for existing service principle if ipa service-find $FULLPRINC; then echo Service principle found else echo Service principle not created, creating ipa service-add $FULLPRINC --pac-type=NONE fi echo Ensuring service allows ipa service-allow-create-keytab --users=$CMUSER $FULLPRINC ipa service-allow-retrieve-keytab --users=$CMUSER $FULLPRINC if ipa service-show $FULLPRINC | grep 'Keytab' | grep 'False'; then echo Creating keytab for $FULLPRINC for $DEST ipa-getkeytab -s $IPASERVER -p $PRINC -k $DEST -e rc4-hmac,aes256-cts,aes128-cts else echo Retrieving keytab for $FULLPRINC for $DEST ipa-getkeytab -r -s $IPASERVER -p $PRINC -k $DEST fi chmod 600 $DEST kdestroy exit 0;
CDH使用freeipa 根据官网得知道需要做一个sed 命令 如下 不然无法集成
sed -i '/kinit/i exit 0' /opt/cloudera/cm/bin/import_credentials.sh