/** * Creates a new local tachyon master with a isolated home and port. * * @throws IOException when unable to do file operation or listen on port * @return an instance of Tachyon master */ public static LocalTachyonMaster create() throws IOException { final String tachyonHome = uniquePath(); TachyonConf tachyonConf = MasterContext.getConf(); UnderFileSystemUtils.deleteDir(tachyonHome, tachyonConf); UnderFileSystemUtils.mkdirIfNotExists(tachyonHome, tachyonConf); // Update Tachyon home in the passed TachyonConf instance. tachyonConf.set(Constants.TACHYON_HOME, tachyonHome); return new LocalTachyonMaster(tachyonHome); }
UnderFileSystemUtils.mkdirIfNotExists(mJournalFolder, tachyonConf); String[] masterServiceNames = new String[] { Constants.BLOCK_MASTER_SERVICE_NAME, }; for (String masterServiceName : masterServiceNames) { UnderFileSystemUtils.mkdirIfNotExists(PathUtils.concatPath(mJournalFolder, masterServiceName), tachyonConf); UnderFileSystemUtils.touch(mJournalFolder + "/_format_" + System.currentTimeMillis(), tachyonConf);
UnderFileSystemUtils.touch( masterJournal + Constants.FORMAT_FILE_PREFIX + System.currentTimeMillis(), tachyonConf); } else if (args[0].toUpperCase().equals("WORKER")) {
/** * Creates a new local tachyon master with a isolated port. * * @param tachyonHome Tachyon home directory, if the directory already exists, this method will * reuse any directory/file if possible, no deletion will be made * @return an instance of Tachyon master * @throws IOException when unable to do file operation or listen on port */ public static LocalTachyonMaster create(final String tachyonHome) throws IOException { TachyonConf tachyonConf = MasterContext.getConf(); UnderFileSystemUtils.mkdirIfNotExists(tachyonHome, tachyonConf); return new LocalTachyonMaster(Preconditions.checkNotNull(tachyonHome)); }
mWorkerConf.set(String.format(Constants.WORKER_TIERED_STORE_LEVEL_DIRS_QUOTA_FORMAT, 0), Long.toString(mWorkerCapacityBytes)); UnderFileSystemUtils.mkdirIfNotExists(ramdiskPath, mWorkerConf); String newPath = mTachyonHome + dirPath; newPaths.add(newPath); UnderFileSystemUtils.mkdirIfNotExists(newPath, mWorkerConf);
/** * Starts both a master and a worker using the configurations in {@link MasterContext} and * {@link WorkerContext} respectively. * * @throws IOException when the operation fails */ public void start() throws IOException { mTachyonHome = File.createTempFile("Tachyon", "U" + System.currentTimeMillis()).getAbsolutePath(); // Delete the temp dir by ufs, otherwise, permission problem may be encountered. UnderFileSystemUtils.deleteDir(mTachyonHome, MasterContext.getConf()); mWorkerDataFolder = "/datastore"; mLocalhostName = NetworkAddressUtils.getLocalHostName(100); // Disable hdfs client caching to avoid file system close() affecting other clients System.setProperty("fs.hdfs.impl.disable.cache", "true"); startMaster(); UnderFileSystemUtils.mkdirIfNotExists(mMasterConf.get(Constants.UNDERFS_ADDRESS), mMasterConf); CommonUtils.sleepMs(10); startWorker(); }