官網(wǎng)文檔連接
DataHub Quickstart Guide | DataHub (datahubproject.io)
本文所選擇的Python的版本為3.8.16,Docker版本為20.10.0,Datahub為0.10.5版本
python必須為3.7以上的版本。0.10.5不支持以下的版本
如果要使用web上的 添加數(shù)據(jù)源? 直接調(diào)用的python和pip命令 需要把環(huán)境變量設(shè)置過去。不能用python3
安裝python3
需要注意的一點是datahub需要openssl1.11以上。所以在安裝python3的時候就提前配置好,可以看下這個文檔
python報錯:ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1_Mumunu-的博客-CSDN博客
下載,并解壓Python3安裝包
wget https://www.python.org/ftp/python/3.8.16/Python-3.8.16.tgz
tar -zxvf Python-3.8.11.tgz
下載一堆依賴
yum install -y zlib-devel bzip2-devel \
openssl-devel ncurses-devel epel-release gcc gcc-c++ xz-devel readline-devel \
gdbm-devel sqlite-devel tk-devel db4-devel libpcap-devel libffi-devel
進行Python3的編譯
mkdir /usr/local/python3
cd Python-3.8.16
./configure --prefix=/usr/local/python3
make && make install
然后部署docker
#下載docker-20.10.0包
https://download.docker.com/linux/static/stable/x86_64/docker-20.10.0.tgz
#下載docker-compose對應(yīng)系統(tǒng)的包
curl -SL https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
tar -zxvf docker-20.10.0.tgz
#將解壓出來的docker文件內(nèi)容移動到 /usr/bin/ 目錄下
cp docker/* /usr/bin/
#查看docker版本
docker version
#查看docker信息
docker info
配置docker
配置Docker開機自啟動服務(wù)
#添加docker.service文件
vi /etc/systemd/system/docker.service
#按i插入模式,復(fù)制如下內(nèi)容:
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
#添加文件可執(zhí)行權(quán)限
chmod +x /etc/systemd/system/docker.service
#重新加載配置文件
systemctl daemon-reload
#啟動Docker
systemctl start docker
#查看docker啟動狀態(tài)
systemctl status docker
#查看啟動容器
docker ps
#設(shè)置開機自啟動
systemctl enable docker.service
#查看docker開機啟動狀態(tài) enabled:開啟, disabled:關(guān)閉
systemctl is-enabled docker.service
安裝Datahub
pip3 install acryl-datahub==0.10.5
查看版本情況。
python3 -m datahub version
?接下來是下載鏡像,鏡像較大,一共十幾個GB,需要耐心下載
我們選擇本地讀配置文件啟動
python3 -m datahub docker quickstart --quickstart-compose-file ./docker-compose.consumers-without-neo4j.quickstart.yml
docker-compose -p datahub -f ./docker-compose.consumers-without-neo4j.quickstart.yml up -
這個文件從https://github.com/datahub-project/datahub/tree/master/docker/quickstart
下載
執(zhí)行命令后,如果沒有報錯證明沒有問題。
確認一下有沒有啟動這么多容器。沒有就重啟一次
訪問IP:9002,啟動成功
一些基本命令
#啟動
docker-compose -p datahub -f ./docker-compose.consumers-without-neo4j.quickstart.yml up -
#停止
docker-compose -p datahub -f ./docker-compose.consumers-without-neo4j.quickstart.yml stop
查看有哪些插件
python3 -m datahub check plugins --verbose
缺少插件的時候安裝對應(yīng)插件
pip3 install 'acryl-datahub[數(shù)據(jù)源]'
例如
pip3 install 'acryl-datahub[mysql]'
導(dǎo)入hive元數(shù)據(jù)
首先把部署datahub的機器上添加keyberos客戶端環(huán)境
安裝kerberos客戶端
yum -y install krb5-libs krb5-workstation
同步KDC配置
scp hadoop102:/etc/krb5.conf /etc/krb5.conf
scp hadoop102:/etc/security/keytab/ranger_all_publc.keytab /etc/security/keytab/
驗證能否連接到服務(wù)
kinit -kt /etc/security/keytab/ranger_all_publc.keytab hadoop/hadoop102@ZHT.COM
?配置hive數(shù)據(jù)源就不使用web界面配置了,不然會報錯在kerberos數(shù)據(jù)庫沒有相應(yīng)的授權(quán),猜測應(yīng)該是在datahub的docker環(huán)境中沒有相應(yīng)的授權(quán)
安裝sasl 不然后邊會報錯少這個包
yum install cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-md5
pip install sasl
安裝hive插件
pip install 'acryl-datahub[hive]'
配置hive相應(yīng)的yml 并保存成 hive.yml
source:
type: hive
config:
host_port: xxxx:10000
database: test
username: hive
options:
connect_args:
auth: KERBEROS
kerberos_service_name: hive
scheme: 'hive+https'
sink:
type: "datahub-rest"
config:
server: 'http://IP:8080'
token: 如果有就寫
之后導(dǎo)入python -m datahub --debug ingest -c hive.yml
也可以把debug去掉 。不然日志太多
腳本定時導(dǎo)入hive數(shù)據(jù)
import os
import subprocess
yml_files = [f for f in os.listdir('/root/datalineage') if f.endswith('.yml')]
for file in yml_files:
cmd = f"python3 -m datahub ingest -c {file}"
subprocess.run(cmd, shell=True, check=True)
導(dǎo)入mysql元數(shù)據(jù)
安裝hive插件
pip install 'acryl-datahub[mysql]'
配置相應(yīng)的yml 并保存成 mysql.yml
source:
type: mysql
config:
# Coordinates
host_port: master:3306
database: dolphinscheduler
# Credentials
username: root
password: lovol
# If you need to use SSL with MySQL:
# options:
# connect_args:
# ssl_ca: "path_to/server-ca.pem"
# ssl_cert: "path_to/client-cert.pem"
# ssl_key: "path_to/client-key.pem"
sink:
# sink configs
type: datahub-rest
config:
server: http://slave1:8080
之后導(dǎo)入python -m datahub --debug ingest -c mysql.yml
不過我用這個沒導(dǎo)入成功。我用的web 界面
?文章來源:http://www.zghlxwxcb.cn/news/detail-732528.html
選擇mysql 填入基本信息。都是字面意思。無坑 next 就好了。開始執(zhí)行的時候可以看看日志。查一下是不是有什么問題。注意web直接調(diào)用的python和pip命令 需要把環(huán)境變量設(shè)置過去。不能用python3文章來源地址http://www.zghlxwxcb.cn/news/detail-732528.html
到了這里,關(guān)于元數(shù)據(jù)管理平臺Datahub0.10.5版本安裝部署與導(dǎo)入各種元數(shù)據(jù)手冊的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!