"I want to try it" 🚀 YugabyteDB at KubeCon
Tags: kubecon, distributed, sql, yugabytedb
Published: 2022-05-21 07:09:08

As a Developer Advocate, staying at the Yugabyte booth at KubeCon Europe 2022 was fun with great discussions around [distributed SQL](https://www.yugabyte.com/tech/distributed-sql/) databases with awesome people. And so many "I want to try it" reactions! The simplest is a docker container on your laptop:

```bash
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.yb --tserver_flags="ysql_enable_auth=false"

```

That's all. It may take a few minutes to download the image if not already done. `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:
```bash
docker exec -it yb0 bash -c "PGPASSWORD=yugabyte ysqlsh -P pager=off -h yb0 -p 5433 -U yugabyte yugabyte"

```
This starts `ysqlsh` in the container. It is the same as `psql`: you quit it with `\q`. You can also connect any PostgreSQL application to your localhost port 5433.

From this command line, you create your users, your database, your schema... just as you do in PostgreSQL. This is sufficient to test [postgres compatibility](https://www.yugabyte.com/tech/postgres-compatibility/). If you find something not compatible, please check [GitHub issues](https://github.com/yugabyte/yugabyte-db/issues?q=is%3Aissue+is%3Aopen+label%3Aarea%2Fysql+) or open one. [YSQL](https://docs.yugabyte.com/preview/api/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:

```bash
docker run -d --name yb1 --hostname yb1 --net=yb -p5434:5433 yugabytedb/yugabyte:latest yugabyted start --daemon=false --listen yb1.yb --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.yb --tserver_flags="ysql_enable_auth=false" --join yb0

```

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](https://dev.to/franckpachot/docker-composeyaml-to-start-yugabytedb-with-postgresuser-postgrespassword-postgresdb-env-4do3). 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](https://communityinviter.com/apps/yugabyte-db/register). 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

https://twitter.com/Yugabyte/status/1527220029594513411?s=20&t=z8EPnfJP51FXVXwqr8-YFQ

When you are done, you can remove the docker containers with:
```
docker container rm -f yb0
docker container rm -f yb1
docker container rm -f yb2
docker network rm yb
```