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

Labs 2024 – Quick Wins Lab

In this lab, we will see how to quickly start ScyllaDB by running a single instance using Docker. We will then see how to run the CQL Shell.

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 Insruqt learning environment here. This 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 start a single instance and call it ScyllaDBU:

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

Notice that some files might be downloaded in this step. After waiting for a few seconds, we’ll verify that the cluster is up and running with the Nodetool Status command:

docker exec -it scyllaU nodetool status

The node scyllaU has a UN status. “U” means up, and N means normal. Read more about Nodetool Status Here.

Finally, we use the CQL Shell to interact with ScyllaDB:

docker exec -it scyllaU cqlsh

The CQL Shell allows us to run Cassandra Query Language commands on ScyllaDB, as we will see in the next part.

After seeing how to run a single ScyllaDB instance in the last lab, and running the CQL Shell, in this lab, we will see how to run some basic CQL commands. We will work with our newly created ScyllaDB instance to create a table, insert data into it, and read the data.

Let’s start by making sure our node is  still up:

docker exec -it scyllaU nodetool status

Run a CQL shell:

docker exec -it scyllaU cqlsh 

Create a keyspace called “mykeyspace”:

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

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 easy it is to start a ScyllaDB cluster and perform some basic CQL operations. In the next lessons, we will see some more advanced commands.

Read more about the CQL shell here.

fa-angle-up