Skip to content

Commit

Permalink
Add ScyllaDB
Browse files Browse the repository at this point in the history
  • Loading branch information
aliavni committed May 11, 2024
1 parent 7712ac0 commit f2bb28d
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 4 deletions.
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
- [Spark](#spark)
- [Thrift](#thrift)
- [ScyllaDB](#scylladb)
- [Connect to cqlsh](#connect-to-cqlsh)
- [Create keyspace](#create-keyspace)
- [Use keyspace and create table](#use-keyspace-and-create-table)
- [Insert data](#insert-data)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Expand Down Expand Up @@ -88,6 +92,35 @@ select sum(b) from hive_example;
## ScyllaDB
[open-source-nosql-database](https://www.scylladb.com/open-source-nosql-database/)
### Connect to cqlsh
[docker-compose](https://github.com/scylladb/scylla-code-samples/blob/master/mms/docker-compose.yml)
```bash
docker exec -it scylla-1 cqlsh
```
### Create keyspace
```cassandraql
CREATE KEYSPACE data
WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 3};
```
### Use keyspace and create table
```cassandraql
USE data;

CREATE TABLE data.users (
user_id uuid PRIMARY KEY,
first_name text,
last_name text,
age int
);
```
### Insert data
```cassandraql
INSERT INTO data.users (user_id, first_name, last_name, age)
VALUES (123e4567-e89b-12d3-a456-426655440000, 'Polly', 'Partition', 77);
```
4 changes: 3 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ services:
restart: always
command: --seeds=scylla-1,scylla-2,scylla-3 --smp 1 --memory 750M --overprovisioned 1
volumes:
- ./data/scylla:/var/lib/scylla
- ./data/scylla:/var/lib/scylla/data
- ./docker/scylladb/scylla.yaml:/etc/scylla/scylla.yaml
- ./docker/scylladb/cassandra-rackdc.properties.dc1:/etc/scylla/cassandra-rackdc.properties
ports:
- "19042:19042"
networks:
- backend

Expand Down
2 changes: 2 additions & 0 deletions docker/scylladb/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
FROM scylladb/scylla:5.2.0

RUN chown scylla:scylla /var/lib/scylla/data
2 changes: 1 addition & 1 deletion docker/scylladb/scylla.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ rpc_address: localhost
rpc_port: 9160

# port for REST API server
api_port: 10000
api_port: 20000

# IP for the REST API server
api_address: 127.0.0.1
Expand Down

0 comments on commit f2bb28d

Please sign in to comment.