use of org.apache.flink.shaded.curator5.org.apache.curator.retry.ExponentialBackoffRetry in project Saturn by vipshop.
the class InitSaturnJob method main.
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
String zkConnection = System.getProperty("VIP_SATURN_ZK_CONNECTION");
System.out.println("zkConnection=" + zkConnection);
if (zkConnection == null || "".equals(zkConnection.trim())) {
zkConnection = "localhost:2182";
}
CuratorFramework client = CuratorFrameworkFactory.builder().connectString(zkConnection).namespace("saturn-it.vip.com").sessionTimeoutMs(10000).retryPolicy(retryPolicy).build();
client.start();
addJavaJob(client, "demoJavaJob");
System.out.println("done add a java-job.");
addShellJob(client, "demoShellJob");
System.out.println("done add a shell-job.");
}
use of org.apache.flink.shaded.curator5.org.apache.curator.retry.ExponentialBackoffRetry in project fabric8 by jboss-fuse.
the class CuratorFactoryBean method getObject.
// FactoryBean interface
// -------------------------------------------------------------------------
public CuratorFramework getObject() throws Exception {
LOG.debug("Connecting to ZooKeeper on " + connectString);
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder().connectString(connectString).retryPolicy(new ExponentialBackoffRetry(5, 10)).connectionTimeoutMs(getTimeout());
if (password != null && !password.isEmpty()) {
builder.aclProvider(new CuratorACLManager());
builder.authorization("digest", ("fabric:" + password).getBytes("UTF-8"));
}
this.curator = builder.build();
LOG.debug("Starting curator " + curator);
curator.start();
return curator;
}
use of org.apache.flink.shaded.curator5.org.apache.curator.retry.ExponentialBackoffRetry in project knox by apache.
the class HBaseZookeeperURLManagerTest method setup.
@Before
public void setup() throws Exception {
cluster = new TestingCluster(3);
cluster.start();
CuratorFramework zooKeeperClient = CuratorFrameworkFactory.builder().connectString(cluster.getConnectString()).retryPolicy(new ExponentialBackoffRetry(1000, 3)).build();
zooKeeperClient.start();
zooKeeperClient.create().forPath("/hbase-unsecure");
zooKeeperClient.create().forPath("/hbase-unsecure/rs");
zooKeeperClient.close();
}
use of org.apache.flink.shaded.curator5.org.apache.curator.retry.ExponentialBackoffRetry in project knox by apache.
the class HS2ZookeeperURLManagerTest method setup.
@Before
public void setup() throws Exception {
cluster = new TestingCluster(3);
cluster.start();
CuratorFramework zooKeeperClient = CuratorFrameworkFactory.builder().connectString(cluster.getConnectString()).retryPolicy(new ExponentialBackoffRetry(1000, 3)).build();
String host1 = "hive.server2.authentication=NONE;hive.server2.transport.mode=http;hive.server2.thrift.http.path=cliservice;" + "hive.server2.thrift.http.port=10001;hive.server2.thrift.bind.host=host1;hive.server2.use.SSL=true";
String host2 = "hive.server2.authentication=NONE;hive.server2.transport.mode=http;hive.server2.thrift.http.path=foobar;" + "hive.server2.thrift.http.port=10002;hive.server2.thrift.bind.host=host2;hive.server2.use.SSL=false";
String host3 = "hive.server2.authentication=NONE;hive.server2.transport.mode=http;hive.server2.thrift.http.path=cliservice;" + "hive.server2.thrift.http.port=10003;hive.server2.thrift.bind.host=host3;hive.server2.use.SSL=false";
String host4 = "hive.server2.authentication=NONE;hive.server2.transport.mode=http;hive.server2.thrift.http.path=cliservice;" + "hive.server2.thrift.http.port=10004;hive.server2.thrift.bind.host=host4;hive.server2.use.SSL=true";
zooKeeperClient.start();
zooKeeperClient.create().forPath("/hiveServer2");
zooKeeperClient.create().forPath("/hiveServer2/host1", host1.getBytes());
zooKeeperClient.create().forPath("/hiveServer2/host2", host2.getBytes());
zooKeeperClient.create().forPath("/hiveServer2/host3", host3.getBytes());
zooKeeperClient.create().forPath("/hiveServer2/host4", host4.getBytes());
zooKeeperClient.close();
manager = new HS2ZookeeperURLManager();
HaServiceConfig config = new DefaultHaServiceConfig("HIVE");
config.setEnabled(true);
config.setZookeeperEnsemble(cluster.getConnectString());
config.setZookeeperNamespace("hiveServer2");
manager.setConfig(config);
}
use of org.apache.flink.shaded.curator5.org.apache.curator.retry.ExponentialBackoffRetry in project knox by apache.
the class SOLRZookeeperURLManagerTest method setup.
@Before
public void setup() throws Exception {
cluster = new TestingCluster(3);
cluster.start();
CuratorFramework zooKeeperClient = CuratorFrameworkFactory.builder().connectString(cluster.getConnectString()).retryPolicy(new ExponentialBackoffRetry(1000, 3)).build();
zooKeeperClient.start();
zooKeeperClient.create().forPath("/live_nodes");
zooKeeperClient.create().forPath("/live_nodes/host1:8983_solr");
zooKeeperClient.create().forPath("/live_nodes/host2:8983_solr");
zooKeeperClient.create().forPath("/live_nodes/host3:8983_solr");
zooKeeperClient.close();
manager = new SOLRZookeeperURLManager();
HaServiceConfig config = new DefaultHaServiceConfig("SOLR");
config.setEnabled(true);
config.setZookeeperEnsemble(cluster.getConnectString());
manager.setConfig(config);
}
Aggregations