title: Usage of the LOCAL_QUORUM consistency level in Datastax driver
body: <p>For some reasons I need to query a particular datacenter within my cassandra cluster. According to <a href="https://docs.datastax.com/en/cassandra/3.0/cassandra/dml/dmlConfigConsistency.html#dmlConfigConsistency__dml-config-read-consistency" rel="nofollow noreferrer">the documentation</a>, I can use the <code>LOCAL_QUORUM</code> consistency level:</p>
  
  <blockquote>
    <p>Returns the record after a quorum of replicas in the current
    datacenter as the coordinator has reported. Avoids latency of
    inter-datacenter communication.</p>
  </blockquote>
  
  <p>Do I correctly understand, that in order to specify a particular datacenter for the current query, I have to build a cluster on the given endpoint belonging to this particular DC?</p>
  
  <p>Say, I have two DC's with the following nodes:</p>
  
  <pre><code>DC1: 172.0.1.1, 172.0.1.2
  DC1: 172.0.2.1, 172.0.2.2
  </code></pre>
  
  <p>So, to work with DC1, I build a cluster as:</p>
  
  <pre><code>Cluster cluster = Cluster.builder().addContactPoint("172.0.1.1").build();
  Session session = cluster.connect();
  Statement statement = session.prepare("select * from ...").bind().setConsistencyLevel(ConsistencyLevel.LOCAL_QUORUM);
  ResultSet resultSet = session.execute(session);
  </code></pre>
  
  <p>Is it a proper way to do that?</p>