Skip to content

Docker 安装 OpenGauss

官方文档:https://docs.opengauss.org/zh/docs/latest/docs/InstallationGuide/容器镜像安装.html

shell
docker run --name opengauss --privileged=true -d \
-e GS_PASSWORD=xxxxxx \
-p 5432:5432 \
opengauss/opengauss-server:latest

必选容器内环境变量

-e GS_PASSWORD=xxxxxx:设置数据库超级用户 omm 密码

使用 openGauss 镜像的时候,必须设置该参数,且不能为空或未定义。该参数用于设置 openGauss 数据库的超级用户 omm。安装过程中将默认创建 omm 超级用户,该用户名目前无法更改。

openGauss 镜像配置了本地信任机制,因此在容器内连接数据库时无需密码,但若从容器外部(其它主机或者容器)连接,则必须要输入密码。

可选容器内环境变量

text
-e GS_NODENAME=YourNodeName:指定数据库节点名称,默认为 **gaussdb**
-e GS_USERNAME=YourUserName:指定数据库连接用户名,默认为测试用户 gaussdb
-e GS_USER_PASSWORD=xxxxxx:指定用户 $GS_USERNAME 密码,默认为 $GS_PASSWORD
-e GS_PORT=YourPort:指定容器内数据库端口,默认为 **5432**
-e GS_DB=YourDbName:在容器内创建数据库,默认为 **postgres**

JDBC 连接

使用 postgres 的驱动连接时,数据库为 postgres。

  • 默认节点名:gaussdb
  • 默认数据库:postgres
  • 默认超级用户:omm
  • 默认端口:5432
  • url 示例:jdbc:postgresql://localhost:5432/postgres

使用 postgres 的驱动连接时,数据库为 postgres。