简体   繁体   English

如何在我的 postgres 图像中更正 set work_mem amd max_wal_size

[英]How to correct set work_mem amd max_wal_size in my postgres image

I want to set to my postgres image some configuration, need increas work_mem and max_wal_size , but faced with error我想为我的 postgres 图像设置一些配置,需要增加 work_mem 和max_wal_size ,但遇到错误

/usr/local/bin/docker-entrypoint.sh: line 315: exec: postgres -c max_wal_size=2GB -c work_mem=2GB: not found

varsions版本

Docker version 19.03.8, build afacb8b7f0
docker-compose version 1.23.1, build b02f1306

and my docker compose和我的 docker 撰写

version: '3'
services:

postgres:
    image: postgres:11-alpine
    shm_size: 5g
    command: postgres -c max_wal_size=2GB -c work_mem=2GB
    ports:
        - '5432:5432'
    container_name: 'postgresql_alpine'
    working_dir: /app
    restart: always
    environment:
        POSTGRES_DB: ${POSTGRES_DB}
        POSTGRES_USER: ${POSTGRES_USER}
        POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
        LC_COLLATE: 'sv_SE.UTF-8'
        LC_CTYPE: 'sv_SE.UTF-8'
    volumes:
        - ./data/postgresql:/var/lib/postgresql/data
    networks:
        - php

and error和错误

ivan@ivan-laptop:~/hosts/docker-symfony$ docker logs d30c27661a48
/usr/local/bin/docker-entrypoint.sh: line 315: exec: postgres -c max_wal_size=2GB -c work_mem=2GB: not found

how to correct set work_mem amd max_wal_size in my postgres image?如何在我的 postgres 图像中更正 set work_mem amd max_wal_size?

RESOLVE First I remove dir data/postgres and create again, then I removed all解决首先我删除目录data/postgres并重新创建,然后我删除所有

docker system prune -a --volumes

images and rebuilded and up again图像并重建并重新启动

Default postgres Docker image entrypoint takes parameters directly, you should omit postgres in the command sequence.默认 postgres Docker 图像入口点直接带参数,您应该在命令序列中省略postgres

version: '3'

services:
  postgres:
    image: postgres:12-alpine
    ...
    command: >
      -c work_mem=256MB
      -c maintenance_work_mem=256MB
      -c max_wal_size=1GB
    ...

I want to set to my postgres image some configuration, need increas work_mem and max_wal_size , but faced with error我想为我的 postgres 图像设置一些配置,需要增加 work_mem 和max_wal_size ,但遇到错误

/usr/local/bin/docker-entrypoint.sh: line 315: exec: postgres -c max_wal_size=2GB -c work_mem=2GB: not found

varsions变种

Docker version 19.03.8, build afacb8b7f0
docker-compose version 1.23.1, build b02f1306

and my docker compose和我的 docker 组成

version: '3'
services:

postgres:
    image: postgres:11-alpine
    shm_size: 5g
    command: postgres -c max_wal_size=2GB -c work_mem=2GB
    ports:
        - '5432:5432'
    container_name: 'postgresql_alpine'
    working_dir: /app
    restart: always
    environment:
        POSTGRES_DB: ${POSTGRES_DB}
        POSTGRES_USER: ${POSTGRES_USER}
        POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
        LC_COLLATE: 'sv_SE.UTF-8'
        LC_CTYPE: 'sv_SE.UTF-8'
    volumes:
        - ./data/postgresql:/var/lib/postgresql/data
    networks:
        - php

and error和错误

ivan@ivan-laptop:~/hosts/docker-symfony$ docker logs d30c27661a48
/usr/local/bin/docker-entrypoint.sh: line 315: exec: postgres -c max_wal_size=2GB -c work_mem=2GB: not found

how to correct set work_mem amd max_wal_size in my postgres image?如何在我的 postgres 图像中更正 set work_mem amd max_wal_size?

RESOLVE First I remove dir data/postgres and create again, then I removed all解决首先我删除 dir data/postgres并再次创建,然后我删除了所有

docker system prune -a --volumes

images and rebuilded and up again图像并重新构建并重新启动

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

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