Created
December 13, 2017 18:42
-
-
Save Jammink2/2c08f4697d1baf76a4d652c4d6d4030c to your computer and use it in GitHub Desktop.
Asciinema Console Demo Script
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
********************************* | |
### Step one: bring up the cluster | |
asciinema rec | |
docker run --name Node_X -d scylladb/scylla | |
docker exec -it Node_X nodetool status | |
docker run --name Node_Y -d scylladb/scylla --seeds="$(docker inspect --format='{{ .NetworkSettings.IPAddress }}' Node_X)" | |
docker exec -it Node_Y nodetool status | |
docker run --name Node_Z -d scylladb/scylla --seeds="$(docker inspect --format='{{ .NetworkSettings.IPAddress }}' Node_X)" | |
docker exec -it Node_Z nodetool status | |
<CTRL + D> | |
********************************* | |
### Note: Step two: Switch on tracing, create a new keyspace, switch to the keyspace, write with **CL=ALL** and read with **CL=QUORUM** | |
asciinema rec | |
docker exec -it Node_Z cqlsh | |
CREATE KEYSPACE mykeyspace WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 3 }; | |
use mykeyspace | |
### WRITE CL = ALL | |
CONSISTENCY ALL | |
CREATE TABLE users(user_id int PRIMARY KEY, fname text, lname text); | |
TRACING ON | |
insert into users (user_id , fname, lname) values (1, 'tzach', 'livyatan' | |
### WRITE CL = QUORUM | |
CONSISTENCY QUORUM | |
insert into users (user_id , fname, lname) values (2, 'john', 'hammink'); | |
### READ CL = QUORUM | |
select * from users where user_id = 1; | |
<CTRL + D> | |
********************************** | |
### Step three: take a single node down, check status with ``nodetool``, attempt a write with different consistency levels | |
asciinema rec | |
docker stop Node_Y | |
sudo docker exec -it Node_Z nodetool status | |
docker exec -it Node_Z cqlsh | |
use mykeyspace; | |
#### WRITE CL = ALL (fail) | |
CONSISTENCY ALL | |
insert into users (user_id , fname, lname) values (3, 'dor', 'laor'); | |
#### WRITE CL = QUORUM (maybe fail, maybe succeeds) | |
CONSISTENCY QUORUM | |
insert into users (user_id , fname, lname) values (4, 'philip', 'pribble'); | |
<CTRL + D> | |
********************************* | |
### Step four: 2 nodes down, read and write with **QUORUM** and **One** consistency levels | |
asciinema rec | |
docker ps -a | |
docker stop Node_X | |
docker ps -a # Verify that there are two nodes down | |
docker exec -it Node_Z nodetool status | |
docker exec -it Node_Z cqlsh | |
#### WRITE CL = QUORUM (fail) | |
CONSISTENCY QUORUM | |
use mykeyspace; | |
insert into users (user_id , fname, lname) values (5, 'snarf', 'johnson'); | |
#### WRITE CL = ONE | |
CONSISTENCY ONE | |
insert into users (user_id , fname, lname) values (6, 'eric', 'cartman'); | |
#### READ CL = ONE | |
select * from users; | |
select * from users where user_id = 1; | |
<CTRL + D> | |
****************************************** | |
##Environment: | |
##Clean up environment: | |
docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q) | |
##Or delete row | |
cqlsh:mykeyspace> DELETE FROM users where user_id = 6; | |
##Or Drop table | |
cqlsh:mykeyspace> drop table users; | |
##Or drop keyspace | |
use system; | |
DROP KEYSPACE mykeyspace; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment