Install Scylla on Ubuntu 16.04

Scylla Is Next Generation NoSQL. Power your mission-critical applications with the best traits of Apache Cassandra at 10x the performance and low tail-latency at all times.

Add Repo

Add the Scylla APT repository to your system.

$ sudo wget -O /etc/apt/sources.list.d/scylla.list http://repositories.scylladb.com/scylla/repo/63074dd55d7ebbd35bedc10c3d4ad5af/ubuntu/scylladb-1.7-xenial.list

Install

Use the below command to install Scylla.

$ sudo apt-get update --allow-unauthenticated 
$ sudo apt-get install scylla --allow-unauthenticated

Confuguration

Configure the /etc/scylla/scylla.yaml file with the following parameters.

Item                 Content
=====                ========
cluster_name         Name of the cluster, all the nodes in the cluster must have the same name
seeds                Seed nodes are used during startup to bootstrap the gossip process and join the cluster
listen_address       IP address that the Scylla use to connect to other Scylla nodes in the cluster
rpc_address          IP address of interface for client connections (Thrift, CQL)

cluster_name: 'Test Cluster'
seed_provider:
       - class_name: org.apache.cassandra.locator.SimpleSeedProvider
         parameters:
               - seeds: "127.0.0.1"
listen_address: localhost
rpc_address: localhost

Run the scylla_setup script to tune the system settings.

$ sudo scylla_setup

krishna@Ubuntu16:~$ sudo scylla_setup
Skip any of the following steps by answering 'no'
Do you want to run kernel version check?
Answer yes to have this script verify that the currently installed kernel is qualified to run Scylla; answer no to skip this check.
[YES/no]no
Do you want to verify ScyllaDB packages installed?
Answer yes to have this script check that ScyllaDB is already installed; answer no to skip this check.
[YES/no]^C
krishna@Ubuntu16:~$ sudo scylla_setup
Skip any of the following steps by answering 'no'
Do you want to run kernel version check?
Answer yes to have this script verify that the currently installed kernel is qualified to run Scylla; answer no to skip this check.
[YES/no]YES
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
 gyp javascript-common libjs-inherits libjs-jquery libjs-node-uuid libjs-underscore libssl-dev libssl-doc libuv1 libuv1-dev linux-headers-4.10.0-28 linux-headers-4.10.0-28-generic
 linux-image-4.10.0-28-generic linux-image-extra-4.10.0-28-generic node-abbrev node-ansi node-ansi-color-table node-archy node-async node-block-stream node-combined-stream
 node-cookie-jar node-delayed-stream node-forever-agent node-form-data node-fstream node-fstream-ignore node-github-url-from-git node-glob node-graceful-fs node-gyp node-inherits
 node-ini node-json-stringify-safe node-lockfile node-lru-cache node-mime node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt node-normalize-package-data node-npmlog
 node-once node-osenv node-qs node-read node-read-package-json node-request node-retry node-rimraf node-semver node-sha node-sigmund node-slide node-tar node-tunnel-agent
 node-underscore node-which zlib1g-dev
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
 libreadline5
Suggested packages:
 xfsdump attr quota
The following NEW packages will be installed:
 libreadline5 xfsprogs
