简体   繁体   English

如何在设置时更改 postgres docker image wal 级别?

[英]How to change postgres docker image wal level on setup?

I am using the postgres:11.6-alpine image for one of my applications and I would like to set the image wal_level to 'logical' on setup, preferably using docker-compose.我正在为我的一个应用程序使用 postgres:11.6-alpine 图像,我想在设置时将图像 wal_level 设置为“逻辑”,最好使用 docker-compose。

The solutions I found needs you to overwrite the image postgresql.conf.我找到的解决方案需要您覆盖图像 postgresql.conf。 However I dont want to have a full postgresql.conf file just to change this setting.但是,我不想为了更改此设置而拥有完整的 postgresql.conf 文件。

Is there any way I can do this?有什么办法可以做到这一点吗?

Update the command portion of your PostgreSQL container configuration like so.像这样更新 PostgreSQL 容器配置的command部分。

services:
  postgres:
    image: postgres:11.6-alpine
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_DB=my_db
      - POSTGRES_PASSWORD=changeme
    command:
      - "postgres"
      - "-c"
      - "wal_level=logical"

Or或者

    command: [ "postgres", "-c", "wal_level=logical" ]

If you prefer that formatting.如果您更喜欢这种格式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM