Search in sources :

Example 26 with InstancedConfiguration

use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.

the class AlluxioMasterMonitor method main.

/**
 * Starts the Alluxio master monitor.
 *
 * @param args command line arguments, should be empty
 */
public static void main(String[] args) {
    if (args.length != 0) {
        LOG.warn("java -cp {} {}", RuntimeConstants.ALLUXIO_JAR, AlluxioMasterMonitor.class.getCanonicalName());
        LOG.warn("ignoring arguments");
    }
    AlluxioConfiguration alluxioConf = new InstancedConfiguration(ConfigurationUtils.defaults());
    MasterHealthCheckClient.Builder builder = new MasterHealthCheckClient.Builder(alluxioConf);
    if (ConfigurationUtils.isHaMode(alluxioConf)) {
        builder.withProcessCheck(true);
    } else {
        builder.withProcessCheck(false);
    }
    HealthCheckClient client = builder.build();
    if (!client.isServing()) {
        System.exit(1);
    }
    System.exit(0);
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) AlluxioConfiguration(alluxio.conf.AlluxioConfiguration) HealthCheckClient(alluxio.HealthCheckClient)

Example 27 with InstancedConfiguration

use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.

the class AlluxioJobMasterMonitor method main.

/**
 * Starts the Alluxio job_master monitor.
 *
 * @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, AlluxioJobMasterMonitor.class.getCanonicalName());
        LOG.warn("ignoring arguments");
    }
    AlluxioConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults());
    HealthCheckClient client;
    // checking for the running process.
    if (ConfigurationUtils.isHaMode(conf)) {
        client = new MasterHealthCheckClient.Builder(conf).withAlluxioMasterType(MasterHealthCheckClient.MasterType.JOB_MASTER).build();
    } else {
        client = new JobMasterRpcHealthCheckClient(NetworkAddressUtils.getConnectAddress(NetworkAddressUtils.ServiceType.JOB_MASTER_RPC, conf), AlluxioMasterMonitor.TWO_MIN_EXP_BACKOFF, conf);
    }
    if (!client.isServing()) {
        System.exit(1);
    }
    System.exit(0);
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) AlluxioConfiguration(alluxio.conf.AlluxioConfiguration) HealthCheckClient(alluxio.HealthCheckClient) MasterHealthCheckClient(alluxio.master.MasterHealthCheckClient) MasterHealthCheckClient(alluxio.master.MasterHealthCheckClient)

Example 28 with InstancedConfiguration

use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.

the class FileSystemAdminShell method main.

/**
 * Manage Alluxio file system.
 *
 * @param args array of arguments given by the user's input from the terminal
 */
public static void main(String[] args) throws IOException {
    int ret;
    InstancedConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults());
    if (!ConfigurationUtils.masterHostConfigured(conf) && args.length > 0) {
        System.out.println(ConfigurationUtils.getMasterHostNotConfiguredMessage("Alluxio fsadmin shell"));
        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);
    try (FileSystemAdminShell fsAdminShell = new FileSystemAdminShell(conf)) {
        ret = fsAdminShell.run(args);
    }
    System.exit(ret);
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration)

Example 29 with InstancedConfiguration

use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.

the class JobServiceMaxThroughput method runSuite.

@Override
public JobServiceMaxThroughputSummary runSuite(String[] args) throws Exception {
    try (JobMasterClient client = JobMasterClient.Factory.create(JobMasterClientContext.newBuilder(ClientContext.create(new InstancedConfiguration(ConfigurationUtils.defaults()))).build())) {
        mNumWorkers = client.getAllWorkerHealth().size();
    }
    if (mNumWorkers <= 0) {
        throw new IllegalStateException("No workers available for testing!");
    }
    JobServiceMaxThroughputSummary summary = new JobServiceMaxThroughputSummary();
    summary.setParameters(mParameters);
    List<String> baseArgs = new ArrayList<>(Arrays.asList(args));
    int best = getBestThroughput(mParameters.mTargetThroughput, summary, baseArgs, mNumWorkers);
    LOG.info("max throughput: " + best);
    summary.setEndTimeMs(CommonUtils.getCurrentMs());
    summary.setMaxThroughput(best);
    return summary;
}
Also used : JobMasterClient(alluxio.client.job.JobMasterClient) InstancedConfiguration(alluxio.conf.InstancedConfiguration) ArrayList(java.util.ArrayList) JobServiceMaxThroughputSummary(alluxio.stress.jobservice.JobServiceMaxThroughputSummary)

