public ExternalClient(Configuration conf) { super(resolveHostAddresses(conf), CqlConfigHelper.getOutputNativePort(conf), ConfigHelper.getOutputKeyspaceUserName(conf), ConfigHelper.getOutputKeyspacePassword(conf), CqlConfigHelper.getSSLOptions(conf).orNull()); }
public ExternalClient(Configuration conf) { super(resolveHostAddresses(conf), CqlConfigHelper.getOutputNativePort(conf), ConfigHelper.getOutputKeyspaceUserName(conf), ConfigHelper.getOutputKeyspacePassword(conf), CqlConfigHelper.getSSLOptions(conf).orNull()); }
public ExternalClient(Configuration conf) { super(); this.conf = conf; this.hostlist = ConfigHelper.getOutputInitialAddress(conf); this.rpcPort = ConfigHelper.getOutputRpcPort(conf); this.username = ConfigHelper.getOutputKeyspaceUserName(conf); this.password = ConfigHelper.getOutputKeyspacePassword(conf); }
private BulkLoader.ExternalClient getExternalClient(Configuration conf) { Set<InetAddress> hosts = new HashSet<InetAddress>(); String outputAddress = ConfigHelper.getOutputInitialAddress(conf); if (outputAddress == null) outputAddress = "localhost"; String[] nodes = outputAddress.split(","); for (String node : nodes) { try { hosts.add(InetAddress.getByName(node)); } catch (UnknownHostException e) { throw new RuntimeException(e); } } int rpcPort = ConfigHelper.getOutputRpcPort(conf); String username = ConfigHelper.getOutputKeyspaceUserName(conf); String password = ConfigHelper.getOutputKeyspacePassword(conf); ITransportFactory transportFactory = ConfigHelper.getClientTransportFactory(conf); return new BulkLoader.ExternalClient(hosts, rpcPort, username, password, transportFactory, CqlBulkOutputFormat.getStoragePort(conf), CqlBulkOutputFormat.getSSLStoragePort(conf), getServerEncryptOpt(conf)); }
public ExternalClient(Configuration conf) { super(resolveHostAddresses(conf), CqlConfigHelper.getOutputNativePort(conf), ConfigHelper.getOutputKeyspaceUserName(conf), ConfigHelper.getOutputKeyspacePassword(conf), CqlConfigHelper.getSSLOptions(conf).orNull()); }
/** * Connects to the given server:port and returns a client based on the given socket that points to the configured * keyspace, and is logged in with the configured credentials. * * @param host fully qualified host name to connect to * @param port RPC port of the server * @param conf a job configuration * @return a cassandra client * @throws Exception set of thrown exceptions may be implementation defined, * depending on the used transport factory */ public static Cassandra.Client createAuthenticatedClient(String host, int port, Configuration conf) throws Exception { logger.debug("Creating authenticated client for CF output format"); TTransport transport = ConfigHelper.getClientTransportFactory(conf).openTransport(host, port); TProtocol binaryProtocol = new TBinaryProtocol(transport, true, true); Cassandra.Client client = new Cassandra.Client(binaryProtocol); client.set_keyspace(ConfigHelper.getOutputKeyspace(conf)); String user = ConfigHelper.getOutputKeyspaceUserName(conf); String password = ConfigHelper.getOutputKeyspacePassword(conf); if ((user != null) && (password != null)) login(user, password, client); logger.debug("Authenticated client for CF output format created successfully"); return client; }
String user = ConfigHelper.getOutputKeyspaceUserName(conf); String password = ConfigHelper.getOutputKeyspacePassword(conf); if ((user != null) && (password != null))
ConfigHelper.setOutputRpcPort(hadoopConf, CassandraSinkConfiguration.DEFAULT_OUTPUT_RPC_PORT); final Cluster.Builder builder = Cluster.builder().withClusterName(this.conf.getClusterName()); if (!Strings.isNullOrEmpty(ConfigHelper.getOutputKeyspaceUserName(hadoopConf)) && !Strings.isNullOrEmpty(ConfigHelper.getOutputKeyspacePassword(hadoopConf))) { builder.withCredentials( ConfigHelper.getOutputKeyspaceUserName(hadoopConf), ConfigHelper.getOutputKeyspacePassword(hadoopConf) );