告诉我如何将 PostgreSQL 数据库数据存储在 Azure 存储帐户中。 PostgreSQL 部署到 Azure 容器实例。当我重新启动 Azure 容器实例时,所有数据都会消失。 Dockerfile
FROM timescale/timescaledb:latest-pg12
ENV POSTGRES_USER=admin
POSTGRES_DB=dev-timescaledb
POSTGRES_PASSWORD=password
PGDATA=/var/lib/postgresql/data/pgdataCMD ["postgres", "-c", "max_connections=500"]
创建容器实例并挂载存储帐户的命令
az container create --resource-group test-env --name test-env --image test-env.azurecr.io/timescale:latest --registry-username test-env --registry-password "registry-password" --dns-name-label test-env --ports 5432 --cpu 2 --memory 5 --azure-file-volume-account-name testenv --azure-file-volume-account-key 'account-key' --azure-file-volume-share-name 'postgres-data' --azure-file-volume-mount-path '/var/lib/postgresql/data'
但我收到一个错误
data directory “/var/lib/postgresql/data/pgdata” has wrong ownership The server must be started by the user that owns the data directory.
最佳答案
由于现有问题导致在将 Azure 文件共享挂载到容器实例时无法更改挂载点的所有权。并且目前无法解决。你可以在SO中找到同样的问题。我建议您将 AKS 与 disk volume 一起使用它将解决 Postgres 持久数据的问题。
关于postgresql - 将 Docker PostgreSQL 数据存储到 Azure 存储帐户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63818257/