{"id":17158,"date":"2022-05-02T08:49:07","date_gmt":"2022-05-02T06:49:07","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8-part-2\/"},"modified":"2022-05-02T08:49:07","modified_gmt":"2022-05-02T06:49:07","slug":"how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8-part-2","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-part-2\/","title":{"rendered":"How to setup a Consul Cluster on RHEL 8, Rocky Linux 8, AlmaLinux 8 part 2"},"content":{"rendered":"<p>Within the first part I have described the setup of Consul as replacement for ETCD.<br \/>\nHere now the setup ob keepalived, haproxy and patroni.<\/p>\n<p>The needed packages I have installed within the first part, so let&#8217;s start with the configuration of keepalived.<\/p>\n<p>At first we need to open firewalld for the VRRP Protocol:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-01 ~]# firewall-cmd --add-rich-rule='rule protocol value=\"vrrp\" accept' --permanent\n$ success\n$ [root@patroni-01 ~]# firewall-cmd --reload\n$ success\n$ [root@patroni-01 ~]#\n<\/pre>\n<p>Next part will be the configuration of keepalived:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-01 \/]# cat \/etc\/keepalived\/keepalived.conf\n$ vrrp_script haproxy {\n$         script \"killall -0 haproxy\"\n$         interval 2\n$         weight 2\n$ }\n$ vrrp_instance VI_1 {\n$         state MASTER\n$         interface ens160\n$         virtual_router_id 51\n$         priority 255\n$         advert_int 1\n$         authentication {\n$               auth_type PASS\n$               auth_pass new_password\n$         }\n$         virtual_ipaddress {\n$               192.168.198.200\/24\n$         }\n$         track_script {\n$         haproxy\n$         }\n$ }\n$ [root@patroni-01 \/]#\n<\/pre>\n<p>Priority defines the default role, in my case 255 for the master role.<\/p>\n<p>The keepalived.conf for the backup role on patroni-02:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-02 \/]# cat \/etc\/keepalived\/keepalived.conf\n$ vrrp_script haproxy {\n$         script \"killall -0 haproxy\"\n$         interval 2\n$         weight 2\n$ }\n$ vrrp_instance VI_1 {\n$         state BACKUP\n$         interface ens160\n$         virtual_router_id 51\n$         priority 254\n$         advert_int 1\n$         authentication {\n$               auth_type PASS\n$               auth_pass new_password\n$         }\n$         virtual_ipaddress {\n$               192.168.198.200\/24\n$         }\n$         track_script {\n$         haproxy\n$         }\n$ }\n[root@patroni-02 \/]#\n<\/pre>\n<p>The keepalived.conf for the backup role on patroni-03:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-03 \/]# cat \/etc\/keepalived\/keepalived.conf\n$ vrrp_script haproxy {\n$         script \"killall -0 haproxy\"\n$         interval 2\n$         weight 2\n$ }\n$ vrrp_instance VI_1 {\n$         state BACKUP\n$         interface ens160\n$         virtual_router_id 51\n$         priority 254\n$         advert_int 1\n$         authentication {\n$               auth_type PASS\n$               auth_pass new_password\n$         }\n$         virtual_ipaddress {\n$               192.168.198.200\/24\n$         }\n$         track_script {\n$         haproxy\n$         }\n$ }\n$ [root@patroni-03 \/]#\n<\/pre>\n<p>Checking status on all three nodes.:<br \/>\npatroni-01 as MASTER:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-01 \/]# journalctl -u keepalived\n$ Mar 25 13:04:45 patroni-01.patroni.test Keepalived_vrrp[11468]: (VI_1) Entering MASTER STATE\n<\/pre>\n<p>patroni-02 as BACKUP:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ journalctl -u keepalived\n$ Mar 25 14:20:18 patroni-02.patroni.test Keepalived_vrrp[1484]: (VI_1) Entering BACKUP STATE\n<\/pre>\n<p>patroni-03 as BACKUP:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ journalctl -u keepalived\n$ Mar 25 14:21:56 patroni-03.patroni.test Keepalived_vrrp[1465]: (VI_1) Entering BACKUP STATE\n<\/pre>\n<p>Next step haproxy.<br \/>\nAt first we need to adapt SE Linux for haproxy or switch it off:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-01 \/]#setsebool -P haproxy_connect_any=1\n<\/pre>\n<p>haproxy.cfg is the same on all three servers:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-01 \/]# cat \/etc\/haproxy\/haproxy.cfg\n$ global\n$     maxconn 100\n$ \n$ defaults\n$     log global\n$     mode tcp\n$     retries 2\n$     timeout client 30m\n$     timeout connect 4s\n$     timeout server 30m\n$     timeout check 5s\n$ \n$ listen stats\n$     mode http\n$     bind *:7000\n$     stats enable\n$     stats uri \/\n$     # stats auth haproxy:haproxy\n$     # stats refresh 10s\n$ \n$ listen PG1\n$     bind *:5000\n$     option httpchk\n$     http-check expect status 200\n$     default-server inter 3s fall 3 rise 2 on-marked-down shutdown-sessions\n$     server postgresql_192.168.198.132_5432 192.168.198.132:5432 maxconn 100 check port 8008\n$     server postgresql_192.168.198.133_5432 192.168.198.133:5432 maxconn 100 check port 8008\n$     server postgresql_192.168.198.134_5432 192.168.198.134:5432 maxconn 100 check port 8008\n$ [root@patroni-01 \/]#\n<\/pre>\n<p>Starting and enabling haproxy:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-01 \/]# systemctl start haproxy\n$ [root@patroni-01 \/]# systemctl enable haproxy\n<\/pre>\n<p>Now the interesting part, Patroni.<br \/>\nAt first, there is a missing dependancy by installing Patroni out of RPM Pachages, python3-urllib3 is missing:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-01 pgdata]# dnf install python3-urllib3\n$ Last metadata expiration check: 5:18:38 ago on Mon 11 Apr 2022 11:06:33 AM CEST.\n$ Dependencies resolved.\n$ ==========================================================================================================================================================================================================================================================================================\n$  Package                                                                   Architecture                                                     Version                                                                Repository                                                        Size\n$ ==========================================================================================================================================================================================================================================================================================\n$ Installing:\n$  python3-urllib3                                                           noarch                                                           1.24.2-5.el8                                                           baseos                                                           176 k\n$ Installing dependencies:\n$  python3-pysocks                                                           noarch                                                           1.6.8-3.el8                                                            baseos                                                            33 k\n$ \n$ Transaction Summary\n$ ==========================================================================================================================================================================================================================================================================================\n$ Install  2 Packages\n$ \n$ Total download size: 209 k\n$ Installed size: 681 k\n$ Is this ok [y\/N]: y\n$ Downloading Packages:\n$ (1\/2): python3-pysocks-1.6.8-3.el8.noarch.rpm                                                                                                                                                                                                             274 kB\/s |  33 kB     00:00\n$ (2\/2): python3-urllib3-1.24.2-5.el8.noarch.rpm                                                                                                                                                                                                            1.0 MB\/s | 176 kB     00:00\n$ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n$ Total                                                                                                                                                                                                                                                     469 kB\/s | 209 kB     00:00\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       : python3-pysocks-1.6.8-3.el8.noarch                                                                                                                                                                                                                               1\/2\n$   Installing       : python3-urllib3-1.24.2-5.el8.noarch                                                                                                                                                                                                                              2\/2\n$   Running scriptlet: python3-urllib3-1.24.2-5.el8.noarch                                                                                                                                                                                                                              2\/2\n$   Verifying        : python3-pysocks-1.6.8-3.el8.noarch                                                                                                                                                                                                                               1\/2\n$   Verifying        : python3-urllib3-1.24.2-5.el8.noarch                                                                                                                                                                                                                              2\/2\n$ \n$ Installed:\n$   python3-pysocks-1.6.8-3.el8.noarch                                                                                                          python3-urllib3-1.24.2-5.el8.noarch\n$ \n$ Complete!\n<\/pre>\n<p>Patroni need a information which one of the consul nodes is master at start.<br \/>\nThis information comes out of the parameter &#8220;bootstrap&#8221;: true only on the master node at start.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-01 consul.d]# cat consul.json-dist.hcl\n$ {\n$     \"bootstrap\": true,\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\": \"ueX3vI8HI63FR\/VE+Yv1T4+x7mrrNIU7F2bDNfPVR9g=\",\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 consul.d]#\n<\/pre>\n<p>Now Patroni, this is similar to Patroni using etcd.<br \/>\nBy using etcd there is a part etcd within the patroni.yml file, this is replaced with a part consul:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ [root@patroni-01 patroni]# cat patroni.yml\n$ name: \"patroni-01.patroni.test\"\n$ scope: PG1\n$ namespace: \/patroni.test\/\n$ consul:\n$   url: http:\/\/127.0.0.1:8500\n$   register_service: true\n$ postgresql:\n$   connect_address: \"patroni-01.patroni.test:5432\"\n$   bin_dir: \/usr\/pgsql-14\/bin\n$   data_dir: \/pgdata\/14\/data\n$   authentication:\n$     replication:\n$       username: replicator\n$       password: replicator\n$     superuser:\n$       username: postgres\n$       password: postgres\n$   listen: 192.168.198.132:5432\n$ restapi:\n$   connect_address: \"patroni-01.patroni.test:8008\"\n$   listen: \"patroni-01.patroni.test:8008\"\n$ bootstrap:\n$   dcs:\n$     postgresql:\n$       use_pg_rewind: true\n$       use_slots: true\n$       parameters:\n$         wal_level: 'hot_standby'\n$         hot_standby: \"on\"\n$         wal_keep_segments: 8\n$         max_replication_slots: 10\n$         wal_log_hints: \"on\"\n$         listen_addresses: '*'\n$         port: 5432\n$         logging_collector: 'on'\n$         log_truncate_on_rotation: 'on'\n$         log_filename: 'postgresql-%a.log'\n$         log_rotation_age: '1440'\n$         log_line_prefix: '%m - %l - %p - %h - %u@%d - %x'\n$         log_directory: 'pg_log'\n$         log_min_messages: 'WARNING'\n$         log_autovacuum_min_duration: '60s'\n$         log_min_error_statement: 'NOTICE'\n$         log_min_duration_statement: '30s'\n$         log_checkpoints: 'on'\n$         log_statement: 'ddl'\n$         log_lock_waits: 'on'\n$         log_temp_files: '0'\n$         log_timezone: 'Europe\/Zurich'\n$         log_connections: 'on'\n$         log_disconnections: 'on'\n$         log_duration: 'on'\n$         client_min_messages: 'WARNING'\n$         wal_level: 'replica'\n$         hot_standby_feedback: 'on'\n$         max_wal_senders: '10'\n$         shared_buffers: '1024MB'\n$         work_mem: '8MB'\n$         effective_cache_size: '3072MB'\n$         maintenance_work_mem: '64MB'\n$         wal_compression: 'off'\n$         max_wal_senders: '20'\n$         shared_preload_libraries: 'pg_stat_statements'\n$         autovacuum_max_workers: '6'\n$         autovacuum_vacuum_scale_factor: '0.1'\n$         autovacuum_vacuum_threshold: '50'\n$         archive_mode: 'on'\n$         archive_command: '\/bin\/true'\n$         wal_log_hints: 'on'\n$         ssl: \"on\"\n$         ssl_ciphers: \"TLSv1.2:!aNULL:!eNULL\"\n$         ssl_cert_file: \/pgdata\/certs\/server.crt\n$         ssl_key_file: \/pgdata\/certs\/server.key\n$   users:\n$     app_user:\n$       password: \"aZ5QrESZ\"\n$   pg_hba:\n$     - local all all  scram-sha-256\n$     - hostssl all all 127.0.0.1\/32 scram-sha-256\n$     - hostssl all all ::1\/128 scram-sha-256\n$     - hostssl all all ::1\/128 scram-sha-256\n$     - hostssl all all 0.0.0.0\/0 scram-sha-256\n$     - hostssl replication replicator patroni-01.patroni.test scram-sha-256\n$     - hostssl replication replicator patroni-01.patroni.test scram-sha-256\n$     - hostssl replication replicator patroni-01.patroni.test scram-sha-256\n$   initdb:\n$     - encoding: UTF8\n$ [root@patroni-01 patroni]#\n<\/pre>\n<p>The only difference within patroni.yml on the three nodes within this example setup is:<br \/>\nname: &#8220;patroni-01.patroni.test&#8221; needs to be adapted to &#8220;patroni-02.patroni.test&#8221; or &#8220;patroni-03.patroni.test&#8221;<br \/>\nUnder postgresql:<br \/>\n   connect_address: &#8220;patroni-01.patroni.test:5432&#8221; needs to be adapted to &#8220;patroni-02.patroni.test:5432&#8221; or &#8220;patroni-03.patroni.test:5432&#8221;.<br \/>\n   listen: 192.168.198.132:5432 needs to be adpated to the corosponding IPs 192.168.198.133:5432 or 192.168.198.134:5432.<br \/>\nUnder reatapi:<br \/>\n  connect_address: &#8220;patroni-01.patroni.test:8008&#8221; to &#8220;patroni-02.patroni.test:8008&#8221; or &#8220;patroni-02.patroni.test:8008&#8221;.<br \/>\n  listen: &#8220;patroni-01.patroni.test:8008&#8221; to &#8220;patroni-02.patroni.test:8008&#8221; or &#8220;patroni-02.patroni.test:8008&#8221;.<\/p>\n<p>In my exapmle patroni-01 is the consul leader, so here we need to start patroni first to be leader within the patroni cluster.<br \/>\nMeans the consul leader will be the patroni leader in any case, also in case of failover.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ postgres@patroni-01: patronictl list\n$ + Cluster: PG1 (7358967191570897068) -----------------+---------+----+-----------+\n$ | Member                  | Host            | Role    | State   | TL | Lag in MB |\n$ +-------------------------+-----------------+---------+---------+----+-----------+\n$ | patroni-01.patroni.test | 192.168.198.132 | Leader  | running |  2 |           |\n$ | patroni-02.patroni.test | 192.168.198.133 | Replica | running |  2 |         0 |\n$ | patroni-03.patroni.test | 192.168.198.134 | Replica | running |  2 |         0 |\n$ +-------------------------+-----------------+---------+---------+----+-----------+\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Within the first part I have described the setup of Consul as replacement for ETCD. Here now the setup ob keepalived, haproxy and patroni. The needed packages I have installed within the first part, so let&#8217;s start with the configuration of keepalived. At first we need to open firewalld for the VRRP Protocol: $ [root@patroni-01&hellip;&nbsp;<\/p>\n","protected":false},"author":28,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","neve_meta_reading_time":"","_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[4133,83],"tags":[84,101],"class_list":["post-17158","post","type-post","status-publish","format-standard","hentry","category-database","category-postgresql","tag-high-availability","tag-installation"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.8 (Yoast SEO v28.8) - 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 2 - dbi services | 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-part-2\/\" \/>\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 2\" \/>\n<meta property=\"og:description\" content=\"Within the first part I have described the setup of Consul as replacement for ETCD. Here now the setup ob keepalived, haproxy and patroni. The needed packages I have installed within the first part, so let&#8217;s start with the configuration of keepalived. At first we need to open firewalld for the VRRP Protocol: $ [root@patroni-01&hellip;&nbsp;\" \/>\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-part-2\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi services | Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/dbiservices\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-05-02T06:49:07+00:00\" \/>\n<meta name=\"author\" content=\"Open source Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:site\" content=\"@dbiservices\" \/>\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=\"6 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-part-2\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8-part-2\\\/\"},\"author\":{\"name\":\"Open source Team\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/0b4548362cac3eeff8b3eaf329e3530a\"},\"headline\":\"How to setup a Consul Cluster on RHEL 8, Rocky Linux 8, AlmaLinux 8 part 2\",\"datePublished\":\"2022-05-02T06:49:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8-part-2\\\/\"},\"wordCount\":358,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#organization\"},\"keywords\":[\"High Availability\",\"Installation\"],\"articleSection\":[\"Database\",\"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-part-2\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8-part-2\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8-part-2\\\/\",\"name\":\"How to setup a Consul Cluster on RHEL 8, Rocky Linux 8, AlmaLinux 8 part 2 - dbi services | Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"datePublished\":\"2022-05-02T06:49:07+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8-part-2\\\/#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-part-2\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8-part-2\\\/#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 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi services Blog\",\"description\":\"#BeSharing\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#organization\"},\"alternateName\":\"dbi Blog\",\"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\":\"Organization\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#organization\",\"name\":\"dbi services\",\"alternateName\":\"dbi\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"width\":512,\"height\":512,\"caption\":\"dbi services\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/dbiservices\\\/\",\"https:\\\/\\\/x.com\\\/dbiservices\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/dbi-services\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/dbiservices\"],\"description\":\"Swiss IT consulting and services company specialised in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.\",\"email\":\"info@dbi-services.com\",\"telephone\":\"+41 32 422 96 00\",\"legalName\":\"dbi services SA\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/0b4548362cac3eeff8b3eaf329e3530a\",\"name\":\"Open source Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/open-source-author.png\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/open-source-author.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/open-source-author.png\",\"caption\":\"Open source Team\"},\"description\":\"Posts published under the Open source Team account are collective contributions by the dbi services open infrastructure consultants. The practice covers open-source databases and platforms, PostgreSQL first of all, along with MySQL, MariaDB, and Linux, from architecture, replication, and high availability to performance tuning and operations under service level agreements, and contributes actively to the PostgreSQL community.\",\"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 2 - dbi services | 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-part-2\/","og_locale":"en_US","og_type":"article","og_title":"How to setup a Consul Cluster on RHEL 8, Rocky Linux 8, AlmaLinux 8 part 2","og_description":"Within the first part I have described the setup of Consul as replacement for ETCD. Here now the setup ob keepalived, haproxy and patroni. The needed packages I have installed within the first part, so let&#8217;s start with the configuration of keepalived. At first we need to open firewalld for the VRRP Protocol: $ [root@patroni-01&hellip;&nbsp;","og_url":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8-part-2\/","og_site_name":"dbi services | Blog","article_publisher":"https:\/\/www.facebook.com\/dbiservices\/","article_published_time":"2022-05-02T06:49:07+00:00","author":"Open source Team","twitter_card":"summary_large_image","twitter_creator":"@dbiservices","twitter_site":"@dbiservices","twitter_misc":{"Written by":"Open source Team","Est. reading time":"6 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-part-2\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8-part-2\/"},"author":{"name":"Open source Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/0b4548362cac3eeff8b3eaf329e3530a"},"headline":"How to setup a Consul Cluster on RHEL 8, Rocky Linux 8, AlmaLinux 8 part 2","datePublished":"2022-05-02T06:49:07+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8-part-2\/"},"wordCount":358,"commentCount":0,"publisher":{"@id":"https:\/\/www.dbi-services.com\/blog\/#organization"},"keywords":["High Availability","Installation"],"articleSection":["Database","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-part-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8-part-2\/","url":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8-part-2\/","name":"How to setup a Consul Cluster on RHEL 8, Rocky Linux 8, AlmaLinux 8 part 2 - dbi services | Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2022-05-02T06:49:07+00:00","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8-part-2\/#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-part-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/how-to-setup-a-consul-cluster-on-rhel-8-rocky-linux-8-almalinux-8-part-2\/#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 2"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi services Blog","description":"#BeSharing","publisher":{"@id":"https:\/\/www.dbi-services.com\/blog\/#organization"},"alternateName":"dbi Blog","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":"Organization","@id":"https:\/\/www.dbi-services.com\/blog\/#organization","name":"dbi services","alternateName":"dbi","url":"https:\/\/www.dbi-services.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","width":512,"height":512,"caption":"dbi services"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/dbiservices\/","https:\/\/x.com\/dbiservices","https:\/\/www.linkedin.com\/company\/dbi-services\/","https:\/\/www.youtube.com\/user\/dbiservices"],"description":"Swiss IT consulting and services company specialised in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.","email":"info@dbi-services.com","telephone":"+41 32 422 96 00","legalName":"dbi services SA"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/0b4548362cac3eeff8b3eaf329e3530a","name":"Open source Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/05\/open-source-author.png","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/05\/open-source-author.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/05\/open-source-author.png","caption":"Open source Team"},"description":"Posts published under the Open source Team account are collective contributions by the dbi services open infrastructure consultants. The practice covers open-source databases and platforms, PostgreSQL first of all, along with MySQL, MariaDB, and Linux, from architecture, replication, and high availability to performance tuning and operations under service level agreements, and contributes actively to the PostgreSQL community.","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\/17158","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=17158"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/17158\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=17158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=17158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=17158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}