private void start0() { zkPeers = createPeers(3); zkAddresses = allocateAddresses(zkPeers); peerCurators = createCurators(zkAddresses); System.setProperty("zookeeper.jmx.log4j.disable", "true"); cluster = new TestingCluster(zkPeers); zkServers = cluster.getServers(); try { cluster.start(); } catch (Exception e) { stop(); Throwables.throwIfUnchecked(e); throw new RuntimeException(e); } }
void setUp() throws Exception { testingCluster = new TestingCluster(1); testingCluster.start(); cf = CuratorFrameworkFactory.builder() .connectString(testingCluster.getConnectString()) .retryPolicy(new ExponentialBackoffRetry(1, 10)) .compressionProvider(new PotentiallyGzippedCompressionProvider(false)) .build(); cf.start(); cf.blockUntilConnected(); cf.create().creatingParentsIfNeeded().forPath(basePath); cf.create().creatingParentsIfNeeded().forPath(tasksPath); }
testingCluster.start();
testingCluster.start();
testingCluster.start();
testingCluster.start();
public static synchronized void startZookeeperCluster() { File file1 = new File(DATA_DIR + "1"); File file2 = new File(DATA_DIR + "2"); File file3 = new File(DATA_DIR + "3"); file1.mkdirs(); file2.mkdirs(); file3.mkdirs(); InstanceSpec instanceSpec1 = new InstanceSpec(file1, 2182, 2988, 3988,true, 1); InstanceSpec instanceSpec2 = new InstanceSpec(file2, 3182, 2989, 3989,true, 2); InstanceSpec instanceSpec3 = new InstanceSpec(file3, 4182, 2990, 3990,true, 3); if (server == null) { server = new TestingCluster(instanceSpec1, instanceSpec2, instanceSpec3); try { server.start(); } catch (Exception e) { throw new RuntimeException(e); } } }
public static synchronized void startZookeeperCluster() { File file1 = new File(DATA_DIR + "1"); File file2 = new File(DATA_DIR + "2"); File file3 = new File(DATA_DIR + "3"); file1.mkdirs(); file2.mkdirs(); file3.mkdirs(); InstanceSpec instanceSpec1 = new InstanceSpec(file1, 2182, 2988, 3988,true, 1); InstanceSpec instanceSpec2 = new InstanceSpec(file2, 3182, 2989, 3989,true, 2); InstanceSpec instanceSpec3 = new InstanceSpec(file3, 4182, 2990, 3990,true, 3); if (server == null) { server = new TestingCluster(instanceSpec1, instanceSpec2, instanceSpec3); try { server.start(); } catch (Exception e) { throw new RuntimeException(e); } } }
private void start0() { zkPeers = createPeers(3); zkAddresses = allocateAddresses(zkPeers); peerCurators = createCurators(zkAddresses); System.setProperty("zookeeper.jmx.log4j.disable", "true"); cluster = new TestingCluster(zkPeers); zkServers = cluster.getServers(); try { cluster.start(); } catch (Exception e) { stop(); throw Throwables.propagate(e); } }
@Before public void setUp() throws Exception { Logger rootLogger = LogManager.getRootLogger(); rootLogger.setLevel(Level.INFO); conf = new Configuration(); conf.setBoolean(YarnConfiguration.RM_HA_ENABLED, true); conf.setBoolean(YarnConfiguration.CURATOR_LEADER_ELECTOR, true); conf.set(YarnConfiguration.RM_CLUSTER_ID, "cluster1"); conf.set(YarnConfiguration.RM_HA_IDS, RM1_NODE_ID + "," + RM2_NODE_ID); for (String confKey : YarnConfiguration.getServiceAddressConfKeys(conf)) { conf.set(HAUtil.addSuffix(confKey, RM1_NODE_ID), RM1_ADDRESS); conf.set(HAUtil.addSuffix(confKey, RM2_NODE_ID), RM2_ADDRESS); } zkCluster = new TestingCluster(3); conf.set(YarnConfiguration.RM_ZK_ADDRESS, zkCluster.getConnectString()); zkCluster.start(); }
@BeforeClass public static void setup() { testingCluster = new TestingCluster(numberOfServersInTestingCluster); try { testingCluster.start(); testingClusterConnectionString = testingCluster.getConnectString(); // Sometimes useful for manual debugging: // testingClusterConnectionString = "localhost:2181"; RetryPolicy retryPolicy = new RetryNTimes( Config.getIntDefault(Config.ZK_CURATOR_SLEEP_TIME_BETWEEN_RETRIES), Config.getIntDefault(Config.ZK_CURATOR_NUMBER_OF_RETRIES)); CuratorFrameworkFactory.Builder cffBuilder = CuratorFrameworkFactory.builder() .connectString(testingClusterConnectionString) .sessionTimeoutMs(Config.getIntDefault(Config.ZK_SESSION_TIMEOUT)) .connectionTimeoutMs(Config.getIntDefault(Config.ZK_CONNECTION_TIMEOUT)) .retryPolicy(retryPolicy) .defaultData(new byte[0]); zkClient = cffBuilder.build(); zkClient.start(); try { zkClient.blockUntilConnected(); } catch (Exception e) { logger.error("There was an unrecoverable exception during the ZooKeeper session establishment. Aborting.", e); throw new RuntimeException(e); } } catch (Exception e) { logger.error("An exception occurred while trying to start the ZK test cluster!", e); throw new RuntimeException(e); } }
@Test public void testZKClusterDown() throws Exception { rm1 = startRM("rm1", HAServiceState.ACTIVE); // stop zk cluster zkCluster.stop(); waitFor(rm1, HAServiceState.STANDBY); Collection<InstanceSpec> instanceSpecs = zkCluster.getInstances(); zkCluster = new TestingCluster(instanceSpecs); zkCluster.start(); // rm becomes active again waitFor(rm1, HAServiceState.ACTIVE); }