DEV Community

Franck Pachot for YugabyteDB

Posted on

"I want to try it" 🚀 YugabyteDB at KubeCon

As a Developer Advocate, staying at the Yugabyte booth at KubeCon Europe 2022 was fun with great discussions around distributed SQL databases with awesome people. And so many "I want to try it" reactions! The simplest is a docker container on your laptop:

docker network create -d bridge yb

docker run -d --name yb0 --hostname yb0     \
--net=yb -p5433:5433 -p7000:7000            \
yugabytedb/yugabyte:latest                  \
yugabyted start --daemon=false --listen yb0 \
--tserver_flags="ysql_enable_auth=false"

Enter fullscreen mode Exit fullscreen mode

That's all. yugabyted creates and starts the cluster. You can connect to it with whatever you use for PostgreSQL - tools, applications, frameworks... you use the same drivers, and you get the same behavior. Why not a simple:

PGPASSWORD=yugabyte \
psql -P pager=off -h localhost -p 5433 -U yugabyte yugabyte

Enter fullscreen mode Exit fullscreen mode

From there, you create your users, your database, your schema... just as you do in PostgreSQL. This is sufficient to test postgres compatibility. If you find something not compatible, please check GitHub issues or open one. YSQL is the name of the PostgreSQL API which re-uses the postgres code for the best compatibility.

With this container, you have the features of PostgreSQL, but with a different storage layer: no vacuum issues, no bloat, no XID wraparound... But you want more, right?

You want to scale-out:

docker run -d --name yb1 --hostname yb1     \
--net=yb -p5434:5433                        \
yugabytedb/yugabyte:latest                  \
yugabyted start --daemon=false --listen yb1 \
--tserver_flags="ysql_enable_auth=false"    \
--join yb0 

docker run -d --name yb2 --hostname yb2     \
--net=yb -p5435:5433                        \
yugabytedb/yugabyte:latest                  \
yugabyted start --daemon=false --listen yb2 \
--tserver_flags="ysql_enable_auth=false"    \
--join yb0

Enter fullscreen mode Exit fullscreen mode

With those two additional containers joining the cluster, you can play with high availability. The data you have created is balanced and replicated over the three nodes. And you can connect to any node. To scale connections, data processing and storage, just add more nodes.

You have exposed port 7000 on the first container so you can check the control plane in http://localhost:7000 - see your cluster status, the tablet server nodes, the tables split into tablets... and claim your free T-Shirt 👕 to match with the sunglasses you got in KubeCon Valencia !

Now that you know how to scale out, just with the --join option of yugabyted, you can build your docker-compose file. For example, to replace PostgreSQL in a Docker Compose used for tests, I use the same variables as the PostgreSQL image - example here. And yugabyted is convenient for quick start, but you can have more control by starting all components like I do when I demo high availability and elasticity: https://github.com/FranckPachot/ybdemo/tree/main/docker/yb-lab

To claim your free T-Shirt, you joined our Slack. Please say hello in #introduction channel and if we've met at KubeCon or elsewhere please mention it. We had great discussions at the booth. Our dream team was so happy to be there and meet you

Discussion (0)