Hi Yuan Youjun, Actually, RestClusterClient has a method named getWebMonitorBaseUrl which will retrieve the webmonitor's leader address when you submit job automatically.[1]
Ideally, you do not need to retrieve JM by yourself. Currently, the webmonitor is binding with JobManager, maybe if JM failover, you can not find new web monitor? Flink provided a component named "LeaderRetrievalService" to retrieval many compoment's leader, based on Zookeeper, there is a implementation named "ZooKeeperLeaderRetrievalService". In ZooKeeperHaServices, it provided a method named "getWebMonitorLeaderRetriever" to retrieve the web monitor's leader and provided a method named "getJobManagerLeaderRetriever" to retrieve JobManager's leader. And ClusterClient#getJobManagerGateway used it. [1]: https://github.com/apache/flink/blob/master/flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java#L755 Thanks, vino. 2018-07-25 11:37 GMT+08:00 Yuan,Youjun <yuanyou...@baidu.com>: > Hi all, > > > > I have a standalone cluster with 3 jobmanagers, and set *high-availability > to zookeeper*. Our client submits job by REST API(POST /jars/:jarid/run), > which means we need to know the host of the any of the current alive > jobmanagers. The problem is that, how can we know which job manager is > alive, or the host of current leader? We don’t want to access a dead JM. > > > > Thanks. > > Youjun Yuan >