/** * Gets the port number on a given service type. If user defined port number is not explicitly * specified, Alluxio will use the default service port. * * @param service Service type used to connect * @param config configuration * @return the service port number */ public static int getPort(ServiceType service, AlluxioConfiguration config) { return config.getInt(service.mPortKey); }
/** * @param conf configuration for creating the master inquire client * @return a master inquire client */ public static MasterInquireClient create(AlluxioConfiguration conf) { if (conf.getBoolean(PropertyKey.ZOOKEEPER_ENABLED)) { return ZkMasterInquireClient.getClient(conf.get(PropertyKey.ZOOKEEPER_ADDRESS), conf.get(PropertyKey.ZOOKEEPER_ELECTION_PATH), conf.get(PropertyKey.ZOOKEEPER_LEADER_PATH)); } else { return new SingleMasterInquireClient( NetworkAddressUtils.getConnectAddress(ServiceType.MASTER_RPC, conf)); } }
/** * Merges Hadoop {@link org.apache.hadoop.conf.Configuration} into the Alluxio configuration. * * @param source the {@link org.apache.hadoop.conf.Configuration} to merge * @param alluxioConfiguration the Alluxio configuration to merge to */ public static void mergeHadoopConfiguration(org.apache.hadoop.conf.Configuration source, AlluxioConfiguration alluxioConfiguration) { // Load Alluxio configuration if any and merge to the one in Alluxio file system // Push Alluxio configuration to the Job configuration Properties alluxioConfProperties = new Properties(); // Load any Alluxio configuration parameters existing in the Hadoop configuration. for (Map.Entry<String, String> entry : source) { String propertyName = entry.getKey(); if (PropertyKey.isValid(propertyName)) { alluxioConfProperties.put(propertyName, entry.getValue()); } } LOG.info("Loading Alluxio properties from Hadoop configuration: {}", alluxioConfProperties); // Merge the relevant Hadoop configuration into Alluxio's configuration. // TODO(jiri): support multiple client configurations (ALLUXIO-2034) alluxioConfiguration.merge(alluxioConfProperties, Source.RUNTIME); alluxioConfiguration.validate(); } }
/** * @param opts options for formatting the configuration values * @return a map from all configuration property names to their values; values may potentially be * null */ Map<String, String> toMap(ConfigurationValueOptions opts);
/** * @param conf configuration for creating the master inquire client * @return the connect string represented by the configuration */ public static ConnectDetails getConnectDetails(AlluxioConfiguration conf) { if (conf.getBoolean(PropertyKey.ZOOKEEPER_ENABLED)) { return new ZkMasterConnectDetails(conf.get(PropertyKey.ZOOKEEPER_ADDRESS), conf.get(PropertyKey.ZOOKEEPER_LEADER_PATH)); } else { return new SingleMasterConnectDetails( NetworkAddressUtils.getConnectAddress(ServiceType.MASTER_RPC, conf)); } }
/** * @param key the key to get the value for * @param defaultValue the value to return if no value is set for the specified key * @param options options for getting configuration value * @return the value */ default String getOrDefault(PropertyKey key, String defaultValue, ConfigurationValueOptions options) { return isSet(key) ? get(key, options) : defaultValue; }
if (conf.isSet(service.mHostNameKey)) { String connectHost = conf.get(service.mHostNameKey); if (!connectHost.isEmpty() && !connectHost.equals(WILDCARD_ADDRESS)) { return connectHost; if (conf.isSet(service.mBindHostKey)) { String bindHost = conf.get(service.mBindHostKey); if (!bindHost.isEmpty() && !bindHost.equals(WILDCARD_ADDRESS)) { return bindHost;