Example usage for org.apache.cassandra.hadoop ConfigHelper getOutputInitialAddress

List of usage examples for org.apache.cassandra.hadoop ConfigHelper getOutputInitialAddress

Introduction

In this page you can find the example usage for org.apache.cassandra.hadoop ConfigHelper getOutputInitialAddress.

Prototype

public static String getOutputInitialAddress(Configuration conf) 

Source Link

Usage

From source file:com.buzzinate.dm.cassandra.ColumnFamilyOutputFormat.java

License:Apache License

private void checkOutputSpecs(Configuration conf) {
    if (ConfigHelper.getOutputKeyspace(conf) == null || ConfigHelper.getOutputColumnFamily(conf) == null) {
        throw new UnsupportedOperationException(
                "you must set the keyspace and columnfamily with setColumnFamily()");
    }//  www  .  java  2  s  .com
    if (ConfigHelper.getOutputPartitioner(conf) == null)
        throw new UnsupportedOperationException(
                "You must set the output partitioner to the one used by your Cassandra cluster");
    if (ConfigHelper.getOutputInitialAddress(conf) == null)
        throw new UnsupportedOperationException("You must set the initial output address to a Cassandra node");
}

From source file:com.dse.pig.udfs.CqlStorage.java

License:Apache License

/** set store configuration settings */
public void setStoreLocation(String location, Job job) throws IOException {
    conf = job.getConfiguration();//from  ww  w .jav  a 2s. co m
    setLocationFromUri(location);

    if (username != null && password != null)
        ConfigHelper.setOutputKeyspaceUserNameAndPassword(conf, username, password);
    if (splitSize > 0)
        ConfigHelper.setInputSplitSize(conf, splitSize);
    if (partitionerClass != null)
        ConfigHelper.setOutputPartitioner(conf, partitionerClass);
    if (rpcPort != null) {
        ConfigHelper.setOutputRpcPort(conf, rpcPort);
        ConfigHelper.setInputRpcPort(conf, rpcPort);
    }
    if (initHostAddress != null) {
        ConfigHelper.setOutputInitialAddress(conf, initHostAddress);
        ConfigHelper.setInputInitialAddress(conf, initHostAddress);
    }

    ConfigHelper.setOutputColumnFamily(conf, keyspace, column_family);
    CqlConfigHelper.setOutputCql(conf, outputQuery);

    setConnectionInformation();

    if (ConfigHelper.getOutputRpcPort(conf) == 0)
        throw new IOException("PIG_OUTPUT_RPC_PORT or PIG_RPC_PORT environment variable not set");
    if (ConfigHelper.getOutputInitialAddress(conf) == null)
        throw new IOException("PIG_OUTPUT_INITIAL_ADDRESS or PIG_INITIAL_ADDRESS environment variable not set");
    if (ConfigHelper.getOutputPartitioner(conf) == null)
        throw new IOException("PIG_OUTPUT_PARTITIONER or PIG_PARTITIONER environment variable not set");

    initSchema(storeSignature);
}

From source file:com.spotify.hdfs2cass.cassandra.thrift.CrunchBulkRecordWriter.java

License:Apache License

private void prepareWriter() {
    String columnFamily = CrunchConfigHelper.getOutputColumnFamily(conf);
    String keyspace = ConfigHelper.getOutputKeyspace(conf);

    if (outputdir == null) {
        // dir must be named by ks/cf for the loader
        outputdir = Paths.get(getOutputLocation(), keyspace, columnFamily).toFile();
        outputdir.mkdirs();//from  w  w w. jav a 2  s .  c om
    }

    if (writer == null) {
        AbstractType<?> subcomparator = null;

        if (cfType == CFType.SUPER)
            subcomparator = BytesType.instance;

        int bufferSizeInMB = Integer.parseInt(conf.get(BUFFER_SIZE_IN_MB, "64"));
        this.writer = new SSTableSimpleUnsortedWriter(outputdir, ConfigHelper.getOutputPartitioner(conf),
                keyspace, columnFamily, BytesType.instance, subcomparator, bufferSizeInMB,
                ConfigHelper.getOutputCompressionParamaters(conf));

        ExternalSSTableLoaderClient externalClient = new ExternalSSTableLoaderClient(
                ConfigHelper.getOutputInitialAddress(conf), ConfigHelper.getOutputRpcPort(conf),
                ConfigHelper.getOutputKeyspaceUserName(conf), ConfigHelper.getOutputKeyspacePassword(conf));

        this.loader = new SSTableLoader(outputdir, externalClient, new OutputHandler.SystemOutput(true, true));
    }
}