0 upgraded, 2 newly installed, 0 to remove and 63 not upgraded.
Need to get 695 kB of archives.
After this operation, 3,744 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 libreadline5 amd64 5.2+dfsg-3build1 [99.5 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 xfsprogs amd64 4.3.0+nmu1ubuntu1 [596 kB]
Fetched 695 kB in 2s (341 kB/s)
Selecting previously unselected package libreadline5:amd64.
(Reading database ... 265245 files and directories currently installed.)
Preparing to unpack .../libreadline5_5.2+dfsg-3build1_amd64.deb ...
Unpacking libreadline5:amd64 (5.2+dfsg-3build1) ...
Selecting previously unselected package xfsprogs.
Preparing to unpack .../xfsprogs_4.3.0+nmu1ubuntu1_amd64.deb ...
Unpacking xfsprogs (4.3.0+nmu1ubuntu1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libreadline5:amd64 (5.2+dfsg-3build1) ...
Setting up xfsprogs (4.3.0+nmu1ubuntu1) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for initramfs-tools (0.122ubuntu8.8) ...
update-initramfs: Generating /boot/initrd.img-4.10.0-35-generic
This is a supported kernel version.
Do you want to verify ScyllaDB packages installed?
Answer yes to have this script check that ScyllaDB is already installed; answer no to skip this check.
[YES/no]YES
Do you want to enable ScyllaDB services?
Answer yes to automatically start Scylla when the node boots; answer no to skip this step.
[YES/no]no
A new version was found, current version=1.7.4-0.20170726.ff643e3 latest version=1.7.2
Do you want to disable SELinux?
Answer yes to disable SELinux and improve performance; answer no to keep it activated.
[YES/no]YES
Do you want to setup bootloader options?
Answer yes to enable hugepages at boot time and improve performance. Answer no to skip this step.
[YES/no]no
Do you want to setup NTP?
Answer yes to enable time synchronization at boot time. This keeps time right on the node. Answer no to do nothing.
[YES/no]no
Do you want to setup RAID and XFS?
It is recommended to use RAID0 and XFS for Scylla data. If you select yes, you will be prompt to choose which unmounted disks to use for Scylla data. Selected disks will be formatted in the process.
[YES/no]no
Do you want to setup coredump?
Answer yes to enable core dumps; this allows to do post-mortem analysis of Scylla state after a crash. Answer no to do nothing.
[YES/no]no
Do you want to setup sysconfig?
Answer yes to do system wide configuration customized for Scylla. Answer no to do nothing.
[YES/no]no
Do you want to setup IO configuration?
Answer yes to let iotune study what are your disks IO profile and adapt Scylla to it. Answer no to skip this action.
[YES/no]no
Do you want to install node exporter and export Prometheus data from the node?
Answer yes to install it; answer no to skip this installation.
[YES/no]YES
 % Total % Received % Xferd Average Speed Time Time Time Current
 Dload Upload Total Spent Left Speed
100 628 0 628 0 0 486 0 --:--:-- 0:00:01 --:--:-- 486
100 3925k 100 3925k 0 0 255k 0 0:00:15 0:00:15 --:--:-- 537k
node_exporter-0.14.0.linux-amd64/
node_exporter-0.14.0.linux-amd64/LICENSE
node_exporter-0.14.0.linux-amd64/NOTICE
node_exporter-0.14.0.linux-amd64/node_exporter
Created symlink from /etc/systemd/system/multi-user.target.wants/node-exporter.service to /lib/systemd/system/node-exporter.service.
node_exporter successfully installed
Do you want to setup CPU scalling governor?
Answer yes to set CPU scalling governor to performance at boot time. Answer no to do nothing.
[YES/no]no
ScyllaDB setup finished.
krishna@Ubuntu16:~$

This script invokes a set of scripts to configure several operating system settings, like setting RAID0 and XFS filesystem. It also runs a short (up to a few minutes) benchmark on your storage and generates the /etc/scylla.d/io.conf configuration file. When the file is ready, you can start Scylla (see below). Scylla will not run without XFS or io.conf file. To bypass this check, set Scylla to developer mode

Run

Run Scylla as a service.

krishna@Ubuntu16:~$ sudo systemctl start scylla-server
Job for scylla-server.service failed because the control process exited with error code. See "systemctl status scylla-server.service" and "journalctl -xe" for details.

Scylla is showing some errors.

Sep 22 17:08:47 Ubuntu16 scylla_prepare[14795]: tuning: /sys/devices/pci0000:00/0000:00:0d.0/ata3/host2/target2:0:0/2:0:0:0/block/sda/queue/scheduler noop
Sep 22 17:08:47 Ubuntu16 scylla_prepare[14795]: tuning: /sys/devices/pci0000:00/0000:00:0d.0/ata3/host2/target2:0:0/2:0:0:0/block/sda/queue/nomerges 2
Sep 22 17:08:47 Ubuntu16 scylla_prepare[14795]: tuning /sys/devices/pci0000:00/0000:00:0d.0/ata3/host2/target2:0:0/2:0:0:0/block/sda/sda1
Sep 22 17:08:47 Ubuntu16 scylla[14800]: Scylla version 1.7.4-0.20170726.ff643e3 starting ...
Sep 22 17:08:47 Ubuntu16 scylla[14800]: [shard 0] init - Only 804 MiB per shard; this is below the recommended minimum of 1 GiB/shard; terminating.Configure more memory (--memory option)
Sep 22 17:08:47 Ubuntu16 scylla[14800]: [shard 0] seastar - Exiting on unhandled exception: std::runtime_error (configuration (memory per shard too low))
Sep 22 17:08:47 Ubuntu16 systemd[1]: scylla-server.service: Main process exited, code=exited, status=1/FAILURE
Sep 22 17:08:47 Ubuntu16 systemd[1]: Failed to start Scylla Server.
Sep 22 17:08:47 Ubuntu16 systemd[1]: scylla-server.service: Unit entered failed state.
Sep 22 17:08:47 Ubuntu16 systemd[1]: scylla-server.service: Failed with result 'exit-code'.

Change to developer mode by adding developer_mode: true in Scylla config file to fix the above issues.

developer_mode: true

Now, restart the Scylla service.

krishna@Ubuntu16:~$ sudo systemctl start scylla-server.service
krishna@Ubuntu16:~$
krishna@Ubuntu16:~$ sudo systemctl status scylla-server.service
● scylla-server.service - Scylla Server
   Loaded: loaded (/lib/systemd/system/scylla-server.service; disabled; vendor preset: enabled)
   Active: active (running) since Fri 2017-09-22 17:38:15 IST; 6s ago
  Process: 14811 ExecStopPost=/usr/lib/scylla/scylla_stop (code=exited, status=0/SUCCESS)
  Process: 15194 ExecStartPre=/usr/lib/scylla/scylla_prepare (code=exited, status=0/SUCCESS)
 Main PID: 15197 (scylla)
   Status: "starting tracing"
   CGroup: /system.slice/scylla-server.service
           └─15197 /usr/bin/scylla --log-to-syslog 1 --log-to-stdout 0 --default-log-level info --collectd-address=127.0.0.1:25826 --collectd=1 --collectd-poll-period 3000 --network-stack

Sep 22 17:38:19 Ubuntu16 scylla[15197]:  [shard 0] migration_manager - Create new ColumnFamily: org.apache.cassandra.config.CFMetaData@0x600000737d00[cfId=bfcc4e62-5b63-3aa1-a1c3-6f5e47f3
Sep 22 17:38:20 Ubuntu16 scylla[15197]:  [shard 1] compaction - Compacting [/var/lib/scylla/data/system/schema_keyspaces-b0f2235744583cdb9631c43e59ce3676/system-schema_keyspaces-ka-10-Dat
Sep 22 17:38:21 Ubuntu16 scylla[15197]:  [shard 1] compaction - Compacted 4 sstables to [/var/lib/scylla/data/system/schema_keyspaces-b0f2235744583cdb9631c43e59ce3676/system-schema_keyspa
Sep 22 17:38:21 Ubuntu16 scylla[15197]:  [shard 0] schema_tables - Creating system_traces.node_slow_log id=bfcc4e62-5b63-3aa1-a1c3-6f5e47f3325c version=3afb061d-ca8f-330a-ac47-73b44ddc75c
Sep 22 17:38:21 Ubuntu16 scylla[15197]:  [shard 0] database - Setting compaction strategy of system_traces.node_slow_log to SizeTieredCompactionStrategy
Sep 22 17:38:21 Ubuntu16 scylla[15197]:  [shard 2] database - Setting compaction strategy of system_traces.node_slow_log to SizeTieredCompactionStrategy
Sep 22 17:38:21 Ubuntu16 scylla[15197]:  [shard 1] database - Setting compaction strategy of system_traces.node_slow_log to SizeTieredCompactionStrategy
Sep 22 17:38:21 Ubuntu16 scylla[15197]:  [shard 0] database - Schema version changed to 655297b3-44ff-3f04-b65a-97c3a1e125ee
Sep 22 17:38:22 Ubuntu16 scylla[15197]:  [shard 1] compaction - Compacting [/var/lib/scylla/data/system/local-7ad54392bcdd35a684174e047860b377/system-local-ka-7-Data.db:level=0, /var/lib/
Sep 22 17:38:22 Ubuntu16 scylla[15197]:  [shard 0] storage_service - Node 127.0.0.1 state jump to normal
krishna@Ubuntu16:~$

krishna@Ubuntu16:~$ nodetool status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens       Owns (effective)  Host ID                               Rack
UN  127.0.0.1  89.92 KB   256          100.0%            8cabd243-e9a7-4210-8fb8-74c17c6c7cb6  rack1

krishna@Ubuntu16:~$ cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 2.2.8 | CQL spec 3.3.1 | Native protocol v4]
Use HELP for help.
cqlsh>
cqlsh>
cqlsh> show version;
[cqlsh 5.0.1 | Cassandra 2.2.8 | CQL spec 3.3.1 | Native protocol v4]
cqlsh>
cqlsh> show host;
Connected to Test Cluster at 127.0.0.1:9042.
cqlsh>

Using Scylla

Let’s create keyspace and table, try out.

cqlsh> CREATE KEYSPACE newdb WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
cqlsh> DESCRIBE KEYSPACES;

system_traces  system  newdb

cqlsh> DESCRIBE KEYSPACES;

system_traces  system  newdb

cqlsh> USE newdb
   ... ;
cqlsh:newdb> CREATE TABLE emp (id int PRIMARY KEY, name text, year text);
cqlsh:newdb> DESCRIBE tables;

emp

cqlsh:newdb> DESC emp;

CREATE TABLE newdb.emp (
    id int PRIMARY KEY,
    name text,
    year text
) WITH bloom_filter_fp_chance = 0.01
    AND caching = '{"keys":"ALL","rows_per_partition":"ALL"}'
    AND comment = ''
    AND compaction = {'class': 'SizeTieredCompactionStrategy'}
    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99.0PERCENTILE';

cqlsh:newdb> INSERT INTO emp (id, name, year) VALUES (1, 'Krishna', '2017');
cqlsh:newdb> INSERT INTO emp (id, name, year) VALUES (2, 'Chandra', '2317');
cqlsh:newdb> SELECT * FROM emp;

 id | name    | year
----+---------+------
  1 | Krishna | 2017
  2 | Chandra | 2317

(2 rows)
cqlsh:newdb>

cqlsh:newdb> SELECT * FROM emp WHERE id=2;

 id | name    | year
----+---------+------
  2 | Chandra | 2317

(1 rows)
cqlsh:newdb> 

Data Export

Here’s the way to export data from Scylla to csv file.

cqlsh:newdb> SELECT * FROM emp;

 id | name      | year
----+-----------+------
  5 |    Namita | 2223
 10 |   Superna | 6623
 16 |    Olewaf | 3777
  1 |   Krishna | 2017
 19 |    Wqkdke | 2637
  8 |     Jeqya | 8937
  2 |   Chandra | 2317
 15 |    Luetea | 6993
  9 |    Namita | 2223
  3 | Prajapati | 2237

(10 rows)
cqlsh:newdb> COPY emp(id, name, year) TO 'emp.csv';
Using 2 child processes

Starting copy of newdb.emp with columns [id, name, year].
Processed: 10 rows; Rate:      19 rows/s; Avg. rate:      37 rows/s
10 rows exported to 1 files in 0.277 seconds.
cqlsh:newdb> exit
krishna@Ubuntu16:~$ cat emp.csv
16,Olewaf,3777
5,Namita,2223
15,Luetea,6993
8,Jeqya,8937
3,Prajapati,2237
1,Krishna,2017
19,Wqkdke,2637
10,Superna,6623
2,Chandra,2317
9,Namita,2223
krishna@Ubuntu16:~$

 Data Import

Here’s the way to import data from csv file to Scylla.

cqlsh:newdb> SELECT * FROM emp;

 id | name      | year
----+-----------+------
  5 |    Namita | 2223
 10 |   Superna | 6623
 16 |    Olewaf | 3777
  1 |   Krishna | 2017
 19 |    Wqkdke | 2637
  8 |     Jeqya | 8937
  2 |   Chandra | 2317
 15 |    Luetea | 6993
  9 |    Namita | 2223
  3 | Prajapati | 2237

(10 rows)
cqlsh:newdb> TRUNCATE newdb.emp;
cqlsh:newdb> SELECT * FROM emp;

 id | name | year
----+------+------

(0 rows)
cqlsh:newdb> COPY emp(id, name, year) FROM 'emp.csv';
Using 2 child processes

Starting copy of newdb.emp with columns [id, name, year].
Processed: 10 rows; Rate:      15 rows/s; Avg. rate:      23 rows/s
10 rows imported from 1 files in 0.430 seconds (0 skipped).
cqlsh:newdb>
cqlsh:newdb> SELECT * FROM emp;

 id | name      | year
----+-----------+------
  5 |    Namita | 2223
 10 |   Superna | 6623
 16 |    Olewaf | 3777
  1 |   Krishna | 2017
 19 |    Wqkdke | 2637
  8 |     Jeqya | 8937
  2 |   Chandra | 2317
 15 |    Luetea | 6993
  9 |    Namita | 2223
  3 | Prajapati | 2237

(10 rows)
cqlsh:newdb>

 Conclusion

We have successfully setup Scylla. Scylla is an alternative for Cassandra.
@Enjoy ….

Leave a Reply

Your email address will not be published. Required fields are marked *