use of com.basho.riak.client.core.RiakNode in project YCSB by brianfrankcooper.
the class RiakKVClient method init.
public void init() throws DBException {
loadProperties();
RiakNode.Builder builder = new RiakNode.Builder().withRemotePort(port);
List<RiakNode> nodes = RiakNode.Builder.buildNodes(builder, Arrays.asList(hosts));
riakCluster = new RiakCluster.Builder(nodes).build();
try {
riakCluster.start();
riakClient = new RiakClient(riakCluster);
} catch (Exception e) {
System.err.println("Unable to properly start up the cluster. Reason: " + e.toString());
throw new DBException(e);
}
// If strong consistency is in use, we need to change the bucket-type where the 2i indexes will be stored.
if (strongConsistency && !strongConsistentScansBucketType.isEmpty()) {
// The 2i indexes have to be stored in the appositely created strongConsistentScansBucketType: this however has
// to be done only if the user actually created it! So, if the latter doesn't exist, then the scan transactions
// will not be performed at all.
bucketType2i = strongConsistentScansBucketType;
performStrongConsistentScans = true;
} else {
// If instead eventual consistency is in use, then the 2i indexes have to be stored in the bucket-type
// indicated with the bucketType variable.
bucketType2i = bucketType;
performStrongConsistentScans = false;
}
if (debug) {
System.err.println("DEBUG ENABLED. Configuration parameters:");
System.err.println("-----------------------------------------");
System.err.println("Hosts: " + Arrays.toString(hosts));
System.err.println("Port: " + port);
System.err.println("Bucket Type: " + bucketType);
System.err.println("R Val: " + rvalue.toString());
System.err.println("W Val: " + wvalue.toString());
System.err.println("Read Retry Count: " + readRetryCount);
System.err.println("Wait Time Before Retry: " + waitTimeBeforeRetry + " ms");
System.err.println("Transaction Time Limit: " + transactionTimeLimit + " s");
System.err.println("Consistency model: " + (strongConsistency ? "Strong" : "Eventual"));
if (strongConsistency) {
System.err.println("Strong Consistent Scan Transactions " + (performStrongConsistentScans ? "" : "NOT ") + "allowed.");
}
}
}
use of com.basho.riak.client.core.RiakNode in project jnosql-diana-driver by eclipse.
the class RiakKeyValueConfiguration method get.
@Override
public RiakBucketManagerFactory get(Settings settings) {
requireNonNull(settings, "settings is required");
List<RiakNode> nodes = new ArrayList<>();
settings.keySet().stream().filter(k -> k.startsWith(SERVER_PREFIX)).sorted().map(settings::get).map(a -> new RiakNode.Builder().withRemoteAddress(a.toString()).build()).forEach(nodes::add);
if (nodes.isEmpty()) {
nodes.add(DEFAULT_NODE);
}
RiakCluster cluster = new RiakCluster.Builder(nodes).build();
return new RiakBucketManagerFactory(cluster);
}
use of com.basho.riak.client.core.RiakNode in project jnosql-diana-driver by eclipse.
the class RiakTestUtils method get.
public static BucketManagerFactory get() {
RiakKeyValueConfiguration riakKeyValueConfiguration = new RiakKeyValueConfiguration();
RiakNode node = new RiakNode.Builder().withRemoteAddress("localhost").build();
riakKeyValueConfiguration.add(node);
return riakKeyValueConfiguration.get();
}
Aggregations