docker部署superset并连接华为MRS hive数据库

下载构建源码

这个项目实现了汉化和开箱即用,感谢大佬

GitHub - lutinglt/superset-zh: Superset 汉化, Superset 中文版

替换国内apt源

查看debian版本,不同版本替换apt源的内容不同

cat /etc/debian_version

我这里是11.9版本

  • apt源文件sources.list位置在/etc/apt/sources.list下

  • 阿里源官网:https://developer.aliyun.com/mirror/debian?spm=a2c6h.13651102.0.0.509b1b11NQaUy0

这里是debian 11.x版本apt源的汇总

# ===============================清华源===================================
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free

# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
deb https://security.debian.org/debian-security bullseye-security main contrib non-free
# deb-src https://security.debian.org/debian-security bullseye-security main contrib non-free

# ===============================阿里源===================================
deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib

# ===============================原版===================================
# deb http://snapshot.debian.org/archive/debian/20240423T150000Z bullseye main
deb http://deb.debian.org/debian bullseye main
# deb http://snapshot.debian.org/archive/debian-security/20240423T150000Z bullseye-security main
deb http://deb.debian.org/debian-security bullseye-security main
# deb http://snapshot.debian.org/archive/debian/20240423T150000Z bullseye-updates main
deb http://deb.debian.org/debian bullseye-updates main

在Dockerfile所在目录下新建一个sources.list文件,选择清华源或阿里源复制过去

修改Dockerfile

修改如下:

基础镜像替换为apache/superset:3.1.3-py39

替换apt国内源

添加sasl相关依赖

添加kinit、klis等命令

添加vim、ping、telnet命令

添加pyhive[hive]、sasl等依赖库

添加ez_setup、setuptools等工具

# 构建翻译文件(请勿替换FROM)
FROM python:3.12.6-slim-bookworm AS builder
CO
### 部署国产数据库Docker实践 国产数据库如 OceanBase、openGauss 和 达梦数据库(DM)等,都可以通过 Docker 快速部署和运行。以下是基于不同数据库部署方法。 #### 部署 OceanBase 数据库Docker部署 OceanBase 数据库时,首先需要确保 Docker 已安装正常运行。然后通过以下命令下载 OceanBase 社区版镜像启动容器: ```bash docker run --name oceanbase -d -p 2881:2881 -p 2882:2882 -p 2883:2883 \ -e OB_CLUSTER_NAME=test \ -e OB_ADMIN_PASSWORD=admin \ -v /opt/oceanbase:/data \ oceanbase-ce/oceanbase:latest ``` 部署完成后,可以通过 `docker logs` 命令检查容器日志以确认数据库是否启动成功。OceanBase 支持多租户架构,部署完成后可以连接到不同的租户进行数据库操作[^1]。 #### 部署 openGauss 数据库 openGauss 是由华为推出的开源关系型数据库,支持单节点和主从复制部署模式。以下是一个典型的单节点部署命令: ```bash docker run -d --name opengauss \ --privileged=true \ -p 5432:5432 \ -e GS_PASSWORD=secretpassword@123 \ enmotech/opengauss:3.0.0 ``` 如果需要支持远程访问,可以将容器的 5432 端口映射到主机的其他端口,例如映射到主机的 8888 端口: ```bash docker run --name opengauss --privileged=true -d \ -e GS_PASSWORD=secretpassword@123 \ -p 8888:5432 \ enmotech/opengauss:3.0.0 ``` 为了实现主从复制架构,可以使用自定义脚本进行容器创建和配置,确保主从节点之间的数据同步和高可用性[^2]。 #### 部署达梦数据库 达梦数据库是一款国产商业数据库,同样可以通过 Docker 快速部署。以下是一个部署命令示例,映射多个端口挂载数据目录: ```bash docker run -d --name jemdm8 \ -h jemdm8 \ -p 52360-52364:5236-5240 \ -p 58080:8080 \ -p 53389:3389 \ -v /sys/fs/cgroup:/sys/fs/cgroup \ --privileged=true \ techerwang/dbhub:jem_dm8 \ /usr/sbin/init ``` 此命令将达梦数据库的多个服务端口映射到主机,便于外部访问和管理。 #### 连接数据库 部署完成后,可以使用命令行工具或图形界面工具连接数据库。例如,使用 `gsql` 连接 openGauss 数据库: ```bash gsql -d postgres -U gaussdb -W 'C*x#1a2b' -h 127.0.0.1 -p 5432 ``` 对于 OceanBase,可以使用 MySQL 客户端连接: ```bash mysql -h 127.0.0.1 -P 2881 -u root@test -p ``` 如果使用 SQLyog 或其他图形工具连接数据库,需要确保数据库端口已正确映射,配置相应的连接参数[^4]。 #### 检查容器状态和日志 部署数据库容器后,可以通过以下命令检查容器状态和日志: ```bash docker ps -a docker logs <container_id> ``` 这些命令可以帮助确认数据库是否正常启动,排查可能的错误。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值