Chad - Ahh I see what you are saying now. To Joe's point the problems
really shouldn't be there anymore. However to resolve what you are seeing
the best practice is to setup the cluster behind a reverse proxy [1]. In
this configuration you are not accessing the REST API on an explicit node
and the issue you explained will not occur.

[1] -
https://nifi.apache.org/docs/nifi-docs/html/administration-guide.html#proxy_configuration

On Mon, Dec 10, 2018 at 10:23 AM Joe Witt <[email protected]> wrote:

> chad
>
> in 1.8.0 you should not see much need to script that.  are you still
> seeing disconnects in 1.8.0 that it doesnt restore on its own.
>
> thanks
>
> On Mon, Dec 10, 2018, 10:08 AM Woodhead, Chad <[email protected]
> wrote:
>
>> Hey Jeremy!
>>
>>
>>
>> We occasionally see a node disconnect from the cluster (not disappear
>> from the cluster) so I’m building this flow just to reconnect a
>> disconnected node. The cluster still shows the node, but just that it is in
>> a disconnected state.
>>
>>
>>
>> As far as the API call to /nifi-api/controller/cluster, yes I get the
>> same result if I call the API on one of the connected nodes. If I call the
>> API of a disconnected node, I get “Only a node connected to a cluster can
>> process the request.” And since the flowfile is sometimes run and processed
>> on the disconnected node, using ${hostname(true)} in the API to
>> /nifi-api/controller/cluster won’t work.
>>
>>
>>
>> I am also using NiFi 1.8.0 for reference as well.
>>
>>
>>
>> -Chad
>>
>>
>>
>> *From: *Jeremy Dyer <[email protected]>
>> *Reply-To: *"[email protected]" <[email protected]>
>> *Date: *Monday, December 10, 2018 at 9:12 AM
>> *To: *"[email protected]" <[email protected]>
>> *Subject: *Re: How to get Node ID of disconnected node to be used in a
>> cluster/node monitoring flow
>>
>>
>>
>> **External Message* - Use caution before opening links or attachments*
>>
>>
>>
>> Chad - The API call to /nifi-api/controller/cluster will return all of
>> the nodes even if they are disconnected. The JSON response will indicate
>> which node is "disconnected". I have included a screenshot of a simple
>> environment I have setup for this where I just tested it. However I'm
>> thinking since you are performing monitoring here you might have a deeper
>> issue you are trying to work to monitor for. Are you experiencing
>> situations where you are seeing nodes completely disappear from the cluster
>> and not just be in the "disconnected" state? If so that is a different
>> issue but if they are just "disconnected" you should be able to see that as
>> the screenshot below illustrates. I am using NiFi 1.8.0 just for reference.
>>
>>
>>
>> On Mon, Dec 10, 2018 at 8:47 AM Woodhead, Chad <[email protected]>
>> wrote:
>>
>> I am working on a cluster/node monitoring flow and was looking for some
>> guidance.
>>
>>
>>
>> I currently have a working flow that monitors if a node gets disconnected
>> from the cluster and sends an email if a node disconnects.
>>
>>
>>
>> Here is the flow:
>>
>> (A SiteToSiteBulletinReportingTask sends to the ClusterMonitoring input
>> port)
>>
>>
>>
>> The CheckAPIForDisconnectedNode process group makes an API call to NiFi
>> confirm the node is still disconnected before sending the email.
>>
>>
>>
>> This flow works as expected. I am now wanting to update the flow to
>> automatically attempt to reconnect the node itself. When a node
>> disconnects, I capture the server name of that node. To reconnect a node,
>> you can call the API with PUT /nifi-api/controller/cluster/nodes/{id}, but
>> the problem is I don’t know the Node ID. The only place I have found I can
>> get the Node ID is via a GET /nifi-api/controller/cluster, but that API
>> only works on a node that is connected to the cluster and the way this flow
>> works, the processing can and sometimes does actually run on the node that
>> has been disconnected. Is there a way to force it so the processing is only
>> done on a cluster connected node and then use ${hostname(true)} in the API
>> call, or is there another way I can get the Node ID, even on a disconnected
>> node? I don’t want to have to hard code all of my Node ID’s somewhere.
>>
>>
>>
>> Thanks,
>>
>> Chad Woodhead
>>
>>
>>
>>
>>
>>
>>
>>

Reply via email to