Updated on 2022-09-14 GMT+08:00

Querying Cluster Information Using REST

Function

Use the REST service to transfer the URL consisting of the host and port to obtain the cluster version and status information through HTTPS.

Example Code

  • Obtaining the cluster version information

    The following code snippets are in the getClusterVersion method in the HBaseRestTest class of the hbase-rest-example\src\main\java\com\huawei\hadoop\hbase\examples packet.

    private void getClusterVersion(String url) {
         String endpoint = "/version/cluster";
         Optional<ResultModel> result = sendAction(url + endpoint, MethodType.GET, null);
         handleNormalResult((Optional<ResultModel>) result);
     }
  • Obtaining the cluster status information

    The following code snippets are in the getClusterStatus method in the HBaseRestTest class of the hbase-rest-example\src\main\java\com\huawei\hadoop\hbase\examples packet.

    private void getClusterStatus(String url) {
         String endpoint = "/status/cluster";
         Optional<ResultModel> result = sendAction(url + endpoint, MethodType.GET, null);
         handleNormalResult(result);
     }