cloudbeaver配置上达梦驱动

举报
Rui@localhost 发表于 2024/11/15 10:31:59 2024/11/15
【摘要】 cloudbeaver容器配置上达梦驱动,使其连接达梦数据库

一、修改容器配置

运行容器

这里的cloudbeaver版本是:24.0.2

docker run -it -d --name cloudbeaver -p 1234:8978 dbeaver/cloudbeaver

将容器的这两个jar文件复制出来

image.png

docker cp cloudbeaver:/opt/cloudbeaver/server/plugins/org.jkiss.dbeaver.ext.generic_2.3.214.202404080822.jar /opt/cloudbeaver/

docker cp cloudbeaver:/opt/cloudbeaver/server/plugins/io.cloudbeaver.resources.drivers.base_1.0.95.202404080822.jar /opt/cloudbeaver/

修改jar包

io.cloudbeaver.resources.drivers.base_1.0.95.202404080822.jar

直接使用vim工具,对jar内的文件plugin.xml进行修改
image.png

<resource name="drivers/dm"/>
image.png

<bundle id="drivers.dm" label="DM drivers"/>
image.png

<driver id="generic:dm"/>
image.png

org.jkiss.dbeaver.ext.generic_2.3.214.202404080822.jar

直接使用vim工具,对jar内的文件plugin.xml进行修改
在任意<driver></driver>标签位置的前或后添加以下信息

        <!-- 达梦数据库连接信息配置 -->
        <driver
                id="dm"
                label="DM"
                icon="icons/sap_maxdb_icon.png"
                iconBig="icons/sap_maxdb_icon_big.png"
                class="dm.jdbc.driver.DmDriver"
                sampleURL="jdbc:dm://{host}[:{port}]/[{daStabase}]"
                defaultPort="5236"
                webURL="https://www.dameng.com/"
                description="达梦数据库连接选项!">
            <file type="jar" path="drivers/dm" bundle="drivers.dm"/>
        </driver>

image.png

将修改后的文件替换容器内的文件


docker cp /opt/cloudbeaver/org.jkiss.dbeaver.ext.generic_2.3.214.202404080822.jar cloudbeaver:/opt/cloudbeaver/server/plugins/org.jkiss.dbeaver.ext.generic_2.3.214.202404080822.jar

docker cp /opt/cloudbeaver/io.cloudbeaver.resources.drivers.base_1.0.95.202404080822.jar  cloudbeaver:/opt/cloudbeaver/server/plugins/io.cloudbeaver.resources.drivers.base_1.0.95.202404080822.jar 

复制dm8的驱动进容器

docker exec -it cloudbeaver  mkdir -p /opt/cloudbeaver/drivers/dm/
docker cp DmJdbcDriver18.jar cloudbeaver:/opt/cloudbeaver/drivers/dm/

重启容器

docker restart cloudbeaver

配置成功

image.png

二、制作cloudbeaver达梦镜像

[root@jdhzweb96 cloudbeaver]# pwd
/opt/cloudbeaver

# 目录下的相关文件
[root@jdhzweb96 cloudbeaver]# ll
total 1851516
-rw-r--r-- 1 root root      3294 Nov 12 12:00 cloudbeaver.conf
-rw------- 1 root root 724022272 Nov 11 22:35 dbeaver-cloudbeaver-latest.tar
-rwxr-xr-x 1 root root   1398918 Jun 21 13:39 DmJdbcDriver18.jar
-rw-r--r-- 1 root root     18481 Nov 12 10:20 dm.png
-rw-r--r-- 1 root root       231 Nov 12 12:03 docker-compose.yaml
-rw-r--r-- 1 root root       513 Nov 12 12:38 Dockerfile
-rw-r--r-- 1 root root      1260 Nov 12 10:08 io.cloudbeaver.resources.drivers.base_1.0.95.202404080822.jar
-rw-r--r-- 1 root root   1048155 Nov 12 10:23 org.jkiss.dbeaver.ext.generic_2.3.214.202404080822.jar
drwxr-xr-x 6 root root      4096 Apr 20  2024 workspace
[root@jdhzweb96 cloudbeaver]# 

# 查看构建文件
[root@jdhzweb96 cloudbeaver]# cat Dockerfile 
FROM dbeaver/cloudbeaver

WORKDIR /opt/cloudbeaver/

# 替换相关文件
COPY org.jkiss.dbeaver.ext.generic_2.3.214.202404080822.jar /opt/cloudbeaver/server/plugins/
COPY io.cloudbeaver.resources.drivers.base_1.0.95.202404080822.jar /opt/cloudbeaver/server/plugins/
COPY DmJdbcDriver18.jar /opt/cloudbeaver/drivers/dm/
COPY cloudbeaver.conf /opt/cloudbeaver/conf


ENTRYPOINT ["./run-server.sh"]

构建镜像

docker build -t cloudbeaver-dm:24.0.2 .

三、k8s部署

创建Deployment配置文件cloudbeaver-dm.yaml

apiVersion: apps/v1
kind: Deployment
metadata: 
  name: cloudbeaver-dm
  namespace: rui-app-ns
  labels: 
    app: cloudbeaver-dm
spec: 
  replicas: 1
  selector: 
    matchLabels:
      app: cloudbeaver-dm
  template:
    metadata: 
      labels: 
        app: cloudbeaver-dm
    spec:
      containers:
      - name: cloudbeaver-dm
        image: xxxx.com/rui-app/cloudbeaver-dm:24.0.2
        ports: 
          - containerPort: 8978
      imagePullSecrets:
      - name: harbor-secret-login
      dnsPolicy: ClusterFirst
      restartPolicy: Always
--- 
apiVersion: v1
kind: Service
metadata: 
  name: cloudbeaver-dm
  namespace: rui-app-ns
spec:
  type: ClusterIP
  selector: 
    app: cloudbeaver-dm
  ports:
    - port: 8978
      targetPort: 8978

部署Deployment文件

kubectl apply -f cloudbeaver-dm.yaml

配置nginx文件

        location /cloudbeaver/ {
            proxy_pass http://cloudbeaver-dm.rui-app-ns:8978/cloudbeaver/;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header REMOTE-HOST $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

访问网页

参考文档: https://blog.csdn.net/weixin_42675423/article/details/135662123

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。