> 前言:数据库大作业需要使用opengauss数据库支持国产,自己安装过程中菜了蛮多坑,记录一下 # 自己构建 我已经写好了构建脚本,也上传了仓库 可以自己构建 基于openEulr作为底层,使用最新的openGauss 6.0 LTS [xy3xy3/openeuler-openGauss-docker-forstudy: 方便的openGauss安装,用于 中山大学SYSU 数据库系统原理 2022级 刘玉葆老师大作业 (github.com)](https://github.com/xy3xy3/openeuler-openGauss-docker-forstudy/tree/master) > 广告:购买香港服务器季付可以免费搭建一次,公网ip方便多人同时链接,**优惠码 ql75**,[购物车 | 时空云 (skyunhost.cn)](https://www.skyunhost.cn/cart?fid=2&gid=23) # 官方版本 最高支持到5.0.0 ``` version: '3' services: open-gauss: image: opengauss/opengauss:5.0.0 container_name: open-gauss privileged: true environment: - GS_PASSWORD=Sql@114514 ports: - "5432:5432" ``` 测试可以跑 默认账号omm,但是外面链接不进来,普通用户也许可以(?) # 第三方版本 最高支持到5.1 本来使用下面的docker compose ``` version: '3' services: opengauss: image: enmotech/opengauss-lite:latest container_name: opengauss privileged: true environment: GS_PASSWORD: "" # 设置openGauss数据库的密码 ports: - "5432:5432" # 将容器的5432端口映射到主机的5432端口 volumes: - ./data:/var/lib/opengauss/data # 将本地目录 ./data 挂载到容器中的 /var/lib/opengauss/data,用于持久化存储 command: ["-u", "root"] # 使用root用户权限运行 ``` 结果报错: ``` 2024-10-16 11:47:32.410 [unknown] [unknown] localhost 140023970062784 0[0:0#0] 0 [BACKEND] LOG: the configure file /usr/local/opengauss/etc/gscgroup_omm.cfg doesn't exist or the size of configure file has changed. Please create it by root user! 2024-10-16 11:47:32.410 [unknown] [unknown] localhost 140023970062784 0[0:0#0] 0 [BACKEND] LOG: Failed to parse cgroup config file. ``` 查询到 [使用docker启动云和恩墨openGauss镜像报错:user configure file is not found, it will be created. - 墨天轮问答 (modb.pro)](https://www.modb.pro/issue/34947) [DarkAthena](https://www.modb.pro/u/445229) 2024-05-11 直接用docker run是可以一次性启动成功的,如果用docker compose ,会错误地重复执行create user ,但实际上此时数据库已经初始化并启动成功过了,所以首次启动导致退出后,不要清除数据目录,再启动一次容器即可正常启动数据库 [Wesley](https://www.modb.pro/u/615942) ``` 题主 2024-05-11 是这个问题,感谢@DarkAthena,问题已解决 ``` 所以使用docker run就行了 ``` docker run -d --name opengauss --privileged -e GS_PASSWORD="你的密码" -p 5432:5432 -v ./data:/var/lib/opengauss/data enmotech/opengauss-lite:latest -u root ``` 之后还是崩溃 [容器启动失败 · Issue #48 · enmotech/enmotech-docker-opengauss (github.com)](https://github.com/enmotech/enmotech-docker-opengauss/issues/48) 最后用下面方法解决 **[Tokisakix](https://github.com/Tokisakix) **commented [2 days ago](https://github.com/enmotech/enmotech-docker-opengauss/issues/48#issuecomment-2421129818) 命令写错了,`-u` 要放在前面,放在后面会在容器内执行`docker run -d --name opengauss --privileged -e GS_PASSWORD="实际密码" -p 5432:5432 -v ./data:/var/lib/opengauss/data -u root enmotech/opengauss-lite:latest`这条命令测试后没问题 Loading... > 前言:数据库大作业需要使用opengauss数据库支持国产,自己安装过程中菜了蛮多坑,记录一下 # 自己构建 我已经写好了构建脚本,也上传了仓库 可以自己构建 基于openEulr作为底层,使用最新的openGauss 6.0 LTS [xy3xy3/openeuler-openGauss-docker-forstudy: 方便的openGauss安装,用于 中山大学SYSU 数据库系统原理 2022级 刘玉葆老师大作业 (github.com)](https://github.com/xy3xy3/openeuler-openGauss-docker-forstudy/tree/master) > 广告:购买香港服务器季付可以免费搭建一次,公网ip方便多人同时链接,**优惠码 ql75**,[购物车 | 时空云 (skyunhost.cn)](https://www.skyunhost.cn/cart?fid=2&gid=23) # 官方版本 最高支持到5.0.0 ``` version: '3' services: open-gauss: image: opengauss/opengauss:5.0.0 container_name: open-gauss privileged: true environment: - GS_PASSWORD=Sql@114514 ports: - "5432:5432" ``` 测试可以跑 默认账号omm,但是外面链接不进来,普通用户也许可以(?) # 第三方版本 最高支持到5.1 本来使用下面的docker compose ``` version: '3' services: opengauss: image: enmotech/opengauss-lite:latest container_name: opengauss privileged: true environment: GS_PASSWORD: "" # 设置openGauss数据库的密码 ports: - "5432:5432" # 将容器的5432端口映射到主机的5432端口 volumes: - ./data:/var/lib/opengauss/data # 将本地目录 ./data 挂载到容器中的 /var/lib/opengauss/data,用于持久化存储 command: ["-u", "root"] # 使用root用户权限运行 ``` 结果报错: ``` 2024-10-16 11:47:32.410 [unknown] [unknown] localhost 140023970062784 0[0:0#0] 0 [BACKEND] LOG: the configure file /usr/local/opengauss/etc/gscgroup_omm.cfg doesn't exist or the size of configure file has changed. Please create it by root user! 2024-10-16 11:47:32.410 [unknown] [unknown] localhost 140023970062784 0[0:0#0] 0 [BACKEND] LOG: Failed to parse cgroup config file. ``` 查询到 [使用docker启动云和恩墨openGauss镜像报错:user configure file is not found, it will be created. - 墨天轮问答 (modb.pro)](https://www.modb.pro/issue/34947) [DarkAthena](https://www.modb.pro/u/445229) 2024-05-11 直接用docker run是可以一次性启动成功的,如果用docker compose ,会错误地重复执行create user ,但实际上此时数据库已经初始化并启动成功过了,所以首次启动导致退出后,不要清除数据目录,再启动一次容器即可正常启动数据库 [Wesley](https://www.modb.pro/u/615942) ``` 题主 2024-05-11 是这个问题,感谢@DarkAthena,问题已解决 ``` 所以使用docker run就行了 ``` docker run -d --name opengauss --privileged -e GS_PASSWORD="你的密码" -p 5432:5432 -v ./data:/var/lib/opengauss/data enmotech/opengauss-lite:latest -u root ``` 之后还是崩溃 [容器启动失败 · Issue #48 · enmotech/enmotech-docker-opengauss (github.com)](https://github.com/enmotech/enmotech-docker-opengauss/issues/48) 最后用下面方法解决 **[Tokisakix](https://github.com/Tokisakix) **commented [2 days ago](https://github.com/enmotech/enmotech-docker-opengauss/issues/48#issuecomment-2421129818) 命令写错了,`-u` 要放在前面,放在后面会在容器内执行`docker run -d --name opengauss --privileged -e GS_PASSWORD="实际密码" -p 5432:5432 -v ./data:/var/lib/opengauss/data -u root enmotech/opengauss-lite:latest`这条命令测试后没问题 Last modification:October 22, 2024 © Allow specification reprint Like 如果觉得我的文章对你有用,请随意赞赏