告诉我如何将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/pgdata CMD ["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'
但是我遇到了一个错误
“/var/lib/postgresql/data/pgdata”数据目录具有错误的所有权 服务器必须由拥有数据目录的用户启动。
Dockerfile FROM timescale/timescaledb:latest-pg12 ENV POSTGRES_USER=admin POSTGRES_DB=dev-timescaledb POSTGRES_PASSWORD=password PGDATA=/var/lib/postgresql/data/pgdata CMD ["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'
但是我遇到了一个错误
“/var/lib/postgresql/data/pgdata”数据目录具有错误的所有权 服务器必须由拥有数据目录的用户启动。