studio 2.1.0 版本配置使用tdh-client的方法

  运维必备技能, 原理
内容纲要

概要描述


由于studio2.1版本中workflow跟1.X中区别很大,配置tdh-client的方法也完全不同,1.X中的配置方法可以参考官网的workflow手册。

准备工作


1.本wiki默认不指定executor,即所有executor节点都需要配置准备工作的内容,若只配置一个executor节点,那在脚本中需要指定executor执行。

2.在manager 界面下在tdh-client.tar文件
file

3.把下载的tdh-client.tar文件放到workflow的executor目录下(所有workflow-executor节点都需要放tdh-client文件)

scp ./tdh-client.tar root@xxx.xx.x.xx:/var/log/workflow{$}/workflow-executor/

tips: workflow{$}是指在manager界面安装workflow时workflow的序号,如果安装的workflow是workflow3,那么此处就是workflow3

4.解压tdh-client.tar,所有executor节点的tdh-client都需要解压

cd /var/log/workflow{$}/workflow-executor/

tar -xvf tdh-client.tar

1. 使用tdh-client操作hdfs:

1.把hdfs需要用的到hdfs.keytab放到workflow的executor的日志挂载目录下(同tdh-client在一个目录,所有executor目录下都需要放keytab文件)

cp /etc/hdfs1/conf/hdfs.keytab /var/log/workflow{$}/workflow-executor/

2.脚本内容如下(使用时直接将修改后的脚本内容放入任务流中的shell脚本内即可):

!/bin/bash

if [ grep -c "nameserver" /etc/resolv.conf -eq 0 ];then
echo "nameserver 114.114.114.114" >> /etc/resolv.conf
fi
echo "dns updated"
cat /etc/resolv.conf

———-以上步骤是在为pod配置dns—————-

yum -y install sudo #安装sudo

source /var/log/workflow3/workflow-executor/TDH-Client/init.sh -y
klist -kt /var/log/workflow3/workflow-executor/hdfs.keytab #获取hdfs的principal
hdfsprin=$(klist -kt /var/log/workflow3/workflow-executor/hdfs.keytab | awk ‘{print $4}’ | sed -n ‘4p’)
echo $hdfsprin
kinit $hdfsprin -kt /var/log/workflow3/workflow-executor/hdfs.keytab #kinit 认证
hdfs dfs -ls / #使用hdfs

file

2. 使用tdh-client操作inceptor:

1.脚本内容如下(使用时直接将修改后的脚本内容放入任务流中的shell脚本内即可):

!/bin/bash

if [ grep -c \"nameserver\" /etc/resolv.conf -eq 0 ];then
echo nameserver 114.114.114.114 >> /etc/resolv.conf
fi
echo \"dns updated\"
cat /etc/resolv.conf

———-以上步骤是在为pod配置dns—————-

1.脚本内容如下(使用时直接将修改后的脚本内容放入任务流中的shell脚本内即可):

!/bin/bash

if [ grep -c \"nameserver\" /etc/resolv.conf -eq 0 ];then
echo nameserver 114.114.114.114 >> /etc/resolv.conf
fi
echo \"dns updated\"
cat /etc/resolv.conf

———-以上步骤是在为pod配置dns—————-

yum -y install sudo --enablerepo=transwarp       #安装sudo
source /var/log/workflow3/workflow-executor/TDH-Client/init.sh -y
beeline -u "jdbc:hive2://${inceptor_server}:10000/default;guardianToken=${guardian_token}" -e "select * from ${inceptor_database_name}.task_type_5_1;"    #使用beeline 连接inceptor,此处给出的是使用access token的连接方式;如果使用keytab进行认证,方式同hdfs;如果inceptor使用的是ldap认证,则应该使用beeline -u "jdbc:hive2://xxxx:10000/default" -n  -p 

tips:

${inceptor_server}::inceptor_server地址

${guardian_token}:guardian server 进入获取到的access token

PS:workflow-executor镜像基于centos8,而centos8官方已于2021年底停止服务,导致 source /var/log/workflow3/workflow-executor/TDH-Client/init.sh操作无法成功执行,解决方法为手动修改 init.sh,将其中第107行的 sudo yum install krb5-workstation -y 注释掉

这篇文章对您有帮助吗?

平均评分 0 / 5. 次数: 0

尚无评价,您可以第一个评哦!

非常抱歉,这篇文章对您没有帮助.

烦请您告诉我们您的建议与意见,以便我们改进,谢谢您。