code: private boolean masterExists() {
  
      String webPort = mAlluxioConf.get(PropertyKey.MASTER_WEB_PORT);
  
      try {
        URL myURL = new URL("http://" + mMasterAddress + ":" + webPort + Constants.REST_API_PREFIX + "/master/version");
        LOG.debug("Checking for master at: " + myURL.toString());
        HttpURLConnection connection = (HttpURLConnection) myURL.openConnection();
        connection.setRequestMethod(HttpMethod.GET);
        int resCode = connection.getResponseCode();
        LOG.debug("Response code from master was: " + Integer.toString(resCode));
  
        connection.disconnect();
        return resCode == HttpURLConnection.HTTP_OK;
      } catch (MalformedURLException e) {
        LOG.error("Malformed URL in attempt to check if master is running already", e);
      } catch (IOException e) {
        LOG.debug("No existing master found", e);
      }
  
      return false;
    }
docs: Checks if an Alluxio master node is already running
  or not on the master address given.
  
  @return true if master exists, false otherwise