Skip to content

Instantly share code, notes, and snippets.

@303248153
Created November 3, 2017 08:13
Show Gist options
  • Save 303248153/332f832297f0911fb1c987c1bca4afeb to your computer and use it in GitHub Desktop.
Save 303248153/332f832297f0911fb1c987c1bca4afeb to your computer and use it in GitHub Desktop.
https://hub.docker.com/r/scylladb/scylla
docker pull scylladb/scylla
mkdir -p /var/lib/scylla-node-1/data /var/lib/scylla-node-1/commitlog
docker run --name scylla-node-1 --volume /var/lib/scylla-node-1:/var/lib/scylla -d scylladb/scylla
docker exec -it scylla-node-1 bash
docker logs scylla-node-1 | tail
mkdir -p /var/lib/scylla-node-2/data /var/lib/scylla-node-2/commitlog
docker run --name scylla-node-2 --volume /var/lib/scylla-node-2:/var/lib/scylla -d scylladb/scylla --seeds="$(docker inspect --format='{{ .NetworkSettings.IPAddress }}' scylla-node-1)"
docker exec -it scylla-node-2 bash
docker logs scylla-node-2 | tail
nodetool status
nodetool removenode {id}
supervisorctl stop scylla
supervisorctl start scylla
cqlsh
create keyspace testdb with replication = { 'class': 'SimpleStrategy', 'replication_factor': 2 };
describe keyspaces;
use testdb;
create table testtable (id int, name text, remark text, primary key (id, name));
describe tables;
insert into testtable (id, name, remark) values (1, 'foo', 'some remark');
insert into testtable (id, name, remark) values (2, 'bar', 'other remark');
insert into testtable (id, name, remark) values (3, 'baz', null);
select * from testtable;
select id, name from testtable where id = 1;
select id, name from testtable where id = 1 and name = 'foo';
update testtable set remark = 'new remark' where id = 3 and name = 'baz';
delete from testtable where id = 1 and name = 'foo';
===============================================================================
supervisorctl stop scylla
insert into testtable (id, name, remark) values (1, 'test failover', null);
supervisorctl start scylla
nodetool rebuild
select * from testtable;
===============================================================================
docker start scylla-node-1
docker start scylla-node-2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment