Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/tgrziminiar/go-scylla
- Owner: TGRZiminiar
- Created: 2024-01-21T06:38:13.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-01-21T17:26:13.000Z (10 months ago)
- Last Synced: 2024-04-18T09:28:44.193Z (7 months ago)
- Topics: docker, golang, scylladb
- Language: Go
- Homepage:
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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'
```