File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
content/developer/reference Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -221,6 +221,28 @@ Database
221
221
222
222
port the database listens on, defaults to 5432
223
223
224
+ .. option :: --db_replica_host <hostname >
225
+
226
+ host for the replica server.
227
+
228
+ When set, Odoo will redirect all read-only transactions to the --db_replica_host
229
+
230
+ The status of each request is logged:
231
+
232
+ - Green ``ro ``: request done using a readonly cursor
233
+ - Yellow ``rw ``: request done using a normal read/write cursor
234
+ - Red ``ro->rw ``: requested attempted in readonly but failed due a write query (create/update/delete) and retried with a read/write cursor.
235
+
236
+ You can decorate your model methods with ``@api.readonly ``, when that method will be directly accessed in RPC it's going to open a cursor
237
+ on one of the replica databases instead of the primary one.
238
+
239
+ You can flag your controllers with ``@route(readonly=True) ``, when that controller will be accessed it's gonna open a cursor on the replica.
240
+ Note that for advanced usages you can also give a callback, take example on DataSet._call_kw_readonly.
241
+
242
+ .. option :: --db_replica_port <port >
243
+
244
+ port the replica database listens on, defaults to 5432
245
+
224
246
.. option :: --db-filter <filter >
225
247
226
248
hides databases that do not match ``<filter> ``. The filter is a
You can’t perform that action at this time.
0 commit comments