An example ScyllaDB cluster setup for the InSpire Posts Service:
- 5 ScyllaDB nodes
- Prometheus for scraping metrics
docker-compose up -d
Node | CQL Port | REST API Port |
---|---|---|
scylla-node1 | 19042 |
19100 |
scylla-node2 | 19043 |
19101 |
scylla-node3 | 19044 |
19102 |
scylla-node4 | 19045 |
19103 |
scylla-node5 | 19046 |
19104 |
docker exec -it scylla-node1 nodetool status
Example output:
Datacenter: DC1
===============
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns Host ID Rack
UN 192.168.97.2 607.50 KB 256 ? 94e070c4-ba13-48ce-95a9-ba329100e672 Rack1
UN 192.168.97.3 612.60 KB 256 ? 6e58defa-8717-4686-bd82-562fea6d640b Rack1
UN 192.168.97.4 574.76 KB 256 ? 3d07157f-189d-4212-83f0-1cee2bd433ff Rack1
UN 192.168.97.6 602.65 KB 256 ? a89a542c-c0b0-4af5-b9c4-732de7f64f67 Rack1
UN 192.168.97.7 567.55 KB 256 ? 4b7a37e0-aca3-4531-939f-6943d7066c2e Rack1
docker exec scylla-node1 cqlsh -f migrations/create_posts.cql
docker exec scylla-node1 cqlsh -f migrations/insert_data.cql
docker exec -it scylla-node2 nodetool status --keyspace posts_service
You should see all 5 nodes with effective token ownership.
Datacenter: DC1
===============
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN 192.168.97.2 607.50 KB 256 59.8% 94e070c4-ba13-48ce-95a9-ba329100e672 Rack1
UN 192.168.97.3 581.48 KB 256 61.2% 6e58defa-8717-4686-bd82-562fea6d640b Rack1
UN 192.168.97.4 574.76 KB 256 61.8% 3d07157f-189d-4212-83f0-1cee2bd433ff Rack1
UN 192.168.97.6 602.65 KB 256 56.8% a89a542c-c0b0-4af5-b9c4-732de7f64f67 Rack1
UN 192.168.97.7 567.55 KB 256 60.5% 4b7a37e0-aca3-4531-939f-6943d7066c2e Rack1
cat migrations/read_data.cql | docker exec -i scylla-node1 cqlsh
Example result:
(10 rows)
post_id | author_id | created_at | description | image_height | image_url | image_width
--------------------------------------+--------------------------------------+---------------------------------+-----------------+--------------+------------------------------+-------------
b6c0e97b-6dfa-4001-9319-957ed6f18464 | 95c867bd-214c-4ebe-bc85-38f48a1538c1 | 2025-05-16 22:11:32.541000+0000 | Instagram style | 1350 | https://example.com/img7.jpg | 1080
d2d68894-a0e7-4618-adf9-aea24db859a2 | 47bb52ba-bac6-4179-a0de-8fe8e4d9aed4 | 2025-05-16 22:11:32.539000+0000 | Profile pic | 1080 | https://example.com/img2.jpg | 1080
...
You can also run queries manually (see read_data.cql
):
SELECT * FROM posts WHERE post_id = <uuid>;
SELECT * FROM posts WHERE image_width = 1080 ALLOW FILTERING;
SELECT * FROM posts WHERE image_height = 1080 ALLOW FILTERING;
SELECT * FROM posts WHERE created_at > 1715731200000 ALLOW FILTERING;
docker-compose down --volumes
docker-compose rm -f
Prometheus is exposed on port 19090
and scrapes metrics from all ScyllaDB nodes.
See dashboard.json
for an example Grafana dashboard configuration.
Feel free to open issues or submit pull requests to improve this setup. To contribute:
- Fork the repository
- Create a new branch:
git checkout -b my-feature
- Commit your changes
- Push to your fork and submit a PR
- Grafana dashboard
- Add client connection example