voedger / kb

Knowledge base
0 stars 0 forks source link

Develop Voedger Scylla/Ccassandra driver on Windows 11 using WSL and docker #18

Open maxim-ge opened 10 months ago

maxim-ge commented 10 months ago

Motivation

Develop voedger scylla/cassandra drivers on Windows 11

Install wsl

Create a shortcut

Use Ctrl+Shift+C/V as Copy/Paste

image

Install docker

Manage Docker as a non-root user

https://docs.docker.com/engine/install/linux-postinstall/

Run Scylla

docker run --rm -it -p 9042:9042 scylladb/scylla:5.2 --smp 2

Here's a breakdown of each part: - `docker run`: This is the basic command to start a new Docker container. - `--rm`: This flag tells Docker to automatically remove the container when it exits. Without this flag, you'd have to manually remove the container once you're done with it using `docker rm`. - `-it`: These flags are often used together when you're starting a container that you want to interact with. `-i` stands for "interactive" (keeping STDIN open even if not attached), and `-t` allocates a pseudo-TTY, which can be helpful for applications that behave differently when they detect they're being used interactively, like many shell prompts. - `-p 9042:9042`: This option tells Docker to map port 9042 of the container to port 9042 on the Docker host. This is the default port that ScyllaDB uses for CQL (Cassandra Query Language) clients. - `scylladb/scylla`: This is the name of the Docker image that the container will be based on. Docker will download this image from Docker Hub (or use a local copy, if one exists) and use it as a template for creating the new container. - `--smp 2`: This is an argument that's being passed to the ScyllaDB process running inside the Docker container. In this case, it's telling ScyllaDB to use 2 CPU cores. SMP stands for Symmetric Multiprocessing, and the `--smp` flag controls how many cores ScyllaDB will use. In summary, this command will start an interactive ScyllaDB session in a Docker container, using 2 CPU cores, with the container's CQL port (9042) mapped to the same port on the host, and automatically remove the container once the session ends.

Run Cassandra

docker run --rm -it -p 9042:9042 cassandra:4.1.1

Run tests, avoid cache

CASSANDRA_TESTS_ENABLED=1 go test -v -count=1 ./...

Useful docker commands

Enter docker container:

Logs:

docker logs -f 56a0f796faf1