/** * @return default UFS configuration */ public static UnderFileSystemConfiguration defaults() { return new UnderFileSystemConfiguration(ConfigurationUtils.defaults()); }
/** * Manage Alluxio file system. * * @param args array of arguments given by the user's input from the terminal */ public static void main(String[] args) { InstancedConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults()); if (!ConfigurationUtils.masterHostConfigured(conf) && args.length > 0) { System.out.println("Cannot run alluxio fsadmin shell as master hostname is not configured."); System.exit(1); } // Reduce the RPC retry max duration to fall earlier for CLIs conf.set(PropertyKey.USER_RPC_RETRY_MAX_DURATION, "5s", Source.DEFAULT); FileSystemAdminShell fsAdminShell = new FileSystemAdminShell(conf); System.exit(fsAdminShell.run(args)); }
/** * Resets the {@link AlluxioConfiguration} back the defaults and values from * alluxio-site properties. */ public static void reset() { ConfigurationUtils.reloadProperties(); sConf = new InstancedConfiguration(ConfigurationUtils.defaults()); }
/** * Returns an instance of {@link AlluxioConfiguration} with the defaults and values from * alluxio-site properties. * * @return the set of Alluxio properties loaded from the site-properties file */ public static AlluxioProperties defaults() { if (sDefaultProperties == null) { synchronized (DEFAULT_PROPERTIES_LOCK) { // We don't want multiple threads to reload // properties at the same time. // Check if properties are still null so we don't reload a second time. if (sDefaultProperties == null) { reloadProperties(); } } } return sDefaultProperties.copy(); }
/** * Starts the Alluxio proxy. * * @param args command line arguments, should be empty */ public static void main(String[] args) { if (args.length != 0) { LOG.info("java -cp {} {}", RuntimeConstants.ALLUXIO_JAR, AlluxioProxy.class.getCanonicalName()); System.exit(-1); } if (!ConfigurationUtils.masterHostConfigured(ServerConfiguration.global())) { ProcessUtils.fatalError(LOG, "Cannot run alluxio proxy; master hostname is not " + "configured. Please modify %s to either set %s or configure zookeeper with " + "%s=true and %s=[comma-separated zookeeper master addresses]", Constants.SITE_PROPERTIES, PropertyKey.MASTER_HOSTNAME.toString(), PropertyKey.ZOOKEEPER_ENABLED.toString(), PropertyKey.ZOOKEEPER_ADDRESS.toString()); } CommonUtils.PROCESS_TYPE.set(CommonUtils.ProcessType.PROXY); ProxyProcess process = ProxyProcess.Factory.create(); ProcessUtils.run(process); }
if (!ConfigurationUtils.masterHostConfigured(ServerConfiguration.global())) { System.out.println(String.format( "Cannot run alluxio job worker; master hostname is not " if (!ConfigurationUtils.jobMasterHostConfigured(ServerConfiguration.global())) { System.out.println(String.format( "Cannot run alluxio job worker; job master hostname is not "
/** * Sets the master id and registers with the Alluxio leader master. */ private void setIdAndRegister() throws IOException { mMasterId.set(mMasterClient.getId(mMasterAddress)); mMasterClient.register(mMasterId.get(), ConfigurationUtils.getConfiguration(ServerConfiguration.global(), Scope.MASTER)); }
/** * @param conf the configuration to use * @return whether the configuration describes how to find the master host, either through * explicit configuration or through zookeeper */ public static boolean masterHostConfigured(AlluxioConfiguration conf) { boolean usingZk = conf.getBoolean(PropertyKey.ZOOKEEPER_ENABLED) && conf.isSet(PropertyKey.ZOOKEEPER_ADDRESS); return conf.isSet(PropertyKey.MASTER_HOSTNAME) || usingZk || getMasterRpcAddresses(conf).size() > 1; }
properties.sort(Comparator.comparing(ConfigProperty::getName)); for (ConfigProperty property : properties) { String value = ConfigurationUtils.valueAsString(property.getValue()); output.append(String.format("%s=%s", property.getName(), value)); if (cmd.hasOption(SOURCE_OPTION_NAME)) {
/** * This method will attempt to load the cluster defaults and update the configuration if * necessary. * * This method should be synchronized so that concurrent calls to it don't continually overwrite * the previous configuration. The cluster defaults should only ever need to be updated once * per {@link ClientContext} reference. * * @param address the address to load cluster defaults from * @throws AlluxioStatusException */ protected synchronized void updateWithClusterDefaults(InetSocketAddress address) throws AlluxioStatusException { mConf = ConfigurationUtils.loadClusterDefaults(address, mConf); }
@AfterClass public static void after() { ConfigurationUtils.reloadProperties(); }
if (!ConfigurationUtils.masterHostConfigured(ServerConfiguration.global())) { ProcessUtils.fatalError(LOG, "Cannot run alluxio worker; master hostname is not "
/** * Registers with the Alluxio master. This should be called before the continuous heartbeat thread * begins. */ private void registerWithMaster() throws IOException { BlockStoreMeta storeMeta = mBlockWorker.getStoreMetaFull(); StorageTierAssoc storageTierAssoc = new WorkerStorageTierAssoc(); List<ConfigProperty> configList = ConfigurationUtils.getConfiguration(ServerConfiguration.global(), Scope.WORKER); mMasterClient.register(mWorkerId.get(), storageTierAssoc.getOrderedStorageAliases(), storeMeta.getCapacityBytesOnTiers(), storeMeta.getUsedBytesOnTiers(), storeMeta.getBlockList(), configList); }
/** * @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), conf.getInt(PropertyKey.ZOOKEEPER_LEADER_INQUIRY_RETRY_COUNT)); } else if (ConfigurationUtils.getMasterRpcAddresses(conf).size() > 1) { return new PollingMasterInquireClient( ConfigurationUtils.getMasterRpcAddresses(conf), conf); } else { return new SingleMasterInquireClient( NetworkAddressUtils.getConnectAddress(ServiceType.MASTER_RPC, conf)); } }
/** * Gets Web UI ServerConfiguration page data. * * @return the response object */ @GET @Path(WEBUI_CONFIG) @ReturnType("alluxio.wire.MasterWebUIConfiguration") public Response getWebUIConfiguration() { return RestUtils.call(() -> { MasterWebUIConfiguration response = new MasterWebUIConfiguration(); response.setWhitelist(mFileSystemMaster.getWhiteList()); TreeSet<Triple<String, String, String>> sortedProperties = new TreeSet<>(); Set<String> alluxioConfExcludes = Sets.newHashSet(PropertyKey.MASTER_WHITELIST.toString()); for (ConfigProperty configProperty : mMetaMaster .getConfiguration(GetConfigurationPOptions.newBuilder().setRawValue(true).build())) { String confName = configProperty.getName(); if (!alluxioConfExcludes.contains(confName)) { sortedProperties.add(new ImmutableTriple<>(confName, ConfigurationUtils.valueAsString(configProperty.getValue()), configProperty.getSource())); } } response.setConfiguration(sortedProperties); return response; }, ServerConfiguration.global()); }
/** * Loads cluster default values from the meta master. * * @param address the master address */ public static synchronized void loadClusterDefaults(InetSocketAddress address) throws AlluxioStatusException { AlluxioConfiguration conf = ConfigurationUtils.loadClusterDefaults(address, global()); sConf = new InstancedConfiguration(conf.copyProperties(), conf.clusterDefaultsLoaded()); }
/** * Console program that validates the configuration. * * @param args there are no arguments needed */ public static void main(String[] args) { LOG.info("Validating configuration."); try { new InstancedConfiguration(ConfigurationUtils.defaults()).validate(); LOG.info("Configuration is valid."); } catch (IllegalStateException e) { LOG.error("Configuration is invalid: {}", e.getMessage()); System.exit(-1); } System.exit(0); }
/** * Main method, starts a new JobShell. * * @param argv array of arguments given by the user's input from the terminal */ public static void main(String[] argv) throws IOException { int ret; InstancedConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults()); if (!ConfigurationUtils.masterHostConfigured(conf) && argv.length > 0) { System.out.println(String.format( "Cannot run alluxio job shell; master hostname is not " + "configured. Please modify %s to either set %s or configure zookeeper with " + "%s=true and %s=[comma-separated zookeeper master addresses]", Constants.SITE_PROPERTIES, PropertyKey.MASTER_HOSTNAME.toString(), PropertyKey.ZOOKEEPER_ENABLED.toString(), PropertyKey.ZOOKEEPER_ADDRESS.toString())); System.exit(1); } try (JobShell shell = new JobShell(conf)) { ret = shell.run(argv); } System.exit(ret); }
public void resetConf() { ConfigurationUtils.reloadProperties(); mConfiguration = ConfigurationTestUtils.defaults(); }
/** * Starts the Alluxio proxy. * * @param args command line arguments, should be empty */ public static void main(String[] args) { if (args.length != 0) { LOG.info("java -cp {} {}", RuntimeConstants.ALLUXIO_JAR, AlluxioProxy.class.getCanonicalName()); System.exit(-1); } if (!ConfigurationUtils.masterHostConfigured()) { ProcessUtils.fatalError(LOG, "Cannot run alluxio proxy; master hostname is not " + "configured. Please modify %s to either set %s or configure zookeeper with " + "%s=true and %s=[comma-separated zookeeper master addresses]", Constants.SITE_PROPERTIES, PropertyKey.MASTER_HOSTNAME.toString(), PropertyKey.ZOOKEEPER_ENABLED.toString(), PropertyKey.ZOOKEEPER_ADDRESS.toString()); } CommonUtils.PROCESS_TYPE.set(CommonUtils.ProcessType.PROXY); ProxyProcess process = ProxyProcess.Factory.create(); ProcessUtils.run(process); }