Carbonio HA Configuration#

The main part of the installation is the set up of the HA infrastructure, which will be built on the scenario described in the previous section.

In order to complete the HA configuration, you need access to the Ansible’s Control Node and of the following items:

  1. The inventory file you used in previous section, which you must edit according to the directions you will find in the reainder of this page

  2. The following Ansible Galaxy Collections: carbonio_kafka, carbonio_patroni, and carbonio_ldap that you can install with command

    # ansible-galaxy collection install zxbot.carbonio_kafka
    # ansible-galaxy collection install zxbot.carbonio_patroni
    # ansible-galaxy collection install zxbot.carbonio_ldap
    

Prepare inventory#

After the standard Carbonio installation has completed successfully, you should have the following inventory files:

  • inventory

  • inventory_postgrespassword

  • inventory_ldap_passoword

  • inventory_consulpassword

  • inventory_videoserver (only if video server was installed)

To configure the inventory for HA installation, you will need to add new groups and add specific variables to the inventory file. Please read the following advises if you plan to add the HA infrastructure to different Node than the one we will use in the remainder of the scenario.

Guidelines for Roles in HA Configuration

The initial Roles assigned during the standard installation (i.e., as master for LDAP or primary for PostgreSQL) should remain on the servers that were configured in the standard installation. Some services and configurations have already been initialised based on this setup, so:

  • Do not assign the master role (for LDAP) or the primary role (for PostgreSQL) to any additional servers being configured as extra masters.

  • If you plan to add extra master servers, configure them with roles mmr for Directory Server and secondary for PostgreSQL in the HA inventory file.

This approach ensures that the pre-existing configurations and initializations remain stable and compatible with the HA deployment.

The two new groups to add at the bottom of the file are:

  1. kafka group, which will point to the Nodes where kafka will be installed: these are the three Cluster Nodes. To each Node, add the broker_id variable with a different value:

    #kafka group
    [kafka]
    svc1.example.com broker_id=1
    svc2.example.com broker_id=2
    svc3.example.com broker_id=3
    
  2. zookeeper_servers group, which will point to the Nodes where zookeper will be installed: these are the three Cluster Nodes. To each Node, add the zookeeper_id variable with a different value:

    #zookeeper_servers group
    [zookeeper_servers]
    svc1.example.com zookeeper_id=1
    svc2.example.com zookeeper_id=2
    svc3.example.com zookeeper_id=3
    

You need also to add variable to existing groups.

  1. To the postgresServers group you need to add two variables: postgres_version is the PostgreSQL version (16), and patroni_role can be set to primary for initial master or secondary for new extra master:

    #postgresServers group
    [postgresServers]
    svc1.example.com postgres_version=16 patroni_role=primary
    svc2.example.com postgres_version=16 patroni_role=secondary
    
  2. The variable ldap_role must be added to the masterDirectoryServers group, and can assume the values master for initial master or mmr for new extra master

    #masterDirectoryServers group
    [masterDirectoryServers]
    svc1.example.com ldap_role=master
    svc2.example.com ldap_role=mmr
    
  3. The dbsConnectorServers group must be filled out. DB Connectors will be moved from Postgres server to servers in [dbsConnectorServers] for HA. In our scenario we move them to the Node hosting the Mailstore & Provisioning Role:

    #dbsConnectorServers group
    [dbsConnectorServers]
    mbox1.example.com
    mbox2.example.com
    

The complete inventory file, filled according to the directions above, can be seen and downloaded here.

Inventory - “HA” Scenario

Download_inventory


[kafka]
svc1.example.com broker_id=1
svc2.example.com broker_id=2
svc3.example.com broker_id=3

[zookeeper_servers]
svc1.example.com zookeeper_id=1
svc2.example.com zookeeper_id=2
svc3.example.com zookeeper_id=3

[postgresServers]
svc1.example.com postgres_version=16 patroni_role=primary
svc2.example.com postgres_version=16 patroni_role=secondary

[masterDirectoryServers]
svc1.example.com ldap_role=master
svc2.example.com ldap_role=mmr

[replicaDirectoryServers]

[serviceDiscoverServers]
svc1.example.com
svc2.example.com
svc3.example.com

[dbsConnectorServers]
mbox1.example.com
mbox2.example.com

[mtaServers]
mta1.example.com
mta2.example.com

[proxyServers]
proxy1.example.com
proxy2.example.con

[proxyServers:vars]
#webmailHostname=webmailPublicHostname

[applicationServers]
mbox1.example.com
mbox2.example.com

[filesServers]
filesdocs1.example.com
filesdocs2.example.com

[docsServers]
filesdocs1.example.com
filesdocs2.example.com

[taskServers]
filesdocs1.example.com
filesdocs2.example.com

[previewServers]
filesdocs1.example.com
filesdocs2.example.com

[videoServers]
#hostname public_ip_address=x.y.z.t
video1.example.com public_ip_address=1.2.3.4
video2.example.com public_ip_address=1.2.3.4

[prometheusServers]
svc3.example.com

[syslogServer]
svc3.example.com

Install Zookeper and Kafka#

To install Zookeper and Kafka, use the necessary playbook from carbonio_kafka collection:

# ansible-playbook -i inventory zxbot.carbonio_kafka.carbonio_zookeper_install
# ansible-playbook -i inventory zxbot.carbonio_kafka.carbonio_kafka_install

Install PostgreSQL HA#

PostgreSQL uses HAProxy to add load balancing, health checks, and more. The HAProxy installation has been automated with Ansible and is included in the carbonio_patroni playbook. First, install the PstgreSQL replica

# ansible-playbook -i inventory zxbot.carbonio_patroni.carbonio_replica_postgres_install

Before starting the HAProxy installation, note that during the installation you will be prompted with the following question:

Is this a full HA installation? (yes/no)

- If you answer `yes`, HAProxy will be installed on all servers except the LDAP servers.
- If you answer `no`, HAProxy will only be installed on the `dbconnectors`.

To install HAProxy, execute command

# ansible-playbook -i inventory zxbot.carbonio_patroni.carbonio_patroni_install

This task also move DB Connectors from the PostgreSQL Node to db connector Nodes, as defined on the inventory file. This setup allows Db Connectors to connect to an available PostgreSQL node managed by Patroni.

Install Multi Master LDAP#

To install the Multi-Master LDAP server, use the appropriate collection:

ansible-playbook -i inventory zxbot.carbonio_ldap.carbonio_install_mmr

Promote Multi Master LDAP#

It is needed only if replica is installed

ansible-playbook -i inventory zxbot.carbonio_ldap.carbonio_promote_mmr