Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/obochurkin/go-scylladb
test app on how to work with scyllaDB + gin
https://github.com/obochurkin/go-scylladb
gin gocql golang nosql scylladb
Last synced: 17 days ago
JSON representation
test app on how to work with scyllaDB + gin
- Host: GitHub
- URL: https://github.com/obochurkin/go-scylladb
- Owner: obochurkin
- License: mit
- Created: 2023-12-19T00:58:47.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-02T07:29:36.000Z (9 months ago)
- Last Synced: 2024-11-14T14:15:13.395Z (about 1 month ago)
- Topics: gin, gocql, golang, nosql, scylladb
- Language: Go
- Homepage:
- Size: 31.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## how to run local development
### single node cluster
- run scylladb locally:
```
docker run --name scylla-node1 --hostname scylla-node1 -d scylladb/scylla
docker exec -it scylla-node1 nodetool status
```
- create a keyspace (configurate with 1 node):
```sql
docker exec -it scylla-node1 cqlsh [node address from nodetool status]
cqlsh> CREATE KEYSPACE mykeyspace WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'replication_factor' : 1};
```
### multi node cluster
- run scylladb locally:
```
docker-compose up -d
docker exec -it scylla-node1 nodetool status
```
- create a keyspace (configurate with 3 node):
```sql
docker exec -it scylla-node1 cqlsh 172.21.0.2
cqlsh> CREATE KEYSPACE mykeyspace WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'replication_factor' : 2};
```### seed example data
- pre-populate some data:
```sql
use mykeyspace;
CREATE TABLE users ( user_id int, fname text, lname text, PRIMARY KEY((user_id)));insert into users(user_id, fname, lname) values (1, 'rick', 'sanchez');
insert into users(user_id, fname, lname) values (4, 'rust', 'cohle');select * from users;
```switch consistency modes:
```ts
docker exec -it scylla-node1 cqlsh 172.21.0.2cqlsh>CONSISTENCY QUORUM // most of the nodes should respond else failed
cqlsh>CONSISTENCY ALL // all of the nodes should respond else failed
cqlsh>CONSISTENCY ANY // at least 1 of the nodes should respond else failed
cqlsh>CONSISTENCY ONE // one of the nodes should respond else failed
```- create .env file and fill proper parameters of db connection DB_CONN_STRING=127.0.0.1 and DB_KEY_SPACE=mykeyspace
- run application
```
make start
```- run tests
```
make test
```