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 https://raw.githubusercontent.com/cockroachdb/cockroach/master/cloud/kubernetes/cockroachdb-statefulset.yaml

In case of OpenShiftoc apply -f https://raw.githubusercontent.com/cockroachdb/cockroach/master/cloud/kubernetes/cockroachdb-statefulset.yaml

Then you need to initialize the cluster:

In case of Kuberneteskubectl create -f https://raw.githubusercontent.com/cockroachdb/cockroach/master/cloud/kubernetes/cluster-init.yaml

In case of OpenShift: oc apply -f https://raw.githubusercontent.com/cockroachdb/cockroach/master/cloud/kubernetes/cluster-init.yaml

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,
Alex
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)
Music: https://www.youtube.com/watch?v=paXOkGMyG8M

Follow me at https://twitter.com/alexsotob



43 comentarios:

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 you.college 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...

🔥 ☑️MEET THE REAL HACKERS☑️ 🔥

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:
▪️ FUNDS RECOVERY ON BITCOIN SCAM, INVESTMENTS, BINARY OPTIONS TRADING and ALL TYPES OF SCAMS.
▪️ WEBSITE AND DATABASE HACKING 💻
▪️ CREDIT REPAIR. 💳
▪️ PHONE HACKING & CLONING (giving you 📱 Unnoticeable access to everything Happening on the Target’s Phone)
▪️ CLEARING OF CRIMINAL RECORDS ❌
▪️ SOCIAL MEDIA ACCOUNTS HACKING 📱
▪️RECOVERY OF DELETED FILES 📤
▪️LOCATION TRACKING 📌
▪️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.

📩CONTACT US TODAY:
Email:
composite.cybersecurity@protonmail.com

🔘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

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.

Anónimo dijo...

vous pouvez essayer ceci portefeuilles de répliques revoir www. dolabuy.co 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

Micheal Jackson dijo...

vsdxz

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.
hastencatering dijo...


With the release of CockroachDB 2.0, users can now enjoy enhanced features and improved performance in their database management. Similarly, Industrial catering in houston texascaters to the unique needs of industrial sites, providing delicious meals and efficient service to fuel the workforce.

hastencatering dijo...

It promises to revolutionize data storage and scalability. And when it comes to hosting a Working lunch catering in houston texas, our catering services ensure that you and your team can enjoy a delicious and nourishing meal while discussing important matters

roadbridgeca dijo...

The discovery of fossilized dinosaur bones in a volcano base adds an intriguing twist to the Earthbound Autobots' story. It's amazing how history and fiction intertwine. Similarly, for projects that involve hazardous material removal, consider INFILL DEMOLITION in Albertafor their expertise in creating safer environments.

menzonee dijo...

Exciting news with the release of CockroachDB 2.0, bringing enhanced features and capabilities to the database world. Just as technological advancements evolve, so does the range of services offered in the modern grooming landscape. Experience tailored Facial Services For Men In Mississauga, where innovation meets relaxation and rejuvenation.




coffeesupplier dijo...

CockroachDB, the database that scales like Dubai's towering skyscrapers! Just as it conquers data challenges, conquer your day with Dubai's coffee roasters dubai from local roasters. ☕🏙️ #CockroachDB #DubaiCoffeeRoasters




Monster Rabbit dijo...

Monster Rabbit is a renowned brand known for its exceptional products, including the coveted "epimedium sex honey." With a commitment to enhancing vitality and intimacy, Monster Rabbit offers a range of high-quality solutions designed to invigorate and delight. Experience the power of nature's ingredients with Monster Rabbit and rediscover the pleasures of intimacy.

peter john dijo...
Este comentario ha sido eliminado por el autor.
Combined Pumps dijo...

The release of CockroachDB 2.0 is a significant development in the world of databases, promising enhanced features and capabilities. It's a testament to the continuous evolution of technology. transfer pumps in Dammam, transfer pumps are equally vital, ensuring the smooth and efficient movement of fluids in various industries, exemplifying the importance of innovation

elitefence dijo...

CockroachDB in Kubernetes" is an exciting development for cloud-native databases. Similarly, choosing a commercial Fencing contractor Edmonton is crucial for safeguarding your assets. Both are essential components for a robust and secure infrastructure!

Trufleers dijo...

The متجر شوكليت الخبر offers a delightful selection of chocolates and sweets, making it a go-to destination for those with a sweet tooth. It's a sweet haven in the heart of Al Khobar for chocolate enthusiasts.




electradubai dijo...

Exploring the cloud-native realm with CockroachDB – a SQL database seamlessly integrated into Kubernetes. Just as CockroachDB revolutionizes data management, Eglo Electrical Abu Dhabi transforms spaces with cutting-edge electrical solutions. Embrace innovation in both data and power systems, ensuring a dynamic and efficient environment

hastencatering dijo...

CockroachDB, a cloud-native SQL database in Kubernetes," is a game-changer for those navigating the complex world of cloud computing. Speaking of seamless operations, if you're planning tech eventsLunch catering in Houston Texas explore the top-notch catering services available. Monahans caterers bring a level of precision to your gatherings, ensuring that every detail is as flawlessly executed as the innovative solutions offered by CockroachDB

Future Style dijo...

With ACID transactions ensuring data consistency, it's a game-changer for modern cloud-era applications. And hey, while ensuring your data stays pristine, why not complement it with a touch of timeless style? Check out the Vintagiou Leather jacket for that perfect blend of sophistication and functionality.