martes, mayo 29, 2018

CockroachDB. A cloud native SQL database in Kubernetes.

CockroachDB 2.0 has just been released. For those who don't know what it is, it can be summarized as a SQL database for the cloud era. One of the best things about CockroachDB is that it automatically scales, rebalances and repairs itself without sacrificing the SQL language. Moreover, Cockroach implements ACID transactions,  so your data is always in a known state.

In this post, I am going to explain how to install it in Kubernetes/OpenShift, insert some data and validate that it has been replicated in all nodes. In next post, I am going to show you how to use it with Spring Boot + JPA.

The first thing you need to have is a Kubernetes/OpenShift cluster to be used. You can use Minikube or Minishift for this purpose. In my case, I am using Minishift but I will provide equivalent commands for Minikube.

After having everything installed, you need to launch the Cockroach cluster.

In case of Kuberneteskubectl create -f

In case of OpenShiftoc apply -f

Then you need to initialize the cluster:

In case of Kuberneteskubectl create -f

In case of OpenShift: oc apply -f

Then let's configure the cluster so we can access the admin UI:

In case of Kuberneteskubectl port-forward cockroachdb-0 8080

In case of OpenShift: oc expose svc  cockroachdb-public --port=8080 --name=r1

Now let's create a database and a table and see how it is replicated across all the cluster easily. Cockroach comes with a service that offers a load-balanced virtual IP for clients to access the database.

In case of Kubernetes: kubectl run cockroachdb -it --image=cockroachdb/cockroach --rm --restart=Never -- sql --insecure --host=cockroachdb-public

In case of OpenShift: oc run cockroachdb -it --image=cockroachdb/cockroach --rm --restart=Never     -- sql --insecure --host=cockroachdb-public

And finally in the opened console just type some SQL calls:

create database games;
use games;
create table game (id int, title varchar(30));
insert into game values (1, 'The Secret of Monkey Island');

So far, we have a new database, table, and entry in CockroachDB. Open admin UI, push Databases and you'll see something like this:

You can see that the database and the table have been created. Now let's see how we can know that everything has been replicated correctly. Push Overview and you'll see something like:

So pay attention to Replicas column. In all nodes, the number is exactly the same number, this means that all data in the cluster has been replicated X times.

Now let's increase by one the number of replicas and just refresh the page to see that the new node initially has not the same replica count.

In case of Kuberneteskubectl scale statefulset cockroachdb --replicas=4

In case of OpenShift: oc scale statefulset cockroachdb --replicas=4

Another thing you can do is to just enter each container and validate that when connecting to localhost, the inserted data is there.

In case of Kuberneteskubectl exec -it cockroachdb-0 /bin/bash

In case of OpenShiftoc exec -it cockroachdb-0 /bin/bash

Then inside the container just run: ./cockroach dump games --insecure

And you will see that CLI connects by default to the current node (localhost) and dumps the content of games db.

Repeat the same with other nodes cockroachdb-1 and cockroachdb-2 and you should see exactly the same.

So as you can see, it is really easy to use SQL in scale way thanks to Cockroach DB. In next post, we are going to see how to integrate Spring Boot + JPA with Cockroach DB, and deploying it into Kubernetes. 

We keep learning,
I can see a rainbow, In your tears as they fall on down, I can see your soul grow, Through the pain as they hit the ground (Rainbow - Sia)

Follow me at

32 comentarios:

yanmaneee dijo...

curry shoes
curry shoes
golden goose sale
hermes belt
vans outlet
nike air max 2017
adidas yeezy
harden shoes
kyrie 3 shoes
michael kors purses

yanmaneee dijo...

hermes online
curry 6 shoes
balenciaga shoes
bape hoodie
christian louboutin outlet
golden goose sneakers
jordan 12
goyard handbags
nike air max 95
kyrie 5

Liam dijo...

Allhomeworkhelp Provides the best hrm assignment help in the world. We have high educational experts and they always ready to help homework help

hookstefan dijo...

Through this, the understudies can at whatever point look for help from online associations. They begin making them an undertaking that is absolutely fascinating and legitimate.
Biology Assignment Help
chemistry Assignment Help

Anónimo dijo...


It Tears me Up Whenever we receive complaints from People About Their Experience With the Hackers They Met Before They Heard about us.
These Days There Are alot of Hackers Online, You Just Have to Be Careful about who you meet for help, because many people now don't really know who to ask for help anymore but there is an actual solution to that which I am giving you for free, Trust Me You Don't Wanna go out there seeking for Hackers Yourself, Because the probability of getting a Real Hacker Out there Is Very Slim . ❌❌ ❌ Most Of Them are actually not who they say they're, they are just out there to Rip people Off, Trust Me You Don’t Wanna Risk It. You Can Always Identify Them With Their False Advertisements and False Testimonies Trying To Lure you Into their Arms, And most of them use yahoomails, gmails and other cheap email providers which could easily expose their vulnerabilities, Please Don’t Fall For Them🚷 Come To Think Of It, Why would a Legit Hacker Be using a gmail or a cheap email provider that exposes his vulnerabilities????⚠️⚠️⚠️
Well, Our Purpose Here Is To Link You Up With Top Notched Legit Hackers With Great Online Reputations and Impressive LinkedIn Profiles That’ll Blow Your Mind. Trust Me, You Don’t Wanna Miss This Great Opportunity.

🔥 ☑️ COMPOSITE CYBER SECURITY SPECIALISTS are the Answers to your PRAYERS . We are here to Provide you with The BEST and FASTEST Hackers that would get your Job Done as Fast as possible. 🔥 🔥

☑️All our Specialists are well experienced in their various niches with Great Skills, Technical Hacking Strategies And Positive Online Reputations And Recommendations🔘
They hail from a proven track record and have cracked even the toughest of barriers to intrude and capture all relevant data needed by our Clients. 🔥 🔥

We have Digital Forensic Specialists⚡️, Certified Ethical Hackers⚡️, Software Engineers⚡️, Cyber Security Experts⚡️, Private investigators and more⚡️⚡️. Our Goal is to make your digital life secure, safe and hassle free by Linking you Up With these great Professionals such as JACK CABLE, ARNE SWINNEN, SEAN MELIA, DAWID CZAGAN, BEN SADEGHIPOUR And More. These Professionals are Well Reserved Professionals who are always ready to Handle your job with great energy and swift response so that your problems can be solved very quickly.
All You Need to Do is to send us a mail and we’ll Assign any of these specialists to Handle your Job immediately. ⚡️⚡️⚡️

☑️ Below Is A List Of Our Major Services:
▪️ PHONE HACKING & CLONING (giving you 📱 Unnoticeable access to everything Happening on the Target’s Phone)
▪️BITCOIN MINING ⛏ And lot More.

✅ COMPOSITE CYBER SECURITY SPECIALISTS are Basically the ANSWERS to your PRAYERS. Trust Me, You Don’t Wanna Miss Out This Great Experience.


🔘2020 © composite cybersecurity specialists
🔘Want faster service? Contact us!
🔘All Rights Reserved ®️

Daniel Lisa dijo...

When Quickbooks cant find the requested website on the server or the web browser is able to connect with the server then the user is likely to get quickbooks update error 404

Ninja Turtle dijo...

click on one of the sites below to get a variety of the best tips and tricks in life.

hasil data sydney
hasil data singapore
hasil data hongkong
hasil data cambodia
hasil data bullseye
hasil data china
hasil data pcso
paito warna sydney
paito warna singapore
paito warna hongkong

Mark Spencer dijo...

The very next time I read a blog, I hope that it won’t fail me as much as this particular one. I mean, Yes, it was my choice to read through, however I genuinely believed you would have something helpful to say. do my paper for me All I hear is a bunch of complaining about something that you could fix if you weren’t too busy searching for attention.

My Site dijo...

This blog is what im exactly looking for. Great! and Thanks to you.

My Site dijo...

What an interesting article! I'm glad i finally found what i was looking for.

Mark Spencer dijo...

I will always let you and your words become part of my day because you never know how much you make my day happier and more complete. There are even times when I feel so down but I will feel better right after checking your blogs. You have made me feel so good about myself write my dissertation all the time and please know that I do appreciate everything that you have

zarkazijar dijo...

Really appreciate you for sharing your useful thoughts with us, I found it very useful and informative. cipm nigeria past question online pdf format

dry bulk trucking dijo...

Rather than excavating an entire site and replacing the wet soil with one that has an optimum level of moisture, soil modification is a reliable, time-saving and cost-effective solution for improving the workability of theSOIL MODIFICATION services in USA soil. In fact, by modifying the soil directly on the worksite, you save precious time on having to haul it away and replacing it with imported quality fill material. Recycling on-site material will, therefore, save you time, money, and it will also reduce the environmental impact.

Unknown dijo...

