Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Cassandra High Availability
  • Toc
  • feedback
Cassandra High Availability

Cassandra High Availability

By : Strickland
4.6 (14)
close
Cassandra High Availability

Cassandra High Availability

4.6 (14)
By: Strickland

Overview of this book

If you are a developer or DevOps engineer who understands the basics of Cassandra and are ready to take your knowledge to the next level, then this book is for you. An understanding of the essentials of Cassandra is needed.
Table of Contents (11 chapters)
close
10
Index

Connecting to the cluster


To get connected, start by creating a Cluster reference, which you will construct using a builder pattern. You will specify each additional option by chaining method calls together to produce the desired configuration, then finally, calling the build() method to initialize the Cluster instance.

Let's build a cluster that's initialized with a list of possible initial contact points:

private Cluster cluster; // defined at class level
// you should only build the cluster once per app
cluster = Cluster.builder()
  .addContactPoints("10.10.10.1", "10.10.10.2", "10.10.10.3")
  .build();

Note

You should only have one instance of Cluster in your application for each physical cluster as this class controls the list of contact points and key connection policies such as compression, failover, request routing, and retries.

While this basic example will suffice to play around with the driver locally, the Cluster builder supports a number of additional options that are relevant for...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete