jueves, junio 07, 2018

Spring Boot + Cockroach DB in Kubernetes/OpenShift


In my previous post, I showed why CockroachDB might help you if you need a cloud native SQL database for your application. I explained how to install it in Kubernetes/OpenShift and how to validate that the data is replicated correctly.

In this post, I am going to show you how to use Cockroach DB in a Spring Boot application. Notice that Cockroach DB is compatible with PostgresSQL driver, so in terms of configuration is almost the same.

In this post, I assume that you have already a Cockroach DB cluster running in Kubernetes cluster as explained in my previous post.

For this example, I am using Fabric8 Maven Plugin to smoothly deploy a Spring Boot application to Kubernetes without having to worry so much about creating resources, creating Dockerfile and so on. Everything is automatically created and managed.

For this reason, pom.xml looks like:


Notice that apart from defining Fabric8 Maven Plugin I am also defining to use Spring Data JPA to make the integration between Spring Boot and JPA easier from the point of view of the developer.

Then you need to create a JPA entity and Spring Data Crud repository to interact with JPA.

Also, we need to create a controller who is responsible to get incoming requests, use the repository to make queries to DB and return results back to the caller.

Finally, you need to configure JPA to use the desired driver and dialect. In case of Spring Boot this is done in application.properties file.


The most important part here is that we need to use the PostgeSQL94 dialect. Notice that in url, we are using the postgresql jdbc url form. That's fine, since Cockroach uses the Postgres driver.

Now we need to create the database (customers) and the user (myuser) as configured in application.properties. To make it so, you just need to run cockroach shell and run some SQL commands:


Finally, you can deploy the application by running mvn clean fabric8:deploy. After that, the first time might take longer since needs to pull Docker images, you can start sending queries to the service.

As you can see it is really easy to start using a cloud-native DB like Cockroach DB in Spring Boot. If you want you can do exactly the same as in my previous post and start running queries to each of the nodes to validate that data is available correctly.

Code: https://github.com/lordofthejars/springboot-cockroach

We keep learning,
Alex.
Dôme épais, le jasmin, à la rose s'assemble, rive en fleurs, frais matin, nous appellent ensemble. (Flower Duet - Lakmé - Leo Delibes)
Music: https://www.youtube.com/watch?v=Vf42IP__ipw
Follow me at https://twitter.com/alexsotob



