docker-compose启动opengauss数据库——华为“自研”数据库

在这里插入图片描述


 

 


1. 启动数据库

  • yml文件
    创建opengauss目录,里边创建docker-compose.yml文件内容如下:

华为开源数据库,默认5432端口,是不是很熟悉,疑似又是个套壳子的事件。果断用postgres的docker-compose.yml稍作修改

version: "3.1"
services:
opengauss:
image: enmotech/opengauss:latest
environment:
GS_PASSWORD: liubei@161
TZ: Asia/Shanghai
ports:
- 5432:5432
privileged: true
volumes:
- ./opengauss:/var/lib/opengauss/data
restart: always

对,你没看错
postgres的变量POSTGRES_PASSWORD改成GS_PASSWORD就是openGauss的变量了。
之后试了postgres创建默认库的变量 POSTGRES_DB,改成GS_DB就是openGauss的变量。

  • 启动服务
[root@localhost opengauss]# docker-compose up -d
Creating network "opengauss_default" with the default driver
Creating opengauss_opengauss_1 ... done
[root@localhost opengauss]# docker-compose ps
Name Command State Ports
------------------------------------------------------------------------------
opengauss_opengauss_1 entrypoint.sh gaussdb Up 0.0.0.0:5432->5432/tcp

2. 登录

2.1 本地登录

  • 进入opengauss的容器
[root@localhost opengauss]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3267dbb97d2f harbocto.boe.com.cn/public/opengauss:latest "entrypoint.sh gauss…" 11 minutes ago Up 11 minutes 0.0.0.0:5432->5432/tcp opengauss_opengauss_1
[root@localhost opengauss]# docker exec -it 32 bash
  • 切换到omm用户登录
root@3267dbb97d2f:/# su - omm
  • 登录数据库
omm@3267dbb97d2f:~$ gsql
gsql ((openGauss 2.1.0 build 590b0f8e) compiled at 2021-09-30 14:29:04 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
  • 测试sql

大胆用postgres的命令试吧,肯定没毛病

omm=# select version();
version
------------------------------------------------------------------------------------------------------------------------------------------------------
(openGauss 2.1.0 build 590b0f8e) compiled at 2021-09-30 14:29:04 commit 0 last mr on x86_64-unknown-linux-gnu, compiled by g++ (GCC) 7.3.0, 64-bit
(1 row)
omm=# select datname from pg_database;
datname
-----------
template1
omm
template0
postgres
(4 rows)

果然命令都没改,甚至连postgres库都没改。

2.2 远程登录

直接上postgres的客户端,就不信会错

在这里插入图片描述
是不是感觉被骗了,哈哈哈
在这里插入图片描述


在这里插入图片描述

posted on   运维开发玄德公  阅读(352)  评论(0编辑  收藏  举报  

相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2022-06-20 03-查找匹配字串,查找匹配字串位置,正则分组
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示