code: public static void checkMasterClientService(AlluxioConfiguration alluxioConf) throws IOException {
      try (CloseableResource<FileSystemMasterClient> client =
        FileSystemContext.create(ClientContext.create(alluxioConf))
            .acquireMasterClientResource()) {
        InetSocketAddress address = client.get().getAddress();
  
        List<InetSocketAddress> addresses = Arrays.asList(address);
        MasterInquireClient inquireClient = new PollingMasterInquireClient(addresses, () ->
            new ExponentialBackoffRetry(50, 100, 2), alluxioConf);
        inquireClient.getPrimaryRpcAddress();
      } catch (UnavailableException e) {
        throw new IOException("Cannot connect to Alluxio leader master.");
      }
    }
docs: Checks if the master client service is available.
  Throws an exception if fails to determine that the master client service is running.
  
  @param alluxioConf Alluxio configuration