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.
Bringing together the Apache Cassandra experts from the community and DataStax.
Want to learn? Have a question? Want to share your expertise? You are in the right place!
Not sure where to begin? Getting Started
@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
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.