{"id":17146,"date":"2022-03-04T15:10:44","date_gmt":"2022-03-04T14:10:44","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/"},"modified":"2024-11-08T15:10:59","modified_gmt":"2024-11-08T14:10:59","slug":"how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/","title":{"rendered":"How to setup a Consul Cluster on RHEL 8, Rocky Linux 8, AlmaLinux 8 part 1"},"content":{"rendered":"<p>This blog describes the setup of a Consul Cluster on RHEL 8 and clones, it will be the base for a Patroni HA setup using RPM Packages from postgresql.org.<br \/>\nMany Patroni setups are using ETCD, but ETCD is not available as RPM out of the box for RHEL 8 and clones, and in many cases using tar files or RPMS from unknown sources are not allowed.<\/p>\n<p>I use OS Rocky Linux 8.5 minimal installation patched before writing this blog.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@patroni-01 ~]# cat \/etc\/os-release\nNAME=\"Rocky Linux\"\nVERSION=\"8.5 (Green Obsidian)\"\nID=\"rocky\"\nID_LIKE=\"rhel centos fedora\"\nVERSION_ID=\"8.5\"\nPLATFORM_ID=\"platform:el8\"\nPRETTY_NAME=\"Rocky Linux 8.5 (Green Obsidian)\"\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:\/o:rocky:rocky:8:GA\"\nHOME_URL=\"https:\/\/rockylinux.org\/\"\nBUG_REPORT_URL=\"https:\/\/bugs.rockylinux.org\/\"\nROCKY_SUPPORT_PRODUCT=\"Rocky Linux\"\nROCKY_SUPPORT_PRODUCT_VERSION=\"8\"\n[root@patroni-01 ~]#\n<\/pre>\n<p>It will be a three node cluster with the following nodes:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@patroni-01 ~]# cat \/etc\/hosts\n127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4\n192.168.198.132 patroni-01.patroni.test patroni-01\n192.168.198.133 patroni-02.patroni.test patroni-02\n192.168.198.134 patroni-03.patroni.test patroni-03\n[root@patroni-01 ~]#\n<\/pre>\n<p>The installation RPM for Consul will come from the postgresql.org repository, so we need to disable postgresql from the OS Repository on all three nodes.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-01 ~]# dnf -y module disable postgresql\n$ Last metadata expiration check: 1:21:07 ago on Fri 04 Mar 2022 12:53:22 PM CET.\n$ Dependencies resolved.\n$ ====================================================================================================\n$  Package                Architecture          Version                  Repository              Size\n$ ====================================================================================================\n$ Disabling modules:\n$  postgresql\n$ \n$ Transaction Summary\n$ ====================================================================================================\n$ \n$ Complete!\n$ [root@patroni-01 ~]#\n<\/pre>\n<p>Next step is adding the postgresql.org repository.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-01 ~]# dnf install https:\/\/download.postgresql.org\/pub\/repos\/yum\/reporpms\/EL-8-x86_64\/pgdg-redhat-repo-latest.noarch.rpm\n$ Last metadata expiration check: 1:49:40 ago on Fri 04 Mar 2022 12:53:22 PM CET.\n$ pgdg-redhat-repo-latest.noarch.rpm                                                                         13 kB\/s |  12 kB     00:00\n$ Dependencies resolved.\n$ ==========================================================================================================================================\n$  Package                               Architecture                Version                        Repository                         Size\n$ ==========================================================================================================================================\n$ Installing:\n$  pgdg-redhat-repo                      noarch                      42.0-23                        @commandline                       12 k\n$ \n$ Transaction Summary\n$ ==========================================================================================================================================\n$ Install  1 Package\n$ \n$ Total size: 12 k\n$ Installed size: 12 k\n$ Is this ok [y\/N]: y\n$ Downloading Packages:\n$ Running transaction check\n$ Transaction check succeeded.\n$ Running transaction test\n$ Transaction test succeeded.\n$ Running transaction\n$   Preparing        :                                                                                                                  1\/1\n$   Installing       : pgdg-redhat-repo-42.0-23.noarch                                                                                  1\/1\n$   Verifying        : pgdg-redhat-repo-42.0-23.noarch                                                                                  1\/1\n$ \n$ Installed:\n$   pgdg-redhat-repo-42.0-23.noarch\n$ \n$ Complete!\n$ [root@patroni-01 ~]#\n<\/pre>\n<p>As written in the beginning, Consul will be part of a Patroni based HA Cluster, so I install all needed packages.<br \/>\nBut first I edit the pgdg repo file to enable PostgreSQL 14 only and disable all other versions.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@patroni-01 ~]# cat \/etc\/yum.repos.d\/pgdg-redhat-all.repo\n#######################################################\n# PGDG Red Hat Enterprise Linux \/ CentOS repositories #\n#######################################################\n\n# PGDG Red Hat Enterprise Linux \/ CentOS stable common repository for all PostgreSQL versions\n\n[pgdg-common]\nname=PostgreSQL common RPMs for RHEL\/CentOS $releasever - $basearch\nbaseurl=https:\/\/download.postgresql.org\/pub\/repos\/yum\/common\/redhat\/rhel-$releasever-$basearch\nenabled=1\ngpgcheck=1\ngpgkey=file:\/\/\/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-PGDG\nrepo_gpgcheck = 1\n\n# Red Hat recently breaks compatibility between 8.n and 8.n+1. PGDG repo is\n# affected with the LLVM repo. This is a band aid repo for the llvmjit users\n# whose installations cannot be updated.\n\n[pgdg-centos8-sysupdates]\nname=PostgreSQL Supplementary ucommon RPMs for RHEL\/CentOS $releasever - $basearch\nbaseurl=https:\/\/download.postgresql.org\/pub\/repos\/yum\/common\/pgdg-centos8-sysupdates\/redhat\/rhel-$releasever-$basearch\nenabled=0\ngpgcheck=1\ngpgkey=file:\/\/\/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-PGDG\nrepo_gpgcheck = 1\n\n# PGDG Red Hat Enterprise Linux \/ CentOS stable repositories:\n\n[pgdg14]\nname=PostgreSQL 14 for RHEL\/CentOS $releasever - $basearch\nbaseurl=https:\/\/download.postgresql.org\/pub\/repos\/yum\/14\/redhat\/rhel-$releasever-$basearch\nenabled=1\ngpgcheck=1\ngpgkey=file:\/\/\/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-PGDG\nrepo_gpgcheck = 1\n\n[pgdg13]\nname=PostgreSQL 13 for RHEL\/CentOS $releasever - $basearch\nbaseurl=https:\/\/download.postgresql.org\/pub\/repos\/yum\/13\/redhat\/rhel-$releasever-$basearch\nenabled=0\ngpgcheck=1\ngpgkey=file:\/\/\/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-PGDG\nrepo_gpgcheck = 1\n<\/pre>\n<p>Set enabled to 0 for all other version than the one you want to install, in my case only 14 is enabled.<\/p>\n<p>As preparation for the following operations we need to open ports with firewalld, port 5432 is default PostgreSQL, the others used by consul.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-01 ~]# firewall-cmd --add-port={5432,8300,8301,8302,8400,8500,8600}\/tcp --permanent\n$ success\n$ [root@patroni-01 ~]# firewall-cmd --add-port={8301,8302,8600}\/udp --permanent\n$ success\n$ [root@patroni-01 ~]# firewall-cmd --reload\n$ success\n$ [root@patroni-01 ~]#\n$ <\/pre>\n<p>Now it is time to install Consul, as written in the beginning it will be part of a Patroni Cluster, so I install all needed packages in one step.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-01 ~]# dnf install consul postgresql14 postgresql14-server postgresql14-contrib haproxy keepalived patroni\n$ PostgreSQL common RPMs for RHEL\/CentOS 8 - x86_64                                           83  B\/s | 195  B     00:02\n$ PostgreSQL common RPMs for RHEL\/CentOS 8 - x86_64                                          1.6 MB\/s | 1.7 kB     00:00\n$ Importing GPG key 0x442DF0F8:\n$  Userid     : \"PostgreSQL RPM Building Project \"\n$  Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8\n$  From       : \/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-PGDG\n$ Is this ok [y\/N]: y\n$ PostgreSQL common RPMs for RHEL\/CentOS 8 - x86_64                                          186 kB\/s | 619 kB     00:03\n$ PostgreSQL 14 for RHEL\/CentOS 8 - x86_64                                                   129  B\/s | 195  B     00:01\n$ PostgreSQL 14 for RHEL\/CentOS 8 - x86_64                                                   1.6 MB\/s | 1.7 kB     00:00\n$ Importing GPG key 0x442DF0F8:\n$  Userid     : \"PostgreSQL RPM Building Project \"\n$  Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8\n$  From       : \/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-PGDG\n$ Is this ok [y\/N]: y\n$ PostgreSQL 14 for RHEL\/CentOS 8 - x86_64                                                    74 kB\/s | 206 kB     00:02\n$ Dependencies resolved.\n$ ===========================================================================================================================\n$  Package                           Architecture  Version                                          Repository          Size\n$ ===========================================================================================================================\n$ Installing:\n$  consul                            x86_64        1.10.3-1.rhel8                                   pgdg-common         16 M\n$  haproxy                           x86_64        1.8.27-2.el8                                     appstream          1.4 M\n$  keepalived                        x86_64        2.1.5-6.el8                                      appstream          535 k\n$  patroni                           x86_64        2.1.3-1.rhel8                                    pgdg-common        863 k\n$  postgresql14                      x86_64        14.2-1PGDG.rhel8                                 pgdg14             1.5 M\n$  postgresql14-contrib              x86_64        14.2-1PGDG.rhel8                                 pgdg14             723 k\n$  postgresql14-server               x86_64        14.2-1PGDG.rhel8                                 pgdg14             5.7 M\n$ Installing dependencies:\n$  libicu                            x86_64        60.3-2.el8_1                                     baseos             8.8 M\n$  lm_sensors-libs                   x86_64        3.4.0-23.20180522git70f7e08.el8                  baseos              58 k\n$  lz4                               x86_64        1.8.3-3.el8_4                                    baseos             102 k\n$  mariadb-connector-c               x86_64        3.1.11-2.el8_3                                   appstream          199 k\n$  mariadb-connector-c-config        noarch        3.1.11-2.el8_3                                   appstream           14 k\n$  net-snmp-agent-libs               x86_64        1:5.8-22.el8                                     appstream          747 k\n$  net-snmp-libs                     x86_64        1:5.8-22.el8                                     baseos             826 k\n$  perl-Carp                         noarch        1.42-396.el8                                     baseos              29 k\n$  perl-Data-Dumper                  x86_64        2.167-399.el8                                    baseos              57 k\n$  perl-Digest                       noarch        1.17-395.el8                                     appstream           26 k\n$  perl-Digest-MD5                   x86_64        2.55-396.el8                                     appstream           36 k\n$  perl-Encode                       x86_64        4:2.97-3.el8                                     baseos             1.5 M\n$  perl-Errno                        x86_64        1.28-420.el8                                     baseos              75 k\n$  perl-Exporter                     noarch        5.72-396.el8                                     baseos              33 k\n$  perl-File-Path                    noarch        2.15-2.el8                                       baseos              37 k\n$  perl-File-Temp                    noarch        0.230.600-1.el8                                  baseos              62 k\n$  perl-Getopt-Long                  noarch        1:2.50-4.el8                                     baseos              62 k\n$  perl-HTTP-Tiny                    noarch        0.074-1.el8                                      baseos              57 k\n$  perl-IO                           x86_64        1.38-420.el8                                     baseos             141 k\n$  perl-MIME-Base64                  x86_64        3.15-396.el8                                     baseos              30 k\n$  perl-Net-SSLeay                   x86_64        1.88-1.module+el8.4.0+512+d4f0fc54               appstream          378 k\n$  perl-PathTools                    x86_64        3.74-1.el8                                       baseos              89 k\n$  perl-Pod-Escapes                  noarch        1:1.07-395.el8                                   baseos              19 k\n$  perl-Pod-Perldoc                  noarch        3.28-396.el8                                     baseos              85 k\n$  perl-Pod-Simple                   noarch        1:3.35-395.el8                                   baseos             212 k\n$  perl-Pod-Usage                    noarch        4:1.69-395.el8                                   baseos              33 k\n$  perl-Scalar-List-Utils            x86_64        3:1.49-2.el8                                     baseos              67 k\n$  perl-Socket                       x86_64        4:2.027-3.el8                                    baseos              58 k\n$  perl-Storable                     x86_64        1:3.11-3.el8                                     baseos              97 k\n$  perl-Term-ANSIColor               noarch        4.06-396.el8                                     baseos              45 k\n$  perl-Term-Cap                     noarch        1.17-395.el8                                     baseos              22 k\n$  perl-Text-ParseWords              noarch        3.30-395.el8                                     baseos              17 k\n$  perl-Text-Tabs+Wrap               noarch        2013.0523-395.el8                                baseos              23 k\n$  perl-Time-Local                   noarch        1:1.280-1.el8                                    baseos              32 k\n$  perl-URI                          noarch        1.73-3.el8                                       appstream          115 k\n$  perl-Unicode-Normalize            x86_64        1.25-396.el8                                     baseos              81 k\n$  perl-constant                     noarch        1.33-396.el8                                     baseos              24 k\n$  perl-interpreter                  x86_64        4:5.26.3-420.el8                                 baseos             6.3 M\n$  perl-libnet                       noarch        3.11-3.el8                                       appstream          120 k\n$  perl-libs                         x86_64        4:5.26.3-420.el8                                 baseos             1.6 M\n$  perl-macros                       x86_64        4:5.26.3-420.el8                                 baseos              71 k\n$  perl-parent                       noarch        1:0.237-1.el8                                    baseos              19 k\n$  perl-podlators                    noarch        4.11-1.el8                                       baseos             117 k\n$  perl-threads                      x86_64        1:2.21-2.el8                                     baseos              60 k\n$  perl-threads-shared               x86_64        1.58-2.el8                                       baseos              47 k\n$  postgresql14-libs                 x86_64        14.2-1PGDG.rhel8                                 pgdg14             275 k\n$  python3-cdiff                     noarch        1.0-1.rhel8                                      pgdg-common         30 k\n$  python3-click                     noarch        6.7-8.el8                                        appstream          130 k\n$  python3-pip                       noarch        9.0.3-20.el8.rocky.0                             appstream           19 k\n$  python3-prettytable               noarch        0.7.2-14.el8                                     appstream           43 k\n$  python3-psutil                    x86_64        5.4.3-11.el8                                     appstream          372 k\n$  python3-psycopg2                  x86_64        2.8.6-1.rhel8                                    pgdg-common        178 k\n$  python3-pyyaml                    x86_64        3.12-12.el8                                      baseos             192 k\n$  python3-setuptools                noarch        39.2.0-6.el8                                     baseos             162 k\n$  python3-ydiff                     noarch        1.2-10.rhel8                                     pgdg-common         30 k\n$  python36                          x86_64        3.6.8-38.module+el8.5.0+671+195e4563             appstream           18 k\n$ Installing weak dependencies:\n$  perl-IO-Socket-IP                 noarch        0.39-5.el8                                       appstream           46 k\n$  perl-IO-Socket-SSL                noarch        2.066-4.module+el8.4.0+512+d4f0fc54              appstream          297 k\n$  perl-Mozilla-CA                   noarch        20160104-7.module+el8.4.0+529+e3b3e624           appstream           14 k\n$ Enabling module streams:\n$  perl                                            5.26\n$  perl-IO-Socket-SSL                              2.066\n$  perl-libwww-perl                                6.34\n$  python36                                        3.6\n$ \n$ Transaction Summary\n$ ===========================================================================================================================\n$ Install  66 Packages\n$ \n$ Total download size: 51 M\n$ Installed size: 203 M\n$ Is this ok [y\/N]:\n<\/pre>\n<p>With installation out of the postgresql.org repository also user postgres and group postgres are created.<\/p>\n<p>I want Consul also to run as postgres user, for this we need to adapt User and Group within the service file.<br \/>\nThe service file is located at \/usr\/lib\/systemd\/system\/consul.service.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@patroni-01 ~]# cat \/usr\/lib\/systemd\/system\/consul.service\n[Unit]\nDescription=Consul is a tool for service discovery and configuration. Consul is distributed, highly available, and extremely scalable.\nDocumentation=http:\/\/www.consul.io\nAfter=network-online.target\nWants=network-online.target\n\n[Service]\nUser=postgres\nGroup=postgres\nEnvironmentFile=-\/etc\/sysconfig\/consul\nExecStart=\/usr\/bin\/consul $CMD_OPTS\nExecReload=\/bin\/kill -HUP $MAINPID\nKillSignal=SIGINT\nRestart=on-failure\n\n[Install]\nWantedBy=multi-user.target\n[root@patroni-01 ~]#\n<\/pre>\n<p>Next step is adapting the Consul environment file, I want the Consul data directory within \/pgdata.<br \/>\nThe environment file is located at \/etc\/sysconfig\/consul.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@patroni-01 ~]# cat \/etc\/sysconfig\/consul\nCMD_OPTS=\"agent -config-dir=\/etc\/consul.d -data-dir=\/pgdata\/consul\"\n#GOMAXPROCS=4\n[root@patroni-01 ~]#\n<\/pre>\n<p>Creating Consul data directory.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-01 ~]# mkdir \/pgdata\/consul\n$ [root@patroni-01 ~]# chown -R postgres:postgres \/pgdata\/\n<\/pre>\n<p>And the Consul key.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-01 ~]# consul keygen\n$ 5mSUIrSSXp+usVR1qqM68CD2lnFLaTcg4G48l9zJhqE=\n$ [root@patroni-01 ~]#\n<\/pre>\n<p>Now it is time to adapt the Consul configuration file on each node.<br \/>\nNode patroni-01:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@patroni-01 ~]# cat \/etc\/consul.d\/consul.json-dist.hcl\n{\n    \"server\": true,\n    \"data_dir\": \"\/pgdata\/consul\",\n    \"log_level\": \"INFO\"\n    \"disable_update_check\": true,\n    \"disable_anonymous_signature\": true,\n    \"advertise_addr\": \"192.168.198.132\",\n    \"bind_addr\": \"192.168.198.132\",\n    \"bootstrap_expect\": 3,\n    \"client_addr\": \"0.0.0.0\",\n    \"domain\": \"patroni.test\",\n    \"enable_script_checks\": true,\n    \"dns_config\": {\n        \"enable_truncate\": true,\n        \"only_passing\": true\n    },\n    \"enable_syslog\": true,\n    \"encrypt\": \"5mSUIrSSXp+usVR1qqM68CD2lnFLaTcg4G48l9zJhqE=\",\n    \"leave_on_terminate\": true,\n    \"log_level\": \"INFO\",\n    \"rejoin_after_leave\": true,\n    \"retry_join\": [\n        \"patroni-01\",\n        \"patroni-02\",\n        \"patroni-03\"\n    ],\n    \"server\": true,\n    \"start_join\": [\n        \"patroni-01\",\n        \"patroni-02\",\n        \"patroni-03\"\n    ],\n    \"ui_config.enabled\": true\n}\n[root@patroni-01 ~]#\n<\/pre>\n<p>Node patroni-02:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@patroni-02 ~]# cat \/etc\/consul.d\/consul.json-dist.hcl\n{\n    \"server\": true,\n    \"data_dir\": \"\/pgdata\/consul\",\n    \"log_level\": \"INFO\"\n    \"disable_update_check\": true,\n    \"disable_anonymous_signature\": true,\n    \"advertise_addr\": \"192.168.198.133\",\n    \"bind_addr\": \"192.168.198.133\",\n    \"bootstrap_expect\": 3,\n    \"client_addr\": \"0.0.0.0\",\n    \"domain\": \"patroni.test\",\n    \"enable_script_checks\": true,\n    \"dns_config\": {\n        \"enable_truncate\": true,\n        \"only_passing\": true\n    },\n    \"enable_syslog\": true,\n    \"encrypt\": \"5mSUIrSSXp+usVR1qqM68CD2lnFLaTcg4G48l9zJhqE=\",\n    \"leave_on_terminate\": true,\n    \"log_level\": \"INFO\",\n    \"rejoin_after_leave\": true,\n    \"retry_join\": [\n        \"patroni-01\",\n        \"patroni-02\",\n        \"patroni-03\"\n    ],\n    \"server\": true,\n    \"start_join\": [\n        \"patroni-01\",\n        \"patroni-02\",\n        \"patroni-03\"\n    ],\n    \"ui_config.enabled\": true\n}\n[root@patroni-02 ~]#\n<\/pre>\n<p>Node patroni-03:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@patroni-03 ~]# cat \/etc\/consul.d\/consul.json-dist.hcl\n{\n    \"server\": true,\n    \"data_dir\": \"\/pgdata\/consul\",\n    \"log_level\": \"INFO\"\n    \"disable_update_check\": true,\n    \"disable_anonymous_signature\": true,\n    \"advertise_addr\": \"192.168.198.134\",\n    \"bind_addr\": \"192.168.198.134\",\n    \"bootstrap_expect\": 3,\n    \"client_addr\": \"0.0.0.0\",\n    \"domain\": \"patroni.test\",\n    \"enable_script_checks\": true,\n    \"dns_config\": {\n        \"enable_truncate\": true,\n        \"only_passing\": true\n    },\n    \"enable_syslog\": true,\n    \"encrypt\": \"5mSUIrSSXp+usVR1qqM68CD2lnFLaTcg4G48l9zJhqE=\",\n    \"leave_on_terminate\": true,\n    \"log_level\": \"INFO\",\n    \"rejoin_after_leave\": true,\n    \"retry_join\": [\n        \"patroni-01\",\n        \"patroni-02\",\n        \"patroni-03\"\n    ],\n    \"server\": true,\n    \"start_join\": [\n        \"patroni-01\",\n        \"patroni-02\",\n        \"patroni-03\"\n    ],\n    \"ui_config.enabled\": true\n}\n[root@patroni-03 ~]#\n<\/pre>\n<p>And make the files accessable for the postgres user.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-01 ~]# chown -R postgres:postgres \/etc\/consul.d\/\n<\/pre>\n<p>Now it is time to start Consul on each node.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-01 ~]# systemctl start consul\n<\/pre>\n<p>Checking the status.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[root@patroni-01 ~]# consul members\n$ Node                     Address               Status  Type    Build   Protocol  DC   Segment\n$ patroni-01.patroni.test  192.168.198.132:8301  alive   server  1.10.3  2         dc1  \n$ patroni-02.patroni.test  192.168.198.133:8301  alive   server  1.10.3  2         dc1  \n$ patroni-03.patroni.test  192.168.198.134:8301  alive   server  1.10.3  2         dc1  \n$ [root@patroni-01 ~]#\n<\/pre>\n<p>Sometimes it happens that Consul autojoin has issues, in this case manual join helps.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-01 ~]# consul join 192.168.198.132 192.168.198.133 192.168.198.134\n$ Successfully joined cluster by contacting 3 nodes.\n$ [root@patroni-01 ~]# consul members\n$ Node                     Address               Status  Type    Build   Protocol  DC   Segment\n$ patroni-01.patroni.test  192.168.198.132:8301  alive   server  1.10.3  2         dc1  \n$ patroni-02.patroni.test  192.168.198.133:8301  alive   server  1.10.3  2         dc1  \n$ patroni-03.patroni.test  192.168.198.134:8301  alive   server  1.10.3  2         dc1  \n$ [root@patroni-01 ~]#\n<\/pre>\n<p>That was the first part of a Patroni HA Setup using Consul instead of ETCD.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This blog describes the setup of a Consul Cluster on RHEL 8 and clones, it will be the base for a Patroni HA setup using RPM Packages from postgresql.org. Many Patroni setups are using ETCD, but ETCD is not available as RPM out of the box for RHEL 8 and clones, and in many cases [&hellip;]<\/p>\n","protected":false},"author":28,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229,42,83],"tags":[2509,84,101,73,2602],"type_dbi":[],"class_list":["post-17146","post","type-post","status-publish","format-standard","hentry","category-database-administration-monitoring","category-operating-systems","category-postgresql","tag-consul","tag-high-availability","tag-installation","tag-linux","tag-postgresql-2"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to setup a Consul Cluster on RHEL 8, Rocky Linux 8, AlmaLinux 8 part 1 - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to setup a Consul Cluster on RHEL 8, Rocky Linux 8, AlmaLinux 8 part 1\" \/>\n<meta property=\"og:description\" content=\"This blog describes the setup of a Consul Cluster on RHEL 8 and clones, it will be the base for a Patroni HA setup using RPM Packages from postgresql.org. Many Patroni setups are using ETCD, but ETCD is not available as RPM out of the box for RHEL 8 and clones, and in many cases [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-03-04T14:10:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-08T14:10:59+00:00\" \/>\n<meta name=\"author\" content=\"Open source Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Open source Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/\"},\"author\":{\"name\":\"Open source Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b\"},\"headline\":\"How to setup a Consul Cluster on RHEL 8, Rocky Linux 8, AlmaLinux 8 part 1\",\"datePublished\":\"2022-03-04T14:10:44+00:00\",\"dateModified\":\"2024-11-08T14:10:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/\"},\"wordCount\":396,\"commentCount\":0,\"keywords\":[\"Consul\",\"High availability\",\"Installation\",\"Linux\",\"postgresql\"],\"articleSection\":[\"Database Administration &amp; Monitoring\",\"Operating systems\",\"PostgreSQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/\",\"name\":\"How to setup a Consul Cluster on RHEL 8, Rocky Linux 8, AlmaLinux 8 part 1 - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"datePublished\":\"2022-03-04T14:10:44+00:00\",\"dateModified\":\"2024-11-08T14:10:59+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to setup a Consul Cluster on RHEL 8, Rocky Linux 8, AlmaLinux 8 part 1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b\",\"name\":\"Open source Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g\",\"caption\":\"Open source Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/open-source-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to setup a Consul Cluster on RHEL 8, Rocky Linux 8, AlmaLinux 8 part 1 - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/","og_locale":"en_US","og_type":"article","og_title":"How to setup a Consul Cluster on RHEL 8, Rocky Linux 8, AlmaLinux 8 part 1","og_description":"This blog describes the setup of a Consul Cluster on RHEL 8 and clones, it will be the base for a Patroni HA setup using RPM Packages from postgresql.org. Many Patroni setups are using ETCD, but ETCD is not available as RPM out of the box for RHEL 8 and clones, and in many cases [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/","og_site_name":"dbi Blog","article_published_time":"2022-03-04T14:10:44+00:00","article_modified_time":"2024-11-08T14:10:59+00:00","author":"Open source Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Open source Team","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/"},"author":{"name":"Open source Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b"},"headline":"How to setup a Consul Cluster on RHEL 8, Rocky Linux 8, AlmaLinux 8 part 1","datePublished":"2022-03-04T14:10:44+00:00","dateModified":"2024-11-08T14:10:59+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/"},"wordCount":396,"commentCount":0,"keywords":["Consul","High availability","Installation","Linux","postgresql"],"articleSection":["Database Administration &amp; Monitoring","Operating systems","PostgreSQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/","url":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/","name":"How to setup a Consul Cluster on RHEL 8, Rocky Linux 8, AlmaLinux 8 part 1 - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2022-03-04T14:10:44+00:00","dateModified":"2024-11-08T14:10:59+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to setup a Consul Cluster on RHEL 8, Rocky Linux 8, AlmaLinux 8 part 1"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b","name":"Open source Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g","caption":"Open source Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/open-source-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/17146","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=17146"}],"version-history":[{"count":2,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/17146\/revisions"}],"predecessor-version":[{"id":35663,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/17146\/revisions\/35663"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=17146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=17146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=17146"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=17146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}