[Question posted by a user on YugabyteDB Community Slack]
I'm using YCQL with yugabyte's cql driver. Also for testing purposes I'm running ycql in docker. Initially, when I check the consistency level of the database it shows as QUORUM. When I'm connecting via the cql driver and set the consistency to ONE and create a session I can see that the consistency is seen to be ONE.
In my code for go I’m currently configuring the gocql like this
hosts := getHosts(config.Hosts)
cluster := gocql.NewCluster(hosts...)
cluster.Consistency = gocql.One
session, err := cluster.CreateSession()
This is how I’m running yugabytedb:
docker run --name test-yugabyte -d -p2021:7000 -p2010:9000 -p2023:5433 -p2011:9042 -v ~/yb_data:/home/yugabyte/var yugabytedb/yugabyte:latest bin/yugabyted start --daemon=false
And then I exec into the container, run ycqlsh
to get to db cli, and then run consistency
ycqlsh> consistency;
Current consistency level is QUORUM.
I still see the consistency level to be QUORUM.
How is this different? Can someone point me to the right document or explain how this is happening internally?
The Consistency Level you set in your Go session has nothing to do with the CL you set in the
ycqlsh
. Each of these is a separate session and can have its own CL.Even though we support the CQL language we're a strongly consistent database. There are advanced use cases like Reading from Read Replicas which need you to set CL to ONE but otherwise our writes and reads are QUORUM by default.