如何将Docker Hasura连接到多个PostgreSQL数据库?

huangapple go评论51阅读模式
英文:

How to connect Docker Hasura to more multiple Postgre database?

问题

我有一个运行在容器中的Hasura(在Kubernetes内部),我希望这个容器的Hasura能够连接到三个不同的PostgreSQL数据库。是否有办法进行配置,而不使用Hasura控制台网页,因为这与以后的扩展有关。

英文:

Says that I have a Hasura running in Container (inside a Kubernetes) and I want this container hasura to connect to 3 different Postgre databases.

Is there a way to configure this without using Hasura console web page, since this has thing to do with scaling later on.

答案1

得分: 2

你可以使用 pg_add_source API 动态添加新的数据库源到 Hasura。

相反,你可以使用 pg_drop_source 来移除它们。

上述方法适用于动态环境,其中数据库会定期添加和移除。如果它们更加静态,你可能需要考虑通过程序化方式操作元数据文件,然后使用 metadata apply 应用更改。

英文:

You can use the pg_add_source API to dynamically add new Database sources to Hasura.

Conversely, you can use pg_drop_source to remove them.

The above approaches would work in a dynamic environment where Databases are being added and removed reguarly. If they're more static, you might want to consider programatically manipulating the Metadata files and then applying the changes using metadata apply instead.

huangapple
  • 本文由 发表于 2023年2月6日 18:58:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/75360416.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定