Created 07-29-2025 03:09 AM
Hello, guys!
I still have a three-node cluster Apache NiFi 1.18.0 (yeap, upgrade task in by backlog =)) and trying to setup it behind HAProxy just for UI (/nifi endpoint).
I wanna to implement a health check to balance user requests only to nodes in CONNECTED status to avoid issues when nodes moves to maintenance (offload, disconnect).
Is it good idea, right? Or maybe I do some overengineering things? 😃
By the way, I have next HAProxy config file:
frontend nifi_443
bind *:443 ssl crt /etc/haproxy/ssl/cert_file.pem
http-request set-path /nifi if { path / }
mode http
option httplog
acl DST_IP dst 10.0.0.10
use_backend nifi_ui_9443 if DST_IP
backend nifi_ui_9443
mode http
option httpchk
http-check send meth GET uri /nifi-api/access/config ver HTTP/1.1 hdr Host nifi-cluster.corp.company.com
http-check expect status 200
cookie SERVERID insert indirect nocache
balance leastconn
server srv_1 10.0.0.1:9443 check ssl verify none cookie web1
server srv_2 10.0.0.2:9443 check ssl verify none cookie web2
server srv_3 10.0.0.3:9443 check ssl verify none cookie web3
Basically it works fine when all nodes are CONNECTED, but if some node goes to DISCONNECTED state, http-check to selected API method still returns 200 and HAProxy continues to route users to that node.
So, give an advice, please. How can I configure HAProxy health-check to get expected behavior? Thanks a lot.
Created 07-29-2025 07:23 AM
@asand3r
A node must be "disconnected" before it can be offloaded. Only a running node can be offloaded. So as long as a node is running. it's UI will be accessible.
A couple options:
Please help our community grow. If you found any of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "Accept as Solution" on one or more of them that helped.
Thank you,
Matt
Created 07-29-2025 07:23 AM
@asand3r
A node must be "disconnected" before it can be offloaded. Only a running node can be offloaded. So as long as a node is running. it's UI will be accessible.
A couple options:
Please help our community grow. If you found any of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "Accept as Solution" on one or more of them that helped.
Thank you,
Matt
Created 07-29-2025 10:27 AM
But there methods requires authentication. As I know it's not possible to create internal NiFi service user with persistent auth token to make a health check with it. So, right way is HAProxy agent check?
Created 07-30-2025 08:38 AM
@asand3r
Use a client certificate eliminates need for token when connecting with NiFi.
A secured NiFi will always want a client certificate first and only use other authentication methods when a client certificate is not presented in the TSL exchange. This is how NiFi node perform authorized actions between nodes.
Created on 07-31-2025 01:58 AM - edited 07-31-2025 01:58 AM
OK, @MattWho, thanks for your help.