use of org.apache.storm.shade.org.apache.curator.framework.CuratorFramework in project storm by apache.
the class CuratorUtils method newCuratorStarted.
public static CuratorFramework newCuratorStarted(Map<String, Object> conf, List<String> servers, Object port, ZookeeperAuthInfo auth, List<ACL> defaultAcl) {
CuratorFramework ret = newCurator(conf, servers, port, auth, defaultAcl);
LOG.info("Starting Utils Curator (2)...");
ret.start();
return ret;
}
use of org.apache.storm.shade.org.apache.curator.framework.CuratorFramework in project storm by apache.
the class CuratorUtils method newCuratorStarted.
public static CuratorFramework newCuratorStarted(Map<String, Object> conf, List<String> servers, Object port, String root, ZookeeperAuthInfo auth, List<ACL> defaultAcl) {
CuratorFramework ret = newCurator(conf, servers, port, root, auth, defaultAcl);
LOG.info("Starting Utils Curator...");
ret.start();
return ret;
}
use of org.apache.storm.shade.org.apache.curator.framework.CuratorFramework in project storm by apache.
the class BlobStoreUtils method createZKClient.
@SuppressWarnings("checkstyle:AbbreviationAsWordInName")
public static CuratorFramework createZKClient(Map<String, Object> conf, DaemonType type) {
@SuppressWarnings("unchecked") List<String> zkServers = (List<String>) conf.get(Config.STORM_ZOOKEEPER_SERVERS);
Object port = conf.get(Config.STORM_ZOOKEEPER_PORT);
ZookeeperAuthInfo zkAuthInfo = new ZookeeperAuthInfo(conf);
CuratorFramework zkClient = CuratorUtils.newCurator(conf, zkServers, port, (String) conf.get(Config.STORM_ZOOKEEPER_ROOT), zkAuthInfo, type.getDefaultZkAcls(conf));
zkClient.start();
return zkClient;
}
use of org.apache.storm.shade.org.apache.curator.framework.CuratorFramework in project storm by apache.
the class CuratorUtilsTest method newCuratorUsesExponentialBackoffTest.
@Test
public void newCuratorUsesExponentialBackoffTest() throws InterruptedException {
final int expectedInterval = 2400;
final int expectedRetries = 10;
final int expectedCeiling = 3000;
Map<String, Object> config = Utils.readDefaultConfig();
config.put(Config.STORM_ZOOKEEPER_RETRY_INTERVAL, expectedInterval);
config.put(Config.STORM_ZOOKEEPER_RETRY_TIMES, expectedRetries);
config.put(Config.STORM_ZOOKEEPER_RETRY_INTERVAL_CEILING, expectedCeiling);
CuratorFramework curator = CuratorUtils.newCurator(config, Arrays.asList("bogus_server"), 42, "", DaemonType.WORKER.getDefaultZkAcls(config));
StormBoundedExponentialBackoffRetry policy = (StormBoundedExponentialBackoffRetry) curator.getZookeeperClient().getRetryPolicy();
Assert.assertEquals(policy.getBaseSleepTimeMs(), expectedInterval);
Assert.assertEquals(policy.getN(), expectedRetries);
Assert.assertEquals(policy.getSleepTimeMs(10, 0), expectedCeiling);
}
use of org.apache.storm.shade.org.apache.curator.framework.CuratorFramework in project storm by apache.
the class LocalFsBlobStoreSynchronizerTest method testNimbodesWithLatestVersionOfBlob.
@Test
public void testNimbodesWithLatestVersionOfBlob() throws Exception {
try (TestingServer server = new TestingServer();
CuratorFramework zkClient = CuratorFrameworkFactory.newClient(server.getConnectString(), new ExponentialBackoffRetry(1000, 3))) {
zkClient.start();
// Creating nimbus hosts containing latest version of blob
zkClient.create().creatingParentContainersIfNeeded().forPath("/blobstore/key1/nimbus1:7800-1");
zkClient.create().creatingParentContainersIfNeeded().forPath("/blobstore/key1/nimbus2:7800-2");
Set<NimbusInfo> set = BlobStoreUtils.getNimbodesWithLatestSequenceNumberOfBlob(zkClient, "key1");
assertEquals("Failed to get the correct nimbus hosts with latest blob version", (set.iterator().next()).getHost(), "nimbus2");
zkClient.delete().deletingChildrenIfNeeded().forPath("/blobstore/key1/nimbus1:7800-1");
zkClient.delete().deletingChildrenIfNeeded().forPath("/blobstore/key1/nimbus2:7800-2");
}
}
Aggregations