Urgent.News

What's breaking now, across hundreds of outlets.

Tech

CockroachDB for Beginners: A Database That Survives Server Failures

CockroachDB is a distributed SQL database. It speaks the SQL you already know, but it spreads your data across many machines and keeps working even if one of them dies. Think of it as Postgres with survival skills. How does it work? You run several CockroachDB nodes, and the database automatically splits your tables into ranges and copies each range to multiple nodes. If a node goes down, another…

CockroachDB is a distributed SQL database that functions like Postgres but with added durability. It distributes your data across multiple machines and continues operating even if one of those machines fails. Imagine it as Postgres with enhanced resilience features. The operation begins with several CockroachDB nodes, which automatically divide tables into segments and replicate each segment across multiple nodes.

If a node encounters a shutdown, another copy steps in, and your application remains oblivious to the change. The familiar SQL syntax remains intact, allowing you to execute commands such as CREATE TABLE and SELECT statements.

CockroachDB is an excellent choice for beginners as the initial setup involves a single command to launch a one-node cluster. This setup can be executed on your laptop, enabling you to familiarize yourself with SQL without needing to consider multiple nodes initially. Moreover, the free tier of CockroachDB Cloud allows for the creation of a real cluster on the cloud without the complexities of server management.

So, when is CockroachDB the right choice for your application? If uptime is crucial, especially in the face of server failures, or if your user base is geographically dispersed and you want to store data closer to them, CockroachDB becomes a compelling option. It's particularly suited for payment applications, booking systems, or any scenario where losing a write operation would have significant consequences.

However, it's important to note that CockroachDB is heavier than a regular Postgres installation and some Postgres features may behave differently. For smaller applications like a blog or a to-do app, a single Postgres or MariaDB instance might be more suitable. Use CockroachDB when absolute uptime and scalability are non-negotiable requirements, rather than just desirable features.

The proof of CockroachDB's capabilities lies in its simplicity. Start by setting up the single-node cluster, create a table, insert a few rows, and then simulate a node failure by killing the node and restarting it. What you'll witness is that your data remains intact, demonstrating the core strength of CockroachDB – surviving server failures without any disruption to your application.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Identity Lifecycle Management: Designing Joiner-Mover-Leaver Controls

Plenty of teams have joiners and leavers mostly automated. HR creates a record, the directory builds an account, and termination disables it.

  • Implement joiner-mover-leaver controls to manage employee access transitions
  • Compare transferred employees' current access with new role requirements
  • Assign owners, approval workflows, and expiry dates for lingering privileges

Security Assessment: Blunder (Hack The Box) — Penetration Testing Report

Security Assessment Report: Blunder Technical Security Assessment & Penetration Testing Report conducted on the target environment Blunder hosted on Hack The Box , executed in accordance with PTES and…

  • Blunder environment tested on Hack The Box with PTES, NIST standards
  • Critical risk from unauthenticated remote exploit vector for full compromise
  • Pedro Araiz achieved host compromise, root access via exploit delivery

You Opened a New Tab and Forgot Why. A Memory Lab Built Half-Life Levels to Study It.

You open a new tab to look something up. The tab loads. You stare at the search bar. What was it? You go back to your editor, see the half-written function, and it comes right back.

  • Walking through doorways causes forgetting, according to University of Notre Dame researchers.
  • Virtual Half-Life levels with 66 rooms studied doorway-induced memory loss.
  • Setting intentions before task switches may reduce context shift memory disruption.

More from Tuesday 24 November →