默认情况下,使用datahub docker quickstart
会部署最新版本的datahub,但实际使用时,需要部署指定版本的Datahub,如何做呢?
有如下两种方式可以实现此目标:
dockerhub的docker image地址: https://hub.docker.com/u/linkedin
基于docker-compose
安装步骤
- 下载指定版本的源代码,如 datahub-0.8.24.zip,解压到指定目录,如
/opt/datahub
- 确定要使用的docker-compose配置文件的
- docker-compose.quickstart.yml 使用neo4j作为元数据图的存储并提供图查询服务
- docker-compose-without-neo4j.quickstart.yml 使用elasticsearch作为元数据图的存储并提供图查询服务
- 设置环境变量
- vi ~/.bashrc,在文件中追加
export DATAHUB_VERSION=v0.8.24
- 刷新环境变量
source ~/.bashrc
- vi ~/.bashrc,在文件中追加
- 复制docker-compose配置文件
cd /opt/datahub
cp datahub-0.8.24/docker/quickstart/docker-compose-without-neo4j.quickstart.yml ./docker-compose.yml
- 安装Datahub:创建并启动容器
docker-compose -p datahub up -d --remove-orphans
- datahub的启停【修改docker-compose文件,将elasticsearch-setup、kafka-setup、mysql-setup服务删除】
- 启动
docker-compose -p datahub start
- 停止
docker-compose -p datahub stop
- 启动
查看container列表
docker ps --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}\t{{.Status}}"
docker ps --format "table {{.Image}}\t{{.Names}}\t{{.Ports}}\t{{.Status}}"
基于datahub docker
安装步骤
dockerhub docker CLI 工具提供了quickstart命令,可以快速安装datahub。此命令对docker-compose进行了封装
安装Datahub的步骤 与基于docker-compose的操作类似,区别如下
- 复制docker-compose配置文件
cd /opt/datahub
cp datahub-0.8.24/docker/quickstart/docker-compose-without-neo4j.quickstart.yml ./docker-compose.yml
- 安装Datahub:
datahub docker quickstart --version v0.8.24 --quickstart-compose-file docker-compose.yml
命令运行结果如下:
datahub docker quickstart命令参数
使用方式可以通过datahub docker quickstart --help
查看详细参数,
Usage: datahub docker quickstart [OPTIONS]
Start an instance of DataHub locally using docker-compose.
This command will automatically download the latest docker-compose configuration from GitHub, pull the latest
images, and bring up the DataHub system. There are options to override the docker-compose config file, build the
containers locally, and dump logs to the console or to a file if something goes wrong.
Options:
--version TEXT Datahub version to be deployed. If not set, deploy latest
--build-locally Attempt to build the containers locally before starting
--quickstart-compose-file FILE Use a local docker-compose file instead of pulling from GitHub
--dump-logs-on-failure If true, the docker-compose logs will be printed to console if something fails
--graph-service-impl TEXT If set, forces docker-compose to use that graph service implementation
--help Show this message and exit.
查看安装的组件
查看elasticsearch信息
https://www.elastic.co/guide/en/elasticsearch/reference/7.9/cat.html
# 查看集群信息
http://172.25.21.188:9200/_cat/health?v
# 查看节点情况
http://172.25.21.188:9200/_cat/nodes?v
# 查看索引信息
http://172.25.21.188:9200/_cat/indices?bytes=b&s=store.size:desc&v
http://172.25.21.188:9200/_cat/indices?v
查看mysql信息
jdbc-url: jdbc:mysql://172.25.21.188:3306/datahub?verifyServerCertificate=false&useSSL=true&useUnicode=yes&characterEncoding=UTF-8
username: datahub
password: datahub
docker exec -it mysql /usr/bin/mysql datahub --user=datahub --password=datahub
查看kafka信息
topic _schemas
是schema-registry使用的,用于跟踪元数据Schema的变化
docker exec -it b536476ec45e /bin/bash
kafka-topics --bootstrap-server broker:29092 --list
kafka-consumer-groups --bootstrap-server broker:29092 --list
kafka-consumer-groups --bootstrap-server broker:29092 --describe --all-group
kafka-consumer-groups --bootstrap-server broker:29092 --describe --all-groups --members