Example 30 with InstancedConfiguration

use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.

the class CpCommandIntegrationTest method copyFileWithPreservedAttributes.

/**
 * Tests copying a file with attributes preserved.
 */
@Test
public void copyFileWithPreservedAttributes() throws Exception {
    InstancedConfiguration conf = new InstancedConfiguration(ServerConfiguration.global());
    // avoid chown on UFS since test might not be run with root
    conf.set(PropertyKey.USER_FILE_WRITE_TYPE_DEFAULT, "MUST_CACHE");
    try (FileSystemShell fsShell = new FileSystemShell(conf)) {
        String testDir = FileSystemShellUtilsTest.resetFileHierarchy(sFileSystem);
        AlluxioURI srcFile = new AlluxioURI(testDir + "/foobar4");
        String owner = TEST_USER_1.getUser();
        String group = "staff";
        short mode = 0422;
        List<AclEntry> entries = new ArrayList<>();
        entries.add(new AclEntry.Builder().setType(AclEntryType.NAMED_USER).setSubject(TEST_USER_2.getUser()).addAction(AclAction.READ).addAction(AclAction.WRITE).addAction(AclAction.EXECUTE).build());
        entries.add(new AclEntry.Builder().setType(AclEntryType.NAMED_GROUP).setSubject(group).addAction(AclAction.WRITE).addAction(AclAction.EXECUTE).build());
        sFileSystem.setAttribute(srcFile, SetAttributePOptions.newBuilder().setOwner(owner).setGroup(group).setMode(new Mode(mode).toProto()).setPinned(true).setReplicationMin(2).setReplicationMax(4).setCommonOptions(FileSystemMasterCommonPOptions.newBuilder().setTtl(12345)).build());
        sFileSystem.setAcl(srcFile, SetAclAction.MODIFY, entries);
        int ret = fsShell.run("cp", "-p", testDir + "/foobar4", testDir + "/bar");
        AlluxioURI dstFile = new AlluxioURI(testDir + "/bar/foobar4");
        Assert.assertEquals(0, ret);
        Assert.assertTrue(sFileSystem.exists(dstFile));
        verifyPreservedAttributes(srcFile, dstFile);
    }
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) Mode(alluxio.security.authorization.Mode) AclEntry(alluxio.security.authorization.AclEntry) ArrayList(java.util.ArrayList) FileSystemShell(alluxio.cli.fs.FileSystemShell) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) AlluxioURI(alluxio.AlluxioURI) AbstractFileSystemShellTest(alluxio.client.cli.fs.AbstractFileSystemShellTest) Test(org.junit.Test) FileSystemShellUtilsTest(alluxio.client.cli.fs.FileSystemShellUtilsTest)

Aggregations

InstancedConfiguration (alluxio.conf.InstancedConfiguration)94 Test (org.junit.Test)35 AlluxioConfiguration (alluxio.conf.AlluxioConfiguration)16 AlluxioURI (alluxio.AlluxioURI)14 AlluxioProperties (alluxio.conf.AlluxioProperties)11 ArrayList (java.util.ArrayList)11 IOException (java.io.IOException)10 HashMap (java.util.HashMap)9 BaseHubTest (alluxio.hub.test.BaseHubTest)8 InetSocketAddress (java.net.InetSocketAddress)8 FileSystemShell (alluxio.cli.fs.FileSystemShell)6 FileSystemContext (alluxio.client.file.FileSystemContext)6 HealthCheckClient (alluxio.HealthCheckClient)5 AbstractFileSystemShellTest (alluxio.client.cli.fs.AbstractFileSystemShellTest)5 FileSystemShellUtilsTest (alluxio.client.cli.fs.FileSystemShellUtilsTest)5 MasterInquireClient (alluxio.master.MasterInquireClient)5 Properties (java.util.Properties)5 ParseException (org.apache.commons.cli.ParseException)5 ClientContext (alluxio.ClientContext)4 FileSystem (alluxio.client.file.FileSystem)4