Database Connector#

The Database Connector Role can not be installed on the same node on which the Database is installed. If you are installing using the Install Carbonio Using Ansible and try to install both Roles on the same node, Ansible will detect it and will skip the installation of the Database Connector Role.

Install Packages#

Warning

In case you install this Role on a Node which already features the Mesh and Directory Role, make sure you do not install the service-discover-agent package.

# apt install carbonio-docs-connector-db carbonio-tasks-db \
  carbonio-files-db carbonio-mailbox-db carbonio-storages \
  service-discover-agent
# dnf install carbonio-docs-connector-db carbonio-tasks-db \
  carbonio-files-db carbonio-mailbox-db carbonio-storages \
  service-discover-agent

Bootstrap Carbonio#

Execute:

# carbonio-bootstrap

The bootstrap command will execute a number of tasks and will set up the node. At the end, you will be prompted with a menu and, if you already configured all, you only need to click y for confirmation.

On RHEL 9 only, restart the node to ensure that Carbonio service management come under the control of systemd:

# reboot

During the process, you need to provide these values, which you can retrieve from the first Mesh and Directory node.

  • Ldap master host is the FQDN of the first Mesh and Directory node, (example: ldap-mstr.example.com)

  • Ldap Admin password is obtained from the first Mesh and Directory node (ldap-admin-password)

Join Carbonio Mesh#

Carbonio Mesh is required to allow communication between Carbonio and its components. The configuration is interactively generated by command

# service-discover setup-wizard

This command will:

  • ask for the IP address and netmask

  • ask for the Carbonio Mesh secret, which is used for setups, management, and to access the administration GUI. See section Carbonio Mesh Administration Interface for more information.

    This password will be denoted as MESH_SECRET throughout the documentation.

    Hint

    We suggest to use a robust password which is at least 16 characters long, including at least one of lowercase and uppercase letters, numbers, special characters and store it in a password manager.

    In case the password is lost or the credential file becomes corrupted and unusable, you can reset them using the procedure detailed in section Carbonio Mesh Credentials.

  • store the setup in file /etc/zextras/service-discover/cluster-credentials.tar.gpg

To complete Carbonio Mesh installation, run

# pending-setups -a

Hint

The secret is stored in file /var/lib/service-discover/password, which is accessible only by the root user.

Install and Configure pgpool#

Carry out the following tasks to set up pgpool.

  1. Install pgpool

    # apt install pgpool2
    
    # dnf install https://www.pgpool.net/yum/rpms/4.5/redhat/rhel-8-x86_64/pgpool-II-pg16-4.5.1-1pgdg.rhel8.x86_64.rpm
    
    # dnf install https://www.pgpool.net/yum/rpms/4.5/redhat/rhel-9-x86_64/pgpool-II-pg16-4.5.1-1pgdg.rhel9.x86_64.rpm
    
  2. Configure Pgpool-II using the following command.

    Note

    backend_hostname0 is the IP of the Node on which PostgreSQL is installed. If you plan to install it on a different node or you want to use an existing PostgreSQL installation, replace the value localhost with the correct IP address or hostname, provided the hostname is resolvable by the node that hosts the Database connector role.

    In file /etc/pgpool2/pgpool.conf, search for the following attributes and replace the existent values with the following:

    backend_clustering_mode = 'raw'
    port = 5432
    backend_hostname0 = 'localhost'
    backend_port0 = 5433
    backend_flag0 = 'DISALLOW_TO_FAILOVER'
    num_init_children = 32
    max_pool=8
    reserved_connections=1
    

    Then, add the following lines at the end of the file:

    enable_pool_hba = off
    allow_clear_text_frontend_auth = on
    pool_passwd = ''
    

    In file /etc/pgpool-II/pgpool.conf, search for the following attributes and replace the existent values with the following:

    backend_clustering_mode = 'raw'
    port = 5432
    backend_hostname0 = 'localhost'
    backend_port0 = 5433
    backend_flag0 = 'DISALLOW_TO_FAILOVER'
    num_init_children = 32
    max_pool=8
    reserved_connections=1
    

    Then find and comment out the following lines (i.e., make sure that the first character is a #:

    #unix_socket_directories = '/var/run/postgresql'
    #pcp_socket_dir = '/var/run/postgresql'
    #pid_file_name = '/var/run/pgpool/pgpool.pid'
    #wd_ipc_socket_dir = '/var/run/postgresql'
    

    Finally, add the following lines at the end of the file:

    enable_pool_hba = off
    allow_clear_text_frontend_auth = on
    pool_passwd = ''
    

    In file /etc/pgpool-II/pgpool.conf, search for the following attributes and replace the existent values with the following:

    backend_clustering_mode = 'raw'
    port = 5432
    backend_hostname0 = 'localhost'
    backend_port0 = 5433
    backend_flag0 = 'DISALLOW_TO_FAILOVER'
    num_init_children = 32
    max_pool=8
    reserved_connections=1
    

    Then, add the following lines at the end of the file:

    enable_pool_hba = off
    allow_clear_text_frontend_auth = on
    pool_passwd = ''
    
  3. Make sure the service is enabled and restart it using these commands

    # systemctl enable --now pgpool2
    # systemctl restart pgpool2.service
    
    # systemctl enable --now pgpool
    # systemctl restart pgpool.service
    

Bootstrap Carbonio Databases#

You can use the password of the Postgres user carbonio_adm that you defined when installing the Database role or any other administrator user created previously.

The only mandatory command is the one for the mailbox database, which is necessary in all installation scenarios, while the other are needed only if the other Roles are installed.

Mailbox
# PGPASSWORD=$DB_ADM_PWD carbonio-mailbox-db-bootstrap carbonio_adm 127.0.0.1
Carbonio Docs
# PGPASSWORD=$DB_ADM_PWD carbonio-docs-connector-db-bootstrap carbonio_adm 127.0.0.1
Carbonio Files
# PGPASSWORD=$DB_ADM_PWD carbonio-files-db-bootstrap carbonio_adm 127.0.0.1
Carbonio Tasks
# PGPASSWORD=$DB_ADM_PWD carbonio-tasks-db-bootstrap carbonio_adm 127.0.0.1