• 元数据管理平台Datahub0.10.5版本安装部署与导入各种元数据手册


    官网文档连接

    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上的 添加数据源  直接调用的python和pip命令 需要把环境变量设置过去。不能用python3

    安装python3

    需要注意的一点是datahub需要openssl1.11以上。所以在安装python3的时候就提前配置好,可以看下这个文档

    python报错:ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1_Mumunu-的博客-CSDN博客

    下载,并解压Python3安装包

    1. wget https://www.python.org/ftp/python/3.8.16/Python-3.8.16.tgz
    2. tar -zxvf Python-3.8.11.tgz

    下载一堆依赖

    1. yum install -y zlib-devel bzip2-devel \
    2. openssl-devel ncurses-devel epel-release gcc gcc-c++ xz-devel readline-devel \
    3. gdbm-devel sqlite-devel tk-devel db4-devel libpcap-devel libffi-devel

    进行Python3的编译

    1. mkdir /usr/local/python3
    2. cd Python-3.8.16
    3. ./configure --prefix=/usr/local/python3
    4. make && make install

    然后部署docker

    1. #下载docker-20.10.0
    2. https://download.docker.com/linux/static/stable/x86_64/docker-20.10.0.tgz
    3. #下载docker-compose对应系统的包
    4. curl -SL https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
    5. chmod +x /usr/local/bin/docker-compose
    1. tar -zxvf docker-20.10.0.tgz
    2. #将解压出来的docker文件内容移动到 /usr/bin/ 目录下
    3. cp docker/* /usr/bin/
    4. #查看docker版本
    5. docker version
    6. #查看docker信息
    7. docker info

    配置docker

    1. 配置Docker开机自启动服务
    2. #添加docker.service文件
    3. vi /etc/systemd/system/docker.service
    4. #按i插入模式,复制如下内容:
    5. [Unit]
    6. Description=Docker Application Container Engine
    7. Documentation=https://docs.docker.com
    8. After=network-online.target firewalld.service
    9. Wants=network-online.target
    10. [Service]
    11. Type=notify
    12. # the default is not to use systemd for cgroups because the delegate issues still
    13. # exists and systemd currently does not support the cgroup feature set required
    14. # for containers run by docker
    15. ExecStart=/usr/bin/dockerd
    16. ExecReload=/bin/kill -s HUP $MAINPID
    17. # Having non-zero Limit*s causes performance problems due to accounting overhead
    18. # in the kernel. We recommend using cgroups to do container-local accounting.
    19. LimitNOFILE=infinity
    20. LimitNPROC=infinity
    21. LimitCORE=infinity
    22. # Uncomment TasksMax if your systemd version supports it.
    23. # Only systemd 226 and above support this version.
    24. #TasksMax=infinity
    25. TimeoutStartSec=0
    26. # set delegate yes so that systemd does not reset the cgroups of docker containers
    27. Delegate=yes
    28. # kill only the docker process, not all processes in the cgroup
    29. KillMode=process
    30. # restart the docker process if it exits prematurely
    31. Restart=on-failure
    32. StartLimitBurst=3
    33. StartLimitInterval=60s
    34. [Install]
    35. WantedBy=multi-user.target
    36. #添加文件可执行权限
    37. chmod +x /etc/systemd/system/docker.service
    38. #重新加载配置文件
    39. systemctl daemon-reload
    40. #启动Docker
    41. systemctl start docker
    42. #查看docker启动状态
    43. systemctl status docker
    44. #查看启动容器
    45. docker ps
    46. #设置开机自启动
    47. systemctl enable docker.service
    48. #查看docker开机启动状态 enabled:开启, disabled:关闭
    49. systemctl is-enabled docker.service

    安装Datahub

    pip3 install acryl-datahub==0.10.5

    查看版本情况。

    python3 -m datahub version

     接下来是下载镜像,镜像较大,一共十几个GB,需要耐心下载

    我们选择本地读配置文件启动

    1. python3 -m datahub docker quickstart --quickstart-compose-file ./docker-compose.consumers-without-neo4j.quickstart.yml
    2. docker-compose -p datahub -f ./docker-compose.consumers-without-neo4j.quickstart.yml up -
    3. 这个文件从https://github.com/datahub-project/datahub/tree/master/docker/quickstart
    4. 下载

    执行命令后,如果没有报错证明没有问题。

    确认一下有没有启动这么多容器。没有就重启一次

    访问IP:9002,启动成功

    一些基本命令

    1. #启动
    2. docker-compose -p datahub -f ./docker-compose.consumers-without-neo4j.quickstart.yml up -
    3. #停止
    4. docker-compose -p datahub -f ./docker-compose.consumers-without-neo4j.quickstart.yml stop
    5. 查看有哪些插件
    6. python3 -m datahub check plugins --verbose
    7. 缺少插件的时候安装对应插件
    8. pip3 install 'acryl-datahub[数据源]'
    9. 例如
    10. pip3 install 'acryl-datahub[mysql]'

    导入hive元数据

    首先把部署datahub的机器上添加keyberos客户端环境

    1. 安装kerberos客户端
    2. yum -y install krb5-libs krb5-workstation
    3. 同步KDC配置
    4. scp hadoop102:/etc/krb5.conf /etc/krb5.conf
    5. scp hadoop102:/etc/security/keytab/ranger_all_publc.keytab /etc/security/keytab/
    6. 验证能否连接到服务
    7. kinit -kt /etc/security/keytab/ranger_all_publc.keytab hadoop/hadoop102@ZHT.COM

     配置hive数据源就不使用web界面配置了,不然会报错在kerberos数据库没有相应的授权,猜测应该是在datahub的docker环境中没有相应的授权

    1. 安装sasl 不然后边会报错少这个包
    2. yum install cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-md5
    3. pip install sasl
    4. 安装hive插件
    5. pip install 'acryl-datahub[hive]'
    6. 配置hive相应的yml 并保存成 hive.yml
    7. source:
    8. type: hive
    9. config:
    10. host_port: xxxx:10000
    11. database: test
    12. username: hive
    13. options:
    14. connect_args:
    15. auth: KERBEROS
    16. kerberos_service_name: hive
    17. scheme: 'hive+https'
    18. sink:
    19. type: "datahub-rest"
    20. config:
    21. server: 'http://IP:8080'
    22. token: 如果有就写
    23. 之后导入python -m datahub --debug ingest -c hive.yml
    24. 也可以把debug去掉 。不然日志太多
    1. 脚本定时导入hive数据
    2. import os
    3. import subprocess
    4. yml_files = [f for f in os.listdir('/root/datalineage') if f.endswith('.yml')]
    5. for file in yml_files:
    6. cmd = f"python3 -m datahub ingest -c {file}"
    7. subprocess.run(cmd, shell=True, check=True)

    导入mysql元数据

    1. 安装hive插件
    2. pip install 'acryl-datahub[mysql]'
    3. 配置相应的yml 并保存成 mysql.yml
    4. source:
    5. type: mysql
    6. config:
    7. # Coordinates
    8. host_port: master:3306
    9. database: dolphinscheduler
    10. # Credentials
    11. username: root
    12. password: lovol
    13. # If you need to use SSL with MySQL:
    14. # options:
    15. # connect_args:
    16. # ssl_ca: "path_to/server-ca.pem"
    17. # ssl_cert: "path_to/client-cert.pem"
    18. # ssl_key: "path_to/client-key.pem"
    19. sink:
    20. # sink configs
    21. type: datahub-rest
    22. config:
    23. server: http://slave1:8080
    24. 之后导入python -m datahub --debug ingest -c mysql.yml

    不过我用这个没导入成功。我用的web 界面

     

    选择mysql 填入基本信息。都是字面意思。无坑 next 就好了。开始执行的时候可以看看日志。查一下是不是有什么问题。注意web直接调用的python和pip命令 需要把环境变量设置过去。不能用python3

  • 相关阅读:
    Golang数组和slice
    【Vivado HLS Bug】Ubuntu环境下Vivado HLS导出IP报错:HLS ERROR: [IMPL 213-28]
    条件分支和循环机制、标志寄存器及函数调用机制
    科研上新 | 第2期:可驱动3D肖像生成;阅读文本密集图像的大模型;文本控制音色;基于大模型的推荐智能体
    彻底透彻Docker常用网络模式及应用场景
    SSM之Spring注解式缓存Redis以及redies中的击穿,雪崩,穿的三种现象
    1-FreeRTOS入门指南
    vue 使用webpack打包,出现路径404 ,导致白屏&webpack-bundle-analyzer使用
    C语言 深度探究C语言中的多字节字符
    微软发布轻量级 VS Code 工具,可完全在浏览器中运行
  • 原文地址:https://blog.csdn.net/h952520296/article/details/132848338