Postgres Key Value Service Configuration

Enabling Postgres for your Application

To enable your application to be backed by postgres, you just need to add DB KVS as a runtime dependency. In gradle this looks like:

runtime 'com.palantir.atlasdb:atlasdb-dbkvs:<atlas version>'

e.g.

runtime 'com.palantir.atlasdb:atlasdb-dbkvs:0.7.0'

Configuring a Running Application to Use Postgres

Warning

If you have multiple products using the same Postgres instance, they must use different databases.

A minimal AtlasDB configuration for running against postgres will look like :

atlasdb:
  keyValueService:
    type: relational
    ddl:
      type: postgres
    connection:
      type: postgres
      host: dbhost
      port: 5432
      dbName: my-unique-db-name # must be unique per product
      dbLogin: palantir
      dbPassword: palantir

  leader:
      # This should be at least half the number of nodes in your cluster
      quorumSize: 2
      learnerLogDir: var/data/paxosLogs
      acceptorLogDir: var/data/paxosLogs
      # This should be different for every node. If ssl is not enabled, then the host must be specified as http
      localServer: https://<yourhost>:3828
      # This should be the same for every node. If ssl is not enabled, then the host must be specified as http
      lockCreator: https://host1:3828
      # This should be the same for every node
      leaders:
        - https://host1:3828 # If ssl is not enabled, then the hosts must be specified as http
        - https://host2:3828
        - https://host3:3828

For more details on the leader block, see Leader Configuration.

Connection parameters

If you would like to customise the JDBC connection parameters, for example if you are experiencing performance issues, then you may supply them under the connection section of the keyValueService config. An example is shown below; for full documentation on which parameters are available, check out the JDBC docs.

atlasdb:
  keyValueService:
    # as above - skipped for brevity
    connection:
      # as above - skipped for brevity
      connectionParameters: # optional JDBC connection parameters
        defaultRowFetchSize: 100 # Default: unlimited. Adjusts the number of rows fetched in each database request.
        ssl: true # specify if using postgres with ssl enabled