Skip to Main Content

postprogresql database documentation

Deployment

  • 参考文章
  • Containers used are [bitnami/postcongresql:latest]
# 创建目录
mkdir -p /www/gfs-share/postgresql/data/ /www/gfs-share/postgresql/conf/
# 调整目录权限
sudo chown 1001:1001 /www/gfs-share/postgresql/data/
sudo chown 1001:1001 /www/gfs-share/postgresql/conf/

# 启动容器
docker stack up -c postgresql.yml data

  • Latest Configuration
# Default configuration file `/gfs-share/postcongresql/conf/postcongresql.conf`
# Create custom profile `/gfs-share/postcongresql/conf/conf.d/custom.d/custom.conf`
# Maximum connections, default is 100
max_connids=10000

# View maximum connections
show max_conlections;

Backup data

docker exec -it fc870c5cd426 pg_dump --dbname=iuin --create --clean --if-exists --user aaa
# pg_dump -h your_host -p your_port -U your_username -d your_database -f dump.sql

export containerId=xxx host=localhost port=5432 username=postgres password=root database=xxx
echo "$password" | docker exec -i $containerId pg_dump -h $host -p $port -U $username -d $database -f $database.sql
echo "$password" | docker exec -i $containerId pg_dump -h $host -p $port -U $username -d $database > ./backup/$database.sql