How do I set up database replication?

Hi, I am trying to create multi-region multi-appliance setup with euwe-1 and do not know where to even start. I have started appliance1, and created region 99 on it. I have started appliance2 and created region 0 on it. Then, reading Redhat cloudforms documentation:

  • Add replication worker settings pointing to the VMDB for Region 99.
  • Enable Database Synchronization Server role on one Server in the Region. If you have a second Server in the same region, do not enable the DB Synchronization role. Do not enable more than one Database Synchronization Role per Region

First, I do not seem to have a DB Synchronization server role in euwe. Second, I could not find anywhere how to add replication worker settings.
appliance_console on euwe has ‘Configure replication’ option where I can configure ‘Primary’ and ‘Standby’ servers. I think this might be intra-region DB replication, but I am not sure.
Region settings in web UI has ‘Replication’ option where I can configure it as ‘remote’ or ‘global’. Sounds promising, but I am not sure what region 99 should be, and what region 0 should be.
Is there any documentation on how to actually configure DB synchronization?
Thank you very much.

Hello @sgenchev,

We changed the mechanism for replication recently. Previously we used rubyrep library (that needs worker as described in the docs). In darga we offered both (old & new) replication mechanisms. From now on (euwe+), we use pglogical.

IIRC. Region 99 is the one you replicate to. That is the global. Regions 1-98 are remotes to the global region. With central admin features, you can think of global ruling remotes.

@carbonin did all the heavy lifting to make this work.

It seems some of the documentation has not been completely updated.

Can you link the the docs you found that are telling you to configure the replication worker for the Euwe version?

Although some of this doc also looks like it needs updating this section of the CloudForms documentation should explain what needs to be done.

@isimluk is also correct in his description. Although the numbering is just a convention, it is common to use region 99 for the global region (where all other regions replicate to). The other regions would be considered “remote”

Thank you very much.
@crbonin I am stupid, and looked at replication options for older version.
I still do not seem to get far though. On remote database I have created a new user(role), and granted all privileges to vmdb_production, the only DB there. I checked, and I can log in as this user remotely. When I try to set up Global replication, enter vmdb_production as database, and username/password that I know works, I get

Error during replication configuration save: Failed to save subscription to PG::InsufficientPrivilege: ERROR: permission denied for relation miq_databases_id_seq : SELECT last_value FROM miq_databases_id_seq

Looks like I am close, but missing a permission somewhere. Where should I look?
Thank you!

@sgenchev There’s no technical reason that you have to create a new user. You should be able to use the same database user that the app uses to connect (typically “root”) with the password you set up when you initially installed the database.

If you really do need a new user, may be of some help.

Raised documentation update request BZ#1460175