This is an update of this thread:
NOTE: I assume that you know how to setup Master-Slave database and these configurations are done after you have configured it.
So, after I successfully setup Frappe with Remote Database and created a Master Slave database, I was having problem to connect the Slave database just like in the thread that I linked above.
TL;DR: Replace
"slave_host": "<remote ip>",
"use_slave_for_read_only": 1,
to
"read_from_replica": 1,
"replica_host": "<remote ip>",
Explanation,
After looking at source code of frappe.read_only() , I saw that code checks on site_config.json
if key read_from_replica is True
if conf.read_from_replica:
connect_replica()
But, even here when you look at connect_replica() code, the code looks for replica_host and not slave_host .
Update these values and you are all set. (I think you have to run: bench restart && bench migrate
if I am not mistaken.)
OPTIONAL:
If slave has different user/database name and password then you have to add:
"different_credentials_for_replica": 1,
"replica_db_name": "<replica db name>"
"replica_db_password": "<password>"