public ACLProvider create(ZooKeeperClientConfig config){ return StringUtils.equalsIgnoreCase(config.getAuthType(),SASL_AUTH_SCHEME) ? new SaslACLProvider(config) : new DefaultACLProvider(); }
} else { // "none" LOG.info("Connecting to ZooKeeper without authentication"); aclProvider = new DefaultACLProvider(); // open to everyone
.retryPolicy(new BoundedExponentialBackoffRetry(BASE_SLEEP_TIME_MS, MAX_SLEEP_TIME_MS, MAX_RETRIES)) .compressionProvider(new PotentiallyGzippedCompressionProvider(config.getEnableCompression())) .aclProvider(config.getEnableAcl() ? new SecuredACLProvider() : new DefaultACLProvider()) .build();
private void connectWithZooKeeper() throws IOException, KeeperException, InterruptedException { int zkSessionTimeout = HBaseIndexerConfiguration.getSessionTimeout(conf); zk = new StateWatchingZooKeeper(zkConnectionString, zkSessionTimeout, new DefaultACLProvider()); final String zkRoot = conf.get("hbaseindexer.zookeeper.znode.parent"); boolean indexerNodeExists = zk.retryOperation(new ZooKeeperOperation<Boolean>() { @Override public Boolean execute() throws KeeperException, InterruptedException { return zk.exists(zkRoot, false) != null; } }); if (!indexerNodeExists) { System.err.println(); System.err.println("WARNING: No " + zkRoot + " node found in ZooKeeper."); System.err.println(); } }
} else { // "none" LOG.info("Connecting to ZooKeeper without authentication"); aclProvider = new DefaultACLProvider(); // open to everyone
} else { // "none" LOG.info("Connecting to ZooKeeper without authentication"); aclProvider = new DefaultACLProvider(); // open to everyone
} else { // "none" LOG.info("Connecting to ZooKeeper without authentication"); aclProvider = new DefaultACLProvider(); // open to everyone
} else { // "none" LOG.info("Connecting to ZooKeeper without authentication"); aclProvider = new DefaultACLProvider(); // open to everyone
private RemoteConfigurationRegistryClient createClient(RemoteConfigurationRegistryConfig config) { ACLProvider aclProvider; if (config.isSecureRegistry()) { configureSasl(config); aclProvider = new SASLOwnerACLProvider(); } else { // Clear SASL system property System.clearProperty(LOGIN_CONTEXT_NAME_PROPERTY); aclProvider = new DefaultACLProvider(); } CuratorFramework client = CuratorFrameworkFactory.builder() .connectString(config.getConnectionString()) .retryPolicy(new ExponentialBackoffRetry(1000, 3)) .aclProvider(aclProvider) .build(); client.start(); return (new ClientAdapter(client, config)); }
} else { // "none" LOG.info("Connecting to ZooKeeper without authentication"); aclProvider = new DefaultACLProvider(); // open to everyone
} else { // "none" LOG.info("Connecting to ZooKeeper without authentication"); aclProvider = new DefaultACLProvider(); // open to everyone
} else { // "none" LOG.info("Connecting to ZooKeeper without authentication"); aclProvider = new DefaultACLProvider(); // open to everyone
} else { // "none" LOG.info("Connecting to ZooKeeper without authentication"); aclProvider = new DefaultACLProvider(); // open to everyone
aclProvider = new DefaultACLProvider();
} else { // "none" LOG.info("Connecting to ZooKeeper without authentication"); aclProvider = new DefaultACLProvider(); // open to everyone
public static ZooKeeperItf connect(String connectString, int sessionTimeout) throws ZkConnectException { ZooKeeperImpl zooKeeper; try { zooKeeper = new ZooKeeperImpl(connectString, sessionTimeout, new DefaultACLProvider()); } catch (IOException e) { throw new ZkConnectException("Failed to connect with Zookeeper @ '" + connectString + "'", e); } long waitUntil = System.currentTimeMillis() + sessionTimeout; boolean connected = (States.CONNECTED).equals(zooKeeper.getState()); while (!connected && waitUntil > System.currentTimeMillis()) { try { Thread.sleep(100); } catch (InterruptedException e) { connected = (States.CONNECTED).equals(zooKeeper.getState()); break; } connected = (States.CONNECTED).equals(zooKeeper.getState()); } if (!connected) { System.out.println("Failed to connect to Zookeeper within timeout: Dumping stack: "); Thread.dumpStack(); zooKeeper.close(); throw new ZkConnectException("Failed to connect with Zookeeper @ '" + connectString + "' within timeout " + sessionTimeout); } return zooKeeper; }
try { int zkSessionTimeout = HBaseIndexerConfiguration.getSessionTimeout(conf); zk = new StateWatchingZooKeeper(hbaseIndexerZkHost, zkSessionTimeout, new DefaultACLProvider()); IndexerModelImpl indexerModel = new IndexerModelImpl(zk, conf.get(ConfKeys.ZK_ROOT_NODE, "/ngdata/hbaseindexer")); IndexerDefinition indexerDefinition = indexerModel.getIndexer(hbaseIndexerName);
aclProvider = new SaslZkACLProvider(conf, hostname); } else { aclProvider = new DefaultACLProvider();
private void createClient() throws Exception { // Connect to the ZooKeeper server RetryPolicy retryPolicy = ZKUtils.getRetryPolicy(); String zkConnectionString = ConfigurationService.get(ZK_CONNECTION_STRING); String zkNamespace = getZKNameSpace(); int zkConnectionTimeout = ConfigurationService.getInt(ZK_CONNECTION_TIMEOUT); int zkSessionTimeout = ConfigurationService.getInt(ZK_SESSION_TIMEOUT, 300); ACLProvider aclProvider; if (Services.get().getConf().getBoolean(ZK_SECURE, false)) { log.info("Connecting to ZooKeeper with SASL/Kerberos and using 'sasl' ACLs"); setJaasConfiguration(); System.setProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY, "Client"); System.setProperty("zookeeper.authProvider.1", "org.apache.zookeeper.server.auth.SASLAuthenticationProvider"); saslACL = Collections.singletonList(new ACL(Perms.ALL, new Id("sasl", getServicePrincipal()))); aclProvider = new SASLOwnerACLProvider(); } else { log.info("Connecting to ZooKeeper without authentication"); aclProvider = new DefaultACLProvider(); // open to everyone } client = CuratorFrameworkFactory.builder() .namespace(zkNamespace) .connectString(zkConnectionString) .retryPolicy(retryPolicy) .aclProvider(aclProvider) .connectionTimeoutMs(zkConnectionTimeout * 1000) // in ms .sessionTimeoutMs(zkSessionTimeout * 1000) //in ms .build(); client.start(); client.getConnectionStateListenable().addListener(new ZKConnectionListener()); }
private void createClient() throws Exception { // Connect to the ZooKeeper server RetryPolicy retryPolicy = ZKUtils.getRetryPolicy(); String zkConnectionString = ConfigurationService.get(ZK_CONNECTION_STRING); String zkNamespace = getZKNameSpace(); int zkConnectionTimeout = ConfigurationService.getInt(ZK_CONNECTION_TIMEOUT); int zkSessionTimeout = ConfigurationService.getInt(ZK_SESSION_TIMEOUT, 300); ACLProvider aclProvider; if (Services.get().getConf().getBoolean(ZK_SECURE, false)) { log.info("Connecting to ZooKeeper with SASL/Kerberos and using 'sasl' ACLs"); setJaasConfiguration(); System.setProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY, "Client"); System.setProperty("zookeeper.authProvider.1", "org.apache.zookeeper.server.auth.SASLAuthenticationProvider"); saslACL = Collections.singletonList(new ACL(Perms.ALL, new Id("sasl", getServicePrincipal()))); aclProvider = new SASLOwnerACLProvider(); } else { log.info("Connecting to ZooKeeper without authentication"); aclProvider = new DefaultACLProvider(); // open to everyone } client = CuratorFrameworkFactory.builder() .namespace(zkNamespace) .connectString(zkConnectionString) .retryPolicy(retryPolicy) .aclProvider(aclProvider) .connectionTimeoutMs(zkConnectionTimeout * 1000) // in ms .sessionTimeoutMs(zkSessionTimeout * 1000) //in ms .build(); client.start(); client.getConnectionStateListenable().addListener(new ZKConnectionListener()); }