Yugastore app is a sample ecommerce application built using a microservices design pattern. React UI, Node.js Express app framework and YugabyteDB (YCQL and YEDIS) are used as the underlying technology stack.
1. Create a cluster
Create a cluster.
$ kubectl apply -f yugabyte-statefulset.yaml
Initialize the YEDIS API.
$ kubectl exec -it yb-master-0 -- /home/yugabyte/bin/yb-admin --master_addresses yb-master-0.yb-masters.default.svc.cluster.local:7100,yb-master-1.yb-masters.default.svc.cluster.local:7100,yb-master-2.yb-masters.default.svc.cluster.local:7100 setup_redis_table
Clients can now connect to the YSQL, YCQL, and YEDIS APIs of the cluster at the following ports: 5433
, 9042
, and 6379
, respectively.
2. Install Yugastore
$ kubectl run yugastore --image=yugabytedb/yugastore:latest --port=3001 --command -- /usr/local/yugastore/bin/start-for-kubernetes.sh
Verify the deployment.
$ kubectl get deployments
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
yugastore 1 1 1 1 13m
Check all the pods.
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
yb-master-0 1/1 Running 0 7h
yb-master-1 1/1 Running 0 7h
yb-master-2 1/1 Running 0 7h
yb-tserver-0 1/1 Running 0 7h
yb-tserver-1 1/1 Running 0 7h
yb-tserver-2 1/1 Running 0 7h
yugastore-55d7c6965-ql95t 1/1 Running 0 13m
Note the yugastore pod ID above so that you can redirect its 3001 port to the localhost's 3001.
$ kubectl port-forward yugastore-55d7c6965-ql95t 3001
Now you can see the Yugastore app at http://localhost:3001.
3. Run a load tester
You can do this as shown below.
$ kubectl exec -it yugastore-55d7c6965-ql95t -- node /usr/local/yugastore/test/sample-user.js
4. Observe effects of load on YugabyteDB Admin UI
Now you can observe the effects of the read/write operations generated by the load tester by simply going to the YugabyteDB Admin UI. First you have to find the Admin UI URL using the command below.
$ minikube service yb-master-ui --url
http://192.168.99.100:31283
The above output is the Admin UI URL and visiting the Tablet Servers page there will show you the current state of the cluster.
5. Review Yugastore architecture and code
Details of Yugastore architecture are documented here. Source code is available in the Yugastore GitHub repo.
6. Run IoT Fleet Management app
After running Yugastore, Yugabyte recommends running the IoT Fleet Management app. This app is built on top of YugabyteDB as the database (using the YCQL API), Confluent Kafka as the message broker, KSQL or Apache Spark Streaming for real-time analytics and Spring Boot as the application framework.