aws - How to add multiple postgresql connectors to EMR via configuration file

481 Views Asked by At

To add one postgresql connector to presto in AWS EMR, can be achieved with the config file below.

[
    {
        "Classification": "presto-connector-postgresql",
        "Properties": {
            "connection-url": "jdbc:postgresql://<host>:<port>/<database>",
            "connection-user": "<user>",
            "connection-password": "<password>"
        },
        "Configurations": []
    }
]

However, when I attempted to simply add an item to the config file, like so:

[
    {
        "Classification": "presto-connector-postgresql",
        "Properties": {
            "connection-url": "jdbc:postgresql://<host>:<port>/<database>",
            "connection-user": "<user>",
            "connection-password": "<password>"
        },
        "Configurations": []
    },
    {
        "Classification": "presto-connector-postgresql",
        "Properties": {
            "connection-url": "jdbc:postgresql://<host>:<port>/<another-database>",
            "connection-user": "<user>",
            "connection-password": "<password>"
        },
        "Configurations": []
    }

]

Terraform complains: Classification 'presto-connector-postgresql' was specified multiple times.

This can be achieved by manually adding each database in a database.properties file under /etc/presto/conf/catalog folder.

database.properties

connector.name=postgresql
connection-password = <password>
connection-url = jdbc:postgresql://<host>:<port>/<database>
connection-user = <user>

another-database.properties

connector.name=postgresql
connection-password = <password>
connection-url = jdbc:postgresql://<host>:<port>/<another-database>
connection-user = <user>

Just wondering if there is a way to achieve the same goal via the EMR configuration.

0

There are 0 best solutions below