use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.
the class RoundRobinPolicyTest method equalsTest.
@Test
public void equalsTest() throws Exception {
AlluxioConfiguration conf = ConfigurationTestUtils.defaults();
CommonUtils.testEquals(RoundRobinPolicy.class, new Class[] { AlluxioConfiguration.class }, new Object[] { conf });
}
use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.
the class ClientContext method loadConf.
/**
* This method will load the cluster and path level configuration defaults and update
* the configuration in one RPC.
*
* This method should be synchronized so that concurrent calls to it don't continually overwrite
* the previous configuration.
*
* The cluster defaults are updated per connection establishment, or when cluster defaults
* updates are detected on client side.
*
* @param address the address to load cluster defaults from
* @param loadClusterConf whether to load cluster level configuration
* @param loadPathConf whether to load path level configuration
* @throws AlluxioStatusException
*/
public synchronized void loadConf(InetSocketAddress address, boolean loadClusterConf, boolean loadPathConf) throws AlluxioStatusException {
AlluxioConfiguration conf = mClusterConf;
if (!loadClusterConf && !loadPathConf) {
return;
}
GetConfigurationPResponse response = ConfigurationUtils.loadConfiguration(address, conf, !loadClusterConf, !loadPathConf);
if (loadClusterConf) {
mClusterConf = ConfigurationUtils.getClusterConf(response, conf, Scope.CLIENT);
mClusterConfHash = response.getClusterConfigHash();
}
if (loadPathConf) {
mPathConf = ConfigurationUtils.getPathConf(response, conf);
mPathConfHash = response.getPathConfigHash();
mIsPathConfLoaded = true;
}
}
use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.
the class UninstallCommand method run.
@Override
public int run(CommandLine cl) {
String uri = cl.getArgs()[0];
AlluxioConfiguration conf = ServerConfiguration.global();
String extensionsDir = conf.getString(PropertyKey.EXTENSIONS_DIR);
List<String> failedHosts = new ArrayList<>();
for (String host : ConfigurationUtils.getServerHostnames(conf)) {
try {
LOG.info("Attempting to uninstall extension on host {}", host);
String rmCmd = String.format("ssh %s %s rm %s", ShellUtils.COMMON_SSH_OPTS, host, PathUtils.concatPath(extensionsDir, uri));
LOG.debug("Executing: {}", rmCmd);
String output = ShellUtils.execCommand("bash", "-c", rmCmd);
LOG.debug("Succeeded w/ output: {}", output);
} catch (IOException e) {
LOG.error("Error uninstalling extension on host {}.", host, e);
failedHosts.add(host);
}
}
if (failedHosts.size() != 0) {
System.err.println("Failed to uninstall extension on hosts:");
for (String failedHost : failedHosts) {
System.err.println(failedHost);
}
return -1;
}
System.out.println("Extension uninstalled successfully.");
return 0;
}
use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.
the class Format method main.
/**
* Formats the Alluxio file system.
*
* @param args either {@code MASTER} or {@code WORKER}
*/
public static void main(String[] args) {
if (args.length != 1) {
LOG.info(USAGE);
System.exit(-1);
}
AlluxioConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults());
// Set the process type as "MASTER" since format needs to access the journal like the master.
CommonUtils.PROCESS_TYPE.set(CommonUtils.ProcessType.MASTER);
Mode mode = null;
try {
mode = Mode.valueOf(args[0].toUpperCase());
} catch (IllegalArgumentException e) {
LOG.error("Unrecognized format mode: {}", args[0]);
LOG.error("Usage: {}", USAGE);
System.exit(-1);
}
try {
format(mode, conf);
} catch (Exception e) {
LOG.error("Failed to format", e);
System.exit(-1);
}
LOG.info("Formatting complete");
System.exit(0);
}
use of alluxio.conf.AlluxioConfiguration in project alluxio by Alluxio.
the class BaseFileSystem method checkUri.
/**
* Checks an {@link AlluxioURI} for scheme and authority information. Warn the user and throw an
* exception if necessary.
*/
protected void checkUri(AlluxioURI uri) {
Preconditions.checkNotNull(uri, "uri");
if (!mFsContext.getUriValidationEnabled()) {
return;
}
if (uri.hasScheme()) {
String warnMsg = "The URI scheme \"{}\" is ignored and not required in URIs passed to" + " the Alluxio Filesystem client.";
switch(uri.getScheme()) {
case Constants.SCHEME:
LOG.warn(warnMsg, Constants.SCHEME);
break;
default:
throw new IllegalArgumentException(String.format("Scheme %s:// in AlluxioURI is invalid. Schemes in filesystem" + " operations are ignored. \"alluxio://\" or no scheme at all is valid.", uri.getScheme()));
}
}
if (uri.hasAuthority()) {
LOG.warn("The URI authority (hostname and port) is ignored and not required in URIs passed " + "to the Alluxio Filesystem client.");
AlluxioConfiguration conf = mFsContext.getClusterConf();
boolean skipAuthorityCheck = conf.isSet(PropertyKey.USER_SKIP_AUTHORITY_CHECK) && conf.getBoolean(PropertyKey.USER_SKIP_AUTHORITY_CHECK);
if (!skipAuthorityCheck) {
/* Even if we choose to log the warning, check if the Configuration host matches what the
* user passes. If not, throw an exception letting the user know they don't match.
*/
Authority configured = MasterInquireClient.Factory.create(mFsContext.getClusterConf(), mFsContext.getClientContext().getUserState()).getConnectDetails().toAuthority();
if (!configured.equals(uri.getAuthority())) {
throw new IllegalArgumentException(String.format("The URI authority %s does not match the configured value of %s.", uri.getAuthority(), configured));
}
}
}
}
Aggregations