Created
November 2, 2016 10:36
-
-
Save nirmaayan/63465ffb150463c52c5462505bd0c228 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE KEYSPACE consistency WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 3}; | |
USE consistency; | |
CREATE TABLE consistency.users (user_name varchar PRIMARY KEY, birth_year bigint); | |
INSERT INTO test.users (user_name, birth_year) values ('tzach', 1970); | |
INSERT INTO test.users (user_name, birth_year) values ('nadav', 1972); | |
INSERT INTO test.users (user_name, birth_year) values ('shlomi', 1974); | |
INSERT INTO test.users (user_name, birth_year) values ('nir', 1980); | |
SELECT * from consistency.users; (fill your expected result in the table for each node) | |
Stop one node $ sudo systemctl stop scylla-server | |
Verify node status $ sudo systemctl stop scylla-server | |
CQLsh to live node (not the one that you stopped) $ cqlsh 127.0.0.1 | |
UPDATE consistency.users SET birth_year=1992 WHERE user_name='nadav'; | |
SELECT * from consistency.users; (fill your expected result in the table for each node) | |
Start the node $ sudo systemctl start scylla-server | |
$ CQLsh 127.0.0.1 to the node that was down and you just started | |
SELECT * from consistency.users (fill your expected result in the table for each node) | |
Set CONSISTENCY to ALL CONSISTENCY ALL | |
SELECT * from consistency.users; (fill your expected result in the table for each node) - are the | |
results different? | |
Why did we saw different results when we had different Consistency Level? | |
If Consistency Level is set to “ONE” the cluster will wait for a reply from one node, this node will display his most update result according to his timestamp | |
If Consistency Level is set to “ALL” the cluster will wait for a reply from all of the nodes and will display the most update result according to his timestamp | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment