Sample Spring boot app interacting with Cockroach DB
CockroachDB is designed to survive software and hardware failures, from server restarts to datacenter outages. This is accomplished without confusing artifacts typical of other distributed systems (e.g., stale reads) using strongly-consistent replication as well as automated repair after failures.
CockroachDB is a SQL database for building global cloud services. It falls under the category of NewSQL – a relational database that can scale horizontally. CockroachDB core is free to use. Most core features are licensed under the BSL, but some core features are subject to the CCL or third-party licenses.
Founded by ex-Googlers in 2015, CockroachDB has been described as nearly impossible to take down, hence its name — cockroaches are renowned for their resilience. With CockroachDB, companies can store multiple copies of their data in different locations to ensure uninterrupted access.
- Deploy cockroach DB on a single Kubernetes cluster
- docker
- Login to the respective Kubernetes cluster
- Port forward the cockroach-db to your local machine
- Create appropriate Database and Tables
- Replace the Database and table name in
application.properties
- Create appropriate model class based on the Table created
- Build the application
mvn clean install
- Build the docker image by running
docker build -t your_image_name .
right in Dockerfile location - Replace the docker image name in
deployment.yaml
with your image name - Run
kubectl apply -f deployment.yaml
on cluster