94 comentarios:

  1. I just loved your article on the beginners guide to starting a blog. Thank you for this article. kubernetes certification training and devops training courses with highly experienced faculty.

    ResponderEliminar


  2. We Fullassignment.com is among the best companies on the Programming Database and IT Assignments Help writing market. We offer top-notch essays, Online Programming Assignment Help research papers, thesis and other types of works that can be assigned to you at a high school or college. We also provide Java Programming Assignment Help from our experts. for more information contact us +16692714848.

    ResponderEliminar
  3. Anónimo12:45 p. m.

    🔥 ☑️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 ®️










































    ResponderEliminar
  4. Very nice Article I love it and want to share with my friends
    Artificial turf supplier Saskatoon

    ResponderEliminar
  5. If you are wondering how to Grow My Grade, you are just a click away from awesome learning documents like Fundamentals Of Cost Accounting 5th Edition Test Bank make the best deals on test banks and solution manuals right now with our assistance.

    ResponderEliminar
  6. Thank you very much for giving space to us to express our feeling and thoughts about above information. I think you will keep updating and changing these information time to time if there is need to change.
    best accounting company for small business, international taxation consultant, Ind AS in India , read more , internal auditing assurance consulting india, accountant service.

    ResponderEliminar

  7. ____???????
    ___??????????
    ___?????????????
    ___????????????
    __?????????????
    _?????????????
    _?????????????
    _??18+ Channels????
    ??????????????????????
    ????????18+Channels ??????
    ??????????????????????????
    _??????__????????????????
    ___????____?????????????
    ___????_____??????????
    ___????_____??????????
    ____????____??????????
    _____???____?????????
    ______???__??????????
    _______??????????????
    ________??????????????
    _______???????????????????
    _______?????Indore Escorts ????
    _______?????????????????????????
    _______???????????????????????????
    ________??????????____?????????????
    _________????????_______???????????
    _________????????_____???????????
    _________???????____??????????
    _________???????_??????????
    ________???????????????
    ________????????????
    ________??????????
    _______?????????
    _______??????
    ______??????
    ______??????
    ______??????
    ______?????
    ______?????
    _______????
    _______????
    _______????
    ______??????
    _____????????
    _______|_?????
    _______|__??????

    ResponderEliminar
  8. Anónimo9:41 a. m.

    Delhi Call Girls Agency, we are one among the various escort organization providing food young ladies for sexual administrations in Delhi and NCR. Our administrations are expanded all over Delhi and edges. We keep up unmistakable class of young ladies at all the majority of noticeable districts of the Delhi to guarantee our customers immediate and wanted administrations. Our Call Girls in Delhi are best class of young ladies giving extreme joy and furthermore moving message to not to surrender except if you achieve your point. Our Escort Service in Delhi attempt to change viewpoint towards life however yes they show the procedures to appreciate life and grin against the odd of life. Likewise become familiar with the procedures to make meeting more acceptable and interesting with escort young ladies.

    ResponderEliminar
  9. Put your routine aside and come enjoy pleasant moments with me. It will be a real pleasure for me to treat you like a king and satisfy your warm desire. My service is very relaxed and I totally immerse myself in my meetings.
    Escorts Service in Gurgaon
    Call Girls in Gurgaon
    Escorts in Huda City Center
    Aerocity Escorts
    Mahipalpur Escorts

    ResponderEliminar
  10. Hey guys, I am your perfect company, you will love my service, we will have pleasant moments together. I am a delight in bed, I love to give pleasure and spend warm and pleasurable moments with guys like you.
    Delhi Escorts
    Delhi Call Girls
    Escorts in Saket
    Gurgaon Call Girls
    Mumbai Escorts
    Call Girl in Jaipur
    Mumbai Call Girls

    ResponderEliminar
  11. I want you to enjoy me and have a rich time with a good sex that you will surely love. I'm a delight in bed, I'm sure you'll enjoy my company a lot. I'm going to do it in a way that's going to drive you crazy and make you want to come back.
    Escorts in Gurgaon
    Kolkata Escorts
    Escorts in Jaipur
    Hyderabad Escorts
    Bangalore Escorts
    Escorts in Goa

    ResponderEliminar
  12. I am a super discreet woman when it comes to reaching the place of our meeting.
    Escorts Service
    Call Girls

    ResponderEliminar
  13. click on one of the sites below to get a variety of the best tips and tricks in life. data pengeluaran togel

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

    pengeluaran bullseye

    agen togel terpercaya

    ResponderEliminar
  15. result togel hari ini Result Togel Hari Ini adalah situs khusus yang selalu menyediakan beberapa daftar result nomor togel , yang menayangkan berbagai angka keluaran togel terlengkap. semua hasil angka keluaran nomor yang di tayangkan adalah asli dan benar keasliannya dan sangat akurat dari setiap website official yang sesuai dengan pasaran tersebut.

    ResponderEliminar
  16. Data baru pengeluaran hongkong atau yang disebut data hk merupakan hasil keluaran nomor togel Hongkong terbaru yang hasil keluarannya diambil dari situs hongkongpools.

    ResponderEliminar
  17. Good site, hopefully useful for all webmasters, and thank you for joining and commenting on your comfortable site.
    Bocoran Hk

    ResponderEliminar
  18. I am impressed with this website, really I am a big fan.

    my web page; 안마

    ResponderEliminar
  19. I am new here but they are offering exactly what I am looking for. I want an Economics assignment help. I am in the United States, and therefore, I don’t know whether they offer the service here. If you do, let me know how much it will cost me for Economics homework help. I am waiting for their response

    ResponderEliminar
  20. I was reading some of your material on this website and I think this internet site is really informative!!! Keep on putting up. Eligible citizens are required to complete a simple online visa application to Turkey form with personal and passport information., select the purpose of their visit, answer a few simple health and security-related questions, and pay the E visa Turkey cost. You can pay a fee online.

    ResponderEliminar
  21. Thanks for sharing excellent information. Your web-site is so cool. I am impressed by the details that you’ve on this web site. It reveals how nicely you perceive this subject. Bookmarked this web page, will come back for extra articles 립카페

    ResponderEliminar
  22. Amazingly edifying and steady for me. I regard the gainful information you offer in your articles. An obligation of appreciation is all together to post 외국인출장

    ResponderEliminar
  23. Proceeded with instructive choices will efficiently, such as white stable light co. Great on sign in should get into the worker entrance will give of installments. Multi month following the left portion of the key phrase. As soon as you can permit you need to share your company related to love during the accreditation. Entryway establishment direct you will need to land their standing chances to your 스포츠마사지

    ResponderEliminar
  24. virtual event Speaking to Microsoft’s ambitions for product improvements, Bohn’s 2019 article noted that “Kipman talks a lot about distinguishing between identically boring conference rooms that are in the same spot on different floors.” meeting invitations examples, company gift bags and online event registration and payment

    ResponderEliminar
  25. Thank you😊 Before applying for Kenya visa on arrival you must check the eligible countries for Kenya Visa. To verify that Are you eligible to get the Kenya visa or not?

    ResponderEliminar
  26. Kumpulan daftar situs BANDAR TOGEL TERPERCAYA yang sudah kami pastikan valid dan sangat bonafit.

    ResponderEliminar
  27. Pilihan terbaik AGEN TOGEL TERPERCAYA bagi anda para pemain togel yang gemar menebak angka keluaran suatu pasaran togel tertentu.

    ResponderEliminar
  28. Kumpulan terbaik dan teraman SITUS TOGEL TERPERCAYA di Indonesia yang dibuat oleh para Jurutogel.

    ResponderEliminar
  29. We suggest you the biggest and trusted BANDAR TOGEL in Indonesia with complete pools and highest prize pools.

    ResponderEliminar
  30. Situs nomor 1 keyword LIVE DRAW HK di Indonesia dengan kecepatan update terbaik dan tercepat setiap hari yang kami pastikan valid.

    ResponderEliminar
  31. Mesin pencarian dengan sangat cepat memperlihatkan blog - blog LIVE DRAW SDY terbaik dan tercepat setiap harinya ketika anda melakukan pencarian.

    ResponderEliminar
  32. DATA SGP - Situs pengeluaran angka togel singapore terlengkap dan terbesar di Indonesia yang dibuat untuk para pecinta Togel Indonesia.

    ResponderEliminar
  33. Portal digital LIVE DRAW HK : pengeluaran angka togel hongkong tercepat dan terbaik di Indonesia.

    ResponderEliminar
  34. Blog LIVE DRAW SYDNEY merupakan blog yang mengadakan pemutaran langsung angka togel sydney setitap hari berupa angka yang dibuat dengan system tampilan sesederhana mungkin.

    ResponderEliminar
  35. Segera daftarkan diri anda dan hanya bermain di situs BANDAR TOGEL terbesar dengan pasaran togel yang lengkap , siap dimainkan dan hadiah togel terbesar dengan jaminan valid.

    ResponderEliminar
  36. Hello there, simply turned into aware of your blog through Google, and found
