play-ebean icon indicating copy to clipboard operation
play-ebean copied to clipboard

Cannot configure Ebean read replica with Play configuration

Open risenhoover opened this issue 7 months ago • 2 comments

I have been successfully using a read replica with Play Framework 2.7 for years. I am upgrading to Play Framework 2.9 and Ebean 15.1.0 with Play Ebean Plugin 7.3.0.

I have tried two different configurations and with both of them, the default database is recognized and used, but the read replica is not. Here are my two attempts (application.conf):

db.default.driver=org.postgres.Driver
db.default.url='xxxx
db.default.readOnlyUrl='xxx`

db.default.driver=org.postgres.Driver
db.default.url='xxxx

db.readonly.driver=org.postgres.Driver
db.readonly.url='xxxx'
db.readonly.readOnlyDatabase=true

Here is a link to the documentation that shows the 'readOnlyUrl' property in the configuration. https://github.com/ebean-orm/ebean-datasource/blob/master/ebean-datasource-api/src/main/java/io/ebean/datasource/DataSourceConfig.java#L719

Please advise on the proper way to configure a read replica.

risenhoover avatar Jul 28 '25 00:07 risenhoover

This has been crossed posted, refer to https://github.com/ebean-orm/ebean/discussions/3659

rbygrave avatar Jul 28 '25 03:07 rbygrave

Based on conversations with @rbygrave in the ticket references above, it appears that the play-ebean package does not honor the readonlyUrl configuration item and properly build a read replica. I have reopened this issue since it seems important.

risenhoover avatar Jul 29 '25 12:07 risenhoover