This is a repository that shows you how to set up your Yugabyte Database using Docker Compose file.
- Clone the Github repo with the docker-compose file.
git clone https://github.com/yTek01/YugabyteDB-on-Docker.git- Start the Cluster I have included a single node in the YAML file, but you can include another node/container in the same YAML to make this a two node cluster.
docker-compose -f ./docker-compose.Yugabyte.yaml up -d-
Test the APIs Clients can now connect to the YSQL API at localhost:5433 and the YCQL API at localhost:9042. The yb-master admin service is available at http://localhost:7000.
-
Connect to YSQL YCQL and YSQL APIs are enabled by default on the cluster.
docker exec -it yb-tserver-n1 /home/yugabyte/bin/ysqlsh -h yb-tserver-n1- Connect to YCQL
docker exec -it yb-tserver-n1 /home/yugabyte/bin/ycqlsh yb-tserver-n1- Create Keyspaces and Tables with the CQL API.
CREATE KEYSPACE Cassandrakeyspace; \
CREATE TABLE Cassandrakeyspace.foo(bar INT PRIMARY KEY); \
DESCRIBE Cassandrakeyspace.foo;-
Copy and load the sample data into YugabyteDB docker cp load_data.sql yb-tserver-n1:/home/yugabyte/
-
Connect to the YSQL
docker exec -it yb-tserver-n1 /home/yugabyte/bin/ysqlsh -h yb-tserver-n1- Load the data into the database.
\i load_data.sql- Connect to YSQL, with the new user and database connection.
docker exec -it yb-tserver-n1 /home/yugabyte/bin/ysqlsh -h yb-tserver-n1 -U postgres -d dvdrental- List all the tables in the dvdrental database.
\dt- Check the actors table.
SELECT * FROM public.actor;