postgresql - 将 Docker PostgreSQL 数据存储到 Azure 存储帐户

标签 postgresql azure docker azure-container-instances timescaledb

告诉我如何将 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'

但我收到一个错误

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/

相关文章:

sql - 从查询其他 2 个表的结果更新表

c# - 为 Web 部署设置数据库提供程序

azure - Microsoft.Azure.Documents.BadRequestException : ResourceType Document is unexpected

powershell - New-AzureSql.ps1 中的 New-FirewallRuleForWebsite 中出现错误 : Cannot get Azure subscription ID and thumbprint. 失败

mongodb - 使用其他服务启动时,Docker不启动MONGODB,并且IPAddress不出现

mysql - docker : accessing MySQL container during Tomcat image build

sql - 带子字符串的 PostgreSQL 全文搜索

Azure DevOps 变量组未在 Azure 函数配置中应用

docker - Windows中拒绝docker权限

postgres 中的 Php PDO 连接