Currently it is only possible to add read replicas for a database at the time of creation using the :ref:`pg_add_source metadata API <pg_add_source>`
..code-block:: http
:emphasize-lines:15-26
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "pg_add_source",
"args": {
"name": "<db_name>",
"configuration": {
"connection_info": {
"database_url": {
"from_env": "<DATABASE_URL_ENV>"
}
},
"read_replicas": [
{
"database_url": {
"from_env": "<DATABASE_REPLICA_URL_ENV>"
},
"pool_settings": {
"retries": 1,
"idle_timeout": 180,
"max_connections": 50
}
}
]
}
..admonition:: For existing v1.3 projects
If you have configured your Postgres instances with replicas, the replica URLs can be added to Hasura using the following environment variable in your project ENV Vars tab: