通过 云和恩墨 发布的 Docker 镜像,可以快速的运行一个 openGauss 环境,支持我们的学习测试。
墨天轮上的朋友们已经整理了很多内容,可以参考:
opengauss docker安装 : https://www.modb.pro/db/27152
opengauss docker从环境搭建到运行: https://www.modb.pro/doc/4656
以下是云和恩墨的测试环境,同学们已经建立了大量的测试环境:
[root@ecs-514e-0004 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
029868a4ecf6 enmotech/opengauss:latest "docker-entrypoint.s…" 43 hours ago Up 43 hours 0.0.0.0:8888->5432/tcp eygle
7bf91f34b43e enmotech/opengauss:latest "docker-entrypoint.s…" 44 hours ago Up 44 hours 0.0.0.0:5555->5432/tcp opengauss5
06271f6f2002 enmotech/opengauss:latest "docker-entrypoint.s…" 44 hours ago Up 44 hours 0.0.0.0:4444->5432/tcp opengauss4
d27c6d3501cf enmotech/opengauss:latest "docker-entrypoint.s…" 44 hours ago Up 44 hours 0.0.0.0:3333->5432/tcp opengauss3
c788a9e2fc86 enmotech/opengauss:latest "docker-entrypoint.s…" 44 hours ago Up 44 hours 0.0.0.0:2222->5432/tcp opengauss2
2164d118eb70 enmotech/opengauss:latest "docker-entrypoint.s…" 44 hours ago Up 44 hours 0.0.0.0:1111->5432/tcp opengauss1
连接到容器中的数据库:
[root@ecs-514e-0004 ~]# docker exec -it 029868a4ecf6 sh
sh-5.0# id
uid=0(root) gid=0(root) groups=0(root)
sh-5.0# su - omm
Last login: Sun Jul 12 10:04:02 CST 2020 on pts/0
Welcome to 4.19.90-2003.4.0.0036.oe1.aarch64
[omm@029868a4ecf6 ~]$ gsql
gsql ((openGauss 1.0.0 build 38a9312a) compiled at 2020-05-27 14:57:08 commit 472 last mr 549 )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
omm=# \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------------------+-----------
gaussdb | | {}
omm | Sysadmin, Create role, Create DB, Replication, Administer audit, UseFT | {}
创建一个新的用户,我们可以看到 openGauss 对于密码安全的要求:
omm=# create user enmotech with password 'enmotech';
ERROR: Password must contain at least three kinds of characters.
omm=#
omm=# create user enmotech with password 'Enm0t3ch';
NOTICE: The encrypted password contains MD5 ciphertext, which is not secure.
CREATE ROLE
创建独立的数据库,给用户授权:
omm=# create database enmotech owner enmotech;
CREATE DATABASE
omm=# GRANT ALL PRIVILEGES ON DATABASE enmotech to enmotech;
GRANT
omm=# ALTER ROLE enmotech CREATEDB;
ALTER ROLE
omm=# GRANT ALL PRIVILEGES TO enmotech;
ALTER ROLE
omm=# \q
使用新的数据库用户连接:
[omm@029868a4ecf6 ~]$ gsql -U enmotech -d enmotech
Password for user enmotech:
gsql ((openGauss 1.0.0 build 38a9312a) compiled at 2020-05-27 14:57:08 commit 472 last mr 549 )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
enmotech=> \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------------------+-----------
enmotech | Sysadmin,Create DB | {}
gaussdb | | {}
omm | Sysadmin, Create role, Create DB, Replication, Administer audit, UseFT | {}
enmotech=>
在容器外连接:
[root@ecs-514e-0004 ~]# gsql -d enmotech -U enmotech -W'Enm0t3ch' -h 192.168.1.94 -p 8888
gsql ((openGauss 1.0 build ec0e781b) compiled at 2020-04-27 17:25:57 commit 2144 last mr 131 )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
enmotech=> \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------------------+-----------
enmotech | Sysadmin,Create DB | {}
gaussdb | | {}
omm | Sysadmin, Create role, Create DB, Replication, Administer audit, UseFT | {}
体验 openGauss 之旅就可以开始了。
最后修改时间:2020-07-13 10:16:03
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。