Join us at ScyllaDB Labs, an interactive online workshop where we’ll go hands-on with ScyllaDB | December 11
Register now

Lab: Overview and Setup (Part 1 of 2)

9 min to complete

Lab: Overview and Setup (Part 1 of 2)

In this lab, we’ll bring up a three-node cluster and demonstrate how the WRITE and READ look, in a cluster where our Replication Factor (RF) is set to 3. We’ll simulate a situation where some nodes are down and see how changing the Consistency Level affects the read and write operations and failure conditions in a ScyllaDB cluster.

Please ensure that your environment meets the following prerequisites:

  1. Docker for Linux, Mac, or Windows. Please note that running ScyllaDB in Docker is only recommended to evaluate and try ScyllaDB. For best performance, a regular OS install is recommended.
  2. 3GB of RAM or greater for Docker.
  3. If you are using Linux, you will need docker-compose.

Note: In addition to the instructions provided here, which allow you to run the lab on a machine with Docker, you can find this lab in the Killercoda learning environment here. The Killercoda environment provides an interactive virtual machine where you can execute all the commands directly from your browser without the need to configure anything.

Before starting the cluster, make sure the aio-max-nr value is high enough (1048576 or more). 

This parameter determines the maximum number of allowable Asynchronous non-blocking I/O (AIO) concurrent requests by the Linux Kernel, and it helps ScyllaDB perform in a heavy I/O workload environment.

Check the value: 

cat /proc/sys/fs/aio-max-nr

If it needs to be changed:

echo "fs.aio-max-nr = 1048576" >> /etc/sysctl.conf
sysctl -p /etc/sysctl.conf

First, we’ll bring up a 3-node ScyllaDB Docker cluster.
Set up a Docker Container with one node, called Node_X:

 docker run --name Node_X -d scylladb/scylla:5.2.0 --overprovisioned 1 --smp 1

Create two more nodes, Node_Y and Node_Z, and add them to the cluster of Node_X. The command “$(docker inspect –format='{{ .NetworkSettings.IPAddress }}’ Node_X)” translates to the IP address of Node-X:

docker run --name Node_Y -d scylladb/scylla:5.2.0 --seeds="$(docker inspect --format='{{ .NetworkSettings.IPAddress }}' Node_X)" --overprovisioned 1 --smp 1

docker run --name Node_Z -d scylladb/scylla:5.2.0 --seeds="$(docker inspect --format='{{ .NetworkSettings.IPAddress }}' Node_X)" --overprovisioned 1 --smp 1

Wait a minute or so and check the node status: 

docker exec -it Node_Z nodetool status  

You’ll see that eventually, all the nodes have UN for status. U means up, and N means normal. Read more about Nodetool Status Here.

Once the nodes are up, and the cluster is set, we can use the CQL shell to create a table.

Run a CQL shell: 

docker exec -it Node_Z cqlsh 

Create a keyspace called “mykeyspace”, with a Replication Factor of three: 

CREATE KEYSPACE mykeyspace WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'replication_factor' : 3};

Next, create a table with three columns: user id, first name, and last name, and insert some data: 

use mykeyspace; 
CREATE TABLE users ( user_id int, fname text, lname text, PRIMARY KEY((user_id))); 

Insert into the newly created table two rows: 

insert into users(user_id, fname, lname) values (1, 'rick', 'sanchez'); 
insert into users(user_id, fname, lname) values (4, 'rust', 'cohle'); 

Read the table contents:

select * from users;

To summarize, we saw how to create a three-node cluster with RF=3, how to open a CQL Shell, create a table, insert data into it, and read the data. In the next topic, we will see what happens when nodes are down and how the Consistency Level impacts the read/write operations.

fa-angle-up