Washing your car in your driveway with a hose is about the most environmentally unfriendly thing you could do. The water that Car washing zone Dubairuns off of your car when you wash it with water contains chemicals from harsh car cleaning detergents, in addition to gas, oil, and residue from exhaust fumes. All of that goes straight into storm drains and eventually into our lakes, rivers, and oceans. You can dramatically reduce your ecological footprint by using waterless car washes.

Unknown dijo...

vous pouvez essayer ceci portefeuilles de répliques revoir www. accéder à ce site Web répliques de sacs de créateurs bon marché

leeqeen dijo...

Great article! I was just looking for something like this to help me with my CockroachDB deployment. Thanks for sharing!
Nexus Ticket Master Integration

Loan providers near me dijo...

banks provide businesses with a great deal of freedom, particularly when it comes to cross-border trade operations. In comparison to local SBLC discounting in Dubaibanks, the cost of finance/product Offshore credit limits in Dubaiis also lower. TACB can offer credit facilities because to their expertise in trade finance and extensive experience working with offshore banks

Ahmed Malik dijo...


flavia110 dijo...

The cloud-native SQL database in Kubernetes can provide a scalable and efficient solution for storing and managing large amounts of data. As for the best unis for law in london, some of the top institutions include the University of Law, King's College London, and London School of Economics and Political Science. These universities have a strong reputation for their law programs and provide students with a high-quality education and ample opportunities for career advancement.

dry bulk trucking dijo...

It's exciting to see the release of CockroachDB 2.0, with its automatic scaling and ACID transactions. The installation guide for Kubernetes/OpenShift is helpful for those looking to use it in their cloud environment. On another note, SOIL MODIFICATION services in houston, texas can help optimize soil health for crop growth and sustainability.

envirosteam dijo...

CockroachDB 2.0 seems like a great solution for businesses looking for a cloud-native SQL database that can scale and repair itself automatically. With ACID transactions, it ensures data consistency and reliability. Speaking of keeping things in top shape, have you tried Interior Car Cleaning Ottawafor a thorough cleaning of your car's interior?

hellatwinkle dijo...

The automatic scaling and rebalancing features make it a convenient option for businesses dealing with large amounts of data. On a separate note,electra dubai fansare known for their high quality and sleek design, and can be a great addition to any space.

ArizDigital dijo...

CockroachDB 2.0 seems like a promising tool for managing SQL databases in the cloud era. The fact that it can automatically scale, rebalance and repair itself makes it a valuable addition to any project. As a Web Development services dubai we're excited to explore the possibilities of CockroachDB 2.0 for our clients.

Combined Pumps dijo...

CockroachDB 2.0 release seems to be an exciting update for those interested in SQL databases for cloud environments. The self-scaling, rebalancing, and ACID transactions features make it a reliable option for data storage. Additionally, the tutorial on how to install and use it with Spring Boot + JPA can be helpful. However, I'm not sure how it relates to hydrocarbon pumps Aberdeen.

Al Areen dijo...

It's great that it can automatically scale, rebalance, and repair itself while still supporting ACID transactions. Looking forward to the next post on using it with Spring Boot + JPA. By the way, there are some great Boxing classes in Dubai that can help you build your strength and endurance.

Ramma Foundation Repair dijo...

Ramma Foundation Repair provides reliable and effective solutions for Edmonton foundation repair. Their team of experts is highly skilled and experienced in identifying and addressing various foundation issues.

leadingit dijo...

The ability to use it with Kubernetes/OpenShift is also a plus for those using these platforms. It will be interesting to see how it performs with Spring Boot + JPA. leadingit company in UAEcan benefit from exploring this technology for their database needs.

mrautoapproved702 dijo...

MrAuto Approved is the perfect choice for Truck loans calgary who want to secure affordable and reliable car loans. With a commitment to helping customers find the best financing options, they have become a trusted name in the industry. Whether you're buying your first car or upgrading to a newer model, "MrAuto Approved" can help you get the financing you need.

Stelena675 dijo...

Cabo San Lucas Villas offer luxurious and comfortable vacation rentals cabo san lucas, perfect for a relaxing and enjoyable getaway. With stunning views and top-notch amenities, these villas are the ideal choice for a memorable vacation experience.

zara8359 dijo...

get best Office Renovation Dubai services at very effective cost.

elitefence dijo...

CockroachDB 2.0 sounds like a promising solution for those seeking a reliable SQL database for cloud-based applications. Its ability to automatically scale and repair itself, while still maintaining ACID transactions, is a significant advantage. Speaking of reliability, choosing a trusted provider for commercial and residential fencing Edmonton is also crucial to ensure the safety and security of your property.

global cfs dijo...
Este comentario ha sido eliminado por el autor.