public void restartJournalNode(int i) throws InterruptedException, IOException { JNInfo info = nodes[i]; JournalNode jn = info.node; Configuration conf = new Configuration(jn.getConf()); if (jn.isStarted()) { jn.stopAndJoin(0); } conf.set(DFSConfigKeys.DFS_JOURNALNODE_RPC_ADDRESS_KEY, NetUtils.getHostPortString(info.ipcAddr)); final String uri = info.httpServerURI; if (uri.startsWith("http://")) { conf.set(DFSConfigKeys.DFS_JOURNALNODE_HTTP_ADDRESS_KEY, uri.substring(("http://".length()))); } else if (info.httpServerURI.startsWith("https://")) { conf.set(DFSConfigKeys.DFS_JOURNALNODE_HTTPS_ADDRESS_KEY, uri.substring(("https://".length()))); } JournalNode newJN = new JournalNode(); newJN.setConf(conf); newJN.start(); info.node = newJN; }
private static void assertJNFailsToStart(Configuration conf, String errString) { try { JournalNode jn = new JournalNode(); jn.setConf(conf); jn.start(); } catch (Exception e) { GenericTestUtils.assertExceptionContains(errString, e); } }
private MiniJournalCluster(Builder b) throws IOException { LOG.info("Starting MiniJournalCluster with " + b.numJournalNodes + " journal nodes"); if (b.baseDir != null) { this.baseDir = new File(b.baseDir); } else { this.baseDir = new File(MiniDFSCluster.getBaseDirectory()); } nodes = new JNInfo[b.numJournalNodes]; for (int i = 0; i < b.numJournalNodes; i++) { if (b.format) { File dir = getStorageDir(i); LOG.debug("Fully deleting JN directory " + dir); FileUtil.fullyDelete(dir); } JournalNode jn = new JournalNode(); jn.setConf(createConfForNode(b, i)); jn.start(); nodes[i] = new JNInfo(jn); } }
@Before public void setup() throws Exception { File editsDir = new File(MiniDFSCluster.getBaseDirectory() + File.separator + "TestJournalNode"); FileUtil.fullyDelete(editsDir); conf.set(DFSConfigKeys.DFS_JOURNALNODE_EDITS_DIR_KEY, editsDir.getAbsolutePath()); conf.set(DFSConfigKeys.DFS_JOURNALNODE_RPC_ADDRESS_KEY, "0.0.0.0:0"); jn = new JournalNode(); jn.setConf(conf); jn.start(); journalId = "test-journalid-" + GenericTestUtils.uniqueSequenceId(); journal = jn.getOrCreateJournal(journalId); journal.format(FAKE_NSINFO); ch = new IPCLoggerChannel(conf, FAKE_NSINFO, journalId, jn.getBoundIpcAddress()); }