Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tgrziminiar/go-scylla

example go scylla multi node
https://github.com/tgrziminiar/go-scylla

docker golang scylladb

Last synced: about 11 hours ago
JSON representation

example go scylla multi node

Awesome Lists containing this project

README

        

## Docker pull
```
docker pull scylladb/scylla:5.2
docker compose up -d
```
## Show status
After the setup is done you will see two node running on DC1
```
docker exec -it scylla-node1 nodetool status
```

## Access CQl to generate some keyspace and table
```
docker exec -it scylla-node1 cqlsh
```

## Create datacenter and initial table
// users = keyspace
```
CREATE KEYSPACE users WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy','DC1' : 3};
use users;
CREATE TABLE IF NOT EXISTS users.userData (
id UUID PRIMARY KEY,
name TEXT,
email TEXT
);
describe users.userdata;
```

## Check that datacenter is working
If the data of the tables users show that mean datacenter work
```
docker exec -it scylla-node2 cqlsh
describe users.userdata;
```

## To test it with the api you need everything to be on the same network
```

// server image
docker run -d --net=test-scylla_web --name some-go-app go-app

// for sending api
docker run -it --name my-ubuntu-container --network test-scylla_web ubuntu:noble-20240114

// execute ubuntu
docker exec -it my-ubuntu-container bin/bash
apt update
apt install -y curl

// save user in db
curl --location 'some-go-app:5000/users_v1/register' \
--header 'Content-Type: application/json' \
--data-raw '{
"name":"mix1",
"email":"[email protected]"
}'

// get users in db
curl --location 'some-go-app:5000/users_v1/get-users'
```