Write file to active node on hadoop server

I have a pipeline with file reader snap writing to hadoop server. The pipeline is aborting with below error:
reason=Possible reasons can be failure in URL connection or file access denial, detail: Operation category READ is not supported in state standby.
resolution=Check for URL syntax and file access permission

The reason for failure is the specified the node name in file name is down. our hadoop server had two nodes where at any point of time only one node is active . Now my requirement is to find the active node and write the file to that particular node