Database replication

Database replication is tricky to set up and maintain. RestAuth provides two Database routers that should help you with the most common replication situations. If you desire more information, please consult the Multiple databases chapter in the Django documentation.

Warning

Only use database routers when you actually use multiple databases. Adding a router does introduce a (negligible) performance overhead.

Using database routers

To use a database router (you can either write your own or use an existing one), simply add it to the DATABASE_ROUTERS setting in localsettings.py. For example, if you want to use our MasterSlave router, simply add:

DATABASE_ROUTERS = ['RestAuth.common.routers.MasterSlave']

Note

Routers shipping with RestAuth are not intended to be used together with other routers. If you require a more complex database routing schema you can either:

  • File a feature request if you think this is a common scheme that will be used by others, or
  • implement it yourself

Implementing your own routers

You can also implement your own router if you require a more complex configuration. Writing routers is documented in in the Django documentation and requires you to be able to code in Python.

Existing database routers

Table Of Contents

Previous topic

Running multiple instances

Next topic

restauth-service

This Page