that it is really informative. HOW TO OBTAIN A FAKE IDs ONLINE THAT WORKS I’m going to be careful for brussels. I will appreciate when you proceed this in future. Numerous people shall be benefited out of your writing. Cheers Y’all don’t forget to join this DMV EXPERTS TELEGRAM GROUP for more information

    ResponderEliminar
  37. The Contract Law Assignment Help service has a great team of law subject matter experts who are well proficient in this field of assignment writing. Thus they can assist you to complete your assignment with more accuracy.

    ResponderEliminar
  38. As there are several websites offering help services to students worldwide who can offer you similar samples as well they have even done for their various clients within in your country. These assignmnet helpers providers also offer you the various guideline and templates that may guide you in doing your homework comfortably.

    ResponderEliminar
  39. A model is a person with a role either to promote or advertise commercial products and services or to serve as a visual aid for

    people who are creating works of art or to pose for photography. Though models are predominantly female models, especially to

    model clothing. Models may work professionally or casually.

    Guide in Novotel Aerocity
    Guide in Paharganj
    Guide in Pullman Hotel
    Guide in Red Fox Hotel
    Guide in Aerocity
    Guide in IBIS Hotel
    e^scorts in Aerocity
    e^scorts in Holiday inn
    e^scorts in IBIS Hotel Aerocity
    e^scorts in JW Marriott Hotel

    Aerocity

    ResponderEliminar
  40. Hi bro, i see this blog very good. Thanks ya

    bandar togel terpercaya

    ResponderEliminar

  41. Nice Blog for Qatar Student. It may take some time at first but then you can enjoy the services of the best agency throughout the year. Great Assignment Help provides the best service for other company.

    ResponderEliminar
  42. Mellor, Louisa. ten in the bed "CBeebies Bedtime Stories and 'the Tom Hardy effect'". Den of Geek. Retrieved 14 June 2021.

    ResponderEliminar
  43. Supportable Packaging games boxes Dealing with the climate is fundamental, and we must be certain that each individual is having their influence on the general public.

    ResponderEliminar
  44. Este comentario ha sido eliminado por el autor.

    ResponderEliminar
  45. Thank you so much for the post you do. I like your post and all you share with us is up to date and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job.
    토토
    경마사이트
    경마

    ResponderEliminar
  46. Thankyou for giving me useful information.
    Please keep posting.
    바카라사이트
    토토

    ResponderEliminar
  47. Yes i am totally agreed with this article and i just want to say that this article is very nice and vey informative. More blogs please.
    majortotositepro2
    racesitepro2
    oncasinositenet02
    totopickpro02

    ResponderEliminar
  48. Great Nice post keep writing. What should be included while doing language analysis, here are the point conclusion or final words are the same so you can analyze language only on one condition is that first, you must know basic core knowledge of that language. You have information on its numerous aspects, different characteristics, and its techniques too. And take a look at my blog post.

    ResponderEliminar
  49. Great post, your blog is too long and you share quality information in an effective manner. Do you have women's health nursing research topics by experts? Here I gonna share with you unique topics on nursing research topics. Veginal atrophy cause, female sexual health disorders in adult age, the right treatment for ovarian disorders, menopause challenges, how to prevent from pregnancy, autoimmune diseases or its treatment breast cancer treatment, reproductive endocrinology and modern neonatal, etc. These are a few topics on women nursing if are you looking for more topics kindly reach out to us or our expert helpers. We are happy to guide you in your academics.

    ResponderEliminar
  50. You might collect a dissertation that is due in a couple of days but doesn't have the time to complete it. You can use a dissertation help service to have an dissertation expert work on your dissertation right away, rather than spending sleepless hours on it. You can focus on other things while the dissertation expert online completes the task and sends it to you before the deadline.

    ResponderEliminar
  51. Assignment help services in Australia help students to complete their assignments within a given timeframe. Your writing skills will gradually improve if you follow and apply the expert's style in your assignment writing. You should practice regularly in order to improve them.



    ResponderEliminar

  52. Excellent, you are accessible from achieving the highest possible grades on your tasks and assignment. Our assignment experts ensure that your Matlab Assignment Help is completed as quickly as possible, allowing you to improve your writing and comprehension abilities. MATLAB is adapted to your way of thinking and working, so whether you're a student, an individual, or an expert, you can learn.

    ResponderEliminar
  53. JURUTOGEL give u praise to this masterpiece!

    ResponderEliminar
  54. Hello sir, Hope your evening is going well. Do you need an evisa to India? You can find more information about e visa to India on our website about India e visa.

    ResponderEliminar
  55. Hi, I'm Megha Malik! here to give sensual pleasure to my clients for which many people are still standing in queue. Make your night lusty with her at your place. I am the kind of dynamic girl who can put a huge smile on your personality. I generally prefer gentlemen who understand it honor their female companions. I have an apartment, so let’s go and enjoy.

    Female companions in Delhi

    ResponderEliminar
  56. Here are several of the sites we advise for our visitors
    토토사이트

    ResponderEliminar
  57. Hi there, I enjoy reading all of your article.

    경마

    ResponderEliminar
  58. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing. 바카라사이트인포

    ResponderEliminar
  59. This is such great work! Interesting to read for sure. 바카라사이트

    ResponderEliminar
  60. I need to to thank you for this great read!! I definitely enjoyed every little bit of it. I have got you bookmarked to check out new things you post. 슬롯머신

    ResponderEliminar
  61. We are providing homework help service to the students, so that they can understand their homework properly. Our homework help service assists them in completing all kinds of homework and essays within the specified time. So that they can get desire grades!

    ResponderEliminar
  62. Such a very informative article... Thanks for sharing this information... Foreign travelers who want to visit India for vacation, sightseeing, and purpose to enjoy need a tourist visa India, for more information, click and check.

    ResponderEliminar
  63. This content is very helpful and generic. You may also try Assignment Help Online which is the best platform for completing assignments. This online portal is very effective and provides quality reports at low prices. This is the place where experts mainly focus on the content quality rather than just providing the paraphrased content with quantity.

    ResponderEliminar
  64. Hello friends, many people ask, how can I apply for a visa? You can apply for an evisa apply online. And your visa processing time depends on your nationality and your visa type.

    ResponderEliminar
  65. good and fascinating post. Post regularly. Many thanks for sharing.Oracle Fusion SCM Online Training

    ResponderEliminar
  66. I want to stress how truly remarkable this post is. I'm filled with a profound sense of gratitude and wish to extend my heartfelt thanks for the exceptional content you've offered. 7 Best Doner Kebab in Istanbul. Istanbul is renowned for its delicious Doner Kebab, and here are seven of the best places to savor this iconic Turkish dish. From the historic Sultanahmet Koftecisi to the vibrant streets of Taksim, these eateries offer mouthwatering Doner Kebabs.

    ResponderEliminar
  67. This article is a delightful find in the vast online landscape! Your perspectives are clear and captivating. I appreciate how you break down complex topics into easy-to-understand segments. It feels like having an informative chat with a friend over coffee. Excellent work! I've bookmarked this page for future reference and look forward to seeing what else you have in store. Understanding the visa requirements for travel to Cameroon is essential for a smooth trip. Whether you're a tourist, student, or business traveler, being aware of the necessary documents and application process is crucial. Proper preparation allows you to enjoy Cameroon's vibrant culture, stunning landscapes, and diverse wildlife without any visa-related challenges. Plan ahead and experience this captivating African destination with ease.

    ResponderEliminar
  68. Remarkable article! Your knack for simplifying complex topics is truly admirable. The way you articulate your points makes it easy for readers to grasp the essence of the subject. Your dedication to sharing valuable insights is evident, and it's greatly appreciated. I'm eager to apply your strategies to my own endeavours. Keep up the exceptional work. Excited about your upcoming trip to Azerbaijan? Say goodbye to the hassle of traditional visa applications and hello to convenience with the Azerbaijanevisa  This user-friendly online process ensures a smooth and swift experience, granting you access to this beautiful country in no time. Don't wait – apply for your Azerbaijan evisa today and get ready to embark on your unforgettable journey.

    ResponderEliminar
  69. Nice Article. Thank you for sharing. trippymarket.com

    ResponderEliminar