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 2023-06-20 23:12 运维开发玄德公 阅读(352) 评论(0) 编辑 收藏 举报 来源
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2022-06-20 03-查找匹配字串,查找匹配字串位置,正则分组