Hi,
Is it possible to lock the Consistency at DB level? Since when we set it on cqlsh it lasts only the time the session is alive.
Thanks
Hi,
Is it possible to lock the Consistency at DB level? Since when we set it on cqlsh it lasts only the time the session is alive.
Thanks
@igor.rmarinho_185445, could you elaborate your question a little bit more? Feel free to add additional information on the original question by editing it. Are you looking to implement a default consistency level for CQLSH sessions or for your applications connecting to Cassandra using various drivers? Also, could you please mention which version of Cassandra/DataStax Enterprise (DSE) are you using?
@igor.rmarinho_185445 As you know at the server level the default consistency is ONE
. It is not possible to change this default server-side because it prefers availability over consistency.
You can set it globally for the life of your session but typically when you're using cqlsh, you're most likely making schema changes in which case all nodes need to be up and operational. Otherwise, you're likely doing some tests or trying things out so you're really taking advantage of the tunable consistency and decide what you want based on what you're testing.
For example, if you're troubleshooting inconsistent results for a specific query then it makes sense to use LOCAL_ONE
so you can test the state of a specific replica. If however you're trying to trigger a read-repair, then you have to set a consistency of ALL
.
Specifically with cqlsh (or DataStax Studio), my personal opinion is that it doesn't make sense to have the consistency set server-side since you're using those clients for a specific reason. On the application-side, it is best-practice to set a global consistency for both reads and writes.
If you're interested, there is additional info on tunable consistency here. Cheers!
6 People are following this question.
DataStax Enterprise is powered by the best distribution of Apache Cassandra ™
© 2023 DataStax, Titan, and TitanDB are registered trademarks of DataStax, Inc. and its subsidiaries in the United States and/or other countries.
Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries.
Privacy Policy Terms of Use