Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
VGSources
Blog

How to Deploy a Three-Node CockroachDB Cluster on Ubuntu

Build a production-ready three-node CockroachDB cluster on separate Ubuntu hosts with TLS, a shared join list, one-time initialization, SQL and DB Console verification, and systemd supervision.
Length11 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Deploy a production CockroachDB cluster on three separate Ubuntu hosts (or VMs), not three processes on one server. Install the identical CockroachDB release everywhere, give each node a unique address and storage directory, secure the cluster with a CA and TLS certificates whose SANs cover every production address, start all nodes with one shared join list, and run cockroach init exactly once. Verify SQL reads and writes through more than one node, confirm three live nodes in DB Console, then place the process under systemd or another service manager.

What a production three-node layout looks like

CockroachDB uses Raft consensus to replicate data. A three-node cluster can continue operating when one node is unavailable, provided the remaining nodes can communicate. That resilience depends on independent failure domains: use three Ubuntu servers or virtual machines with separate host failure boundaries, stable DNS names or IP addresses, and routable connectivity between every pair.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Cockroach Labs explicitly warns that running multiple nodes on one host is useful for testing but is not suitable for production. Three processes on one Ubuntu machine share the same hardware, operating-system failure, storage device, and network path, so they do not provide meaningful high availability.

Node Example name SQL/RPC address DB Console address Data store
1 node1.example node1.example:26257 node1.example:8080 /var/lib/cockroach/data
2 node2.example node2.example:26257 node2.example:8080 /var/lib/cockroach/data
3 node3.example node3.example:26257 node3.example:8080 /var/lib/cockroach/data

The names above are examples. Replace them with names resolvable from every host and with addresses that will remain valid for the life of the cluster. Port 26257 carries SQL and node-to-node traffic in this layout; port 8080 serves the DB Console. Restrict both ports with your network firewall so that only required clients and cluster members can reach them.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Prerequisites and decisions to make first

  • Three Ubuntu hosts or VMs in separate failure domains. A single-region deployment normally uses three addresses in the join list; three to five join addresses are appropriate when the topology warrants more entry points.
  • The same CockroachDB release and architecture-specific binary installed on all nodes. Do not mix release versions during the initial bootstrap.
  • Stable DNS records or fixed IP addresses for each node, with forward and reverse resolution tested from every host.
  • Network paths allowing node-to-node SQL/RPC traffic on 26257 and administrative access to the DB Console on 8080 where needed.
  • A protected location for the certificate-authority private key. It should not be left in a general application directory or copied to every database host.
  • A service account and directories owned by that account for the binary, certificates, logs, and data.
  • An administrative plan: who can initialize the cluster, who receives the root client certificate, how certificates will be rotated, and where backups and monitoring alerts will go.

Decide whether the three machines are physical servers, cloud VMs, or another form of isolated host. The commands are the same, but the surrounding network controls, disks, failure domains, and operational ownership differ.

Install one identical CockroachDB release

Install the Linux binary using the current CockroachDB Linux installation procedure, and record the exact release version. Repeat the installation on node1, node2, and node3. Keep the executable in a controlled path such as /usr/local/bin/cockroach, and make sure the service account can execute it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. On each host, verify the binary and version with cockroach version.
  2. Confirm that all three outputs identify the same release and CPU architecture.
  3. Create the data and certificate directories with ownership assigned to the account that will run CockroachDB.
  4. From each host, resolve the other two node names and test TCP reachability to port 26257. Test access to 8080 separately for the administrators who will use DB Console.

Do not copy a data directory from one node to another. Every node needs its own empty store at first. The join list tells a new process how to find existing members; it is not a substitute for unique storage.

Build the TLS certificate set

A secure cluster has a certificate authority (CA), node certificates, and client certificates. The CA signs certificates but its private key does not need to live on database servers after issuance. Node certificates authenticate node-to-node and SQL connections. Client certificates authenticate administrators and applications.

Create a CA and node certificate

The following commands follow the official secure-deployment pattern. Run certificate creation from a protected administration host or another location where the CA key can be kept private:

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
mkdir certs my-safe-directory
cockroach cert create-ca 
  --certs-dir=certs 
  --ca-key=my-safe-directory/ca.key

cockroach cert create-node node1.example node2.example node3.example 
  --certs-dir=certs 
  --ca-key=my-safe-directory/ca.key

cockroach cert create-client root 
  --certs-dir=certs 
  --ca-key=my-safe-directory/ca.key

The node command places the supplied names in the certificate’s Subject Alternative Name (SAN) set. In a real deployment, include every DNS name and IP address that clients or cluster members will use, including an address presented by a load balancer when one is part of the connection path. A certificate that contains only an internal name will fail hostname verification when a client connects through a different, valid address.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The generated files have distinct roles:

File Purpose Where it belongs
ca.crt Public CA certificate used to verify signatures Every node and trusted client
node.crt Certificate presented by a CockroachDB node Each node’s certificate directory
node.key Private key for the node certificate Only the node that uses it; protect with restrictive permissions
client.root.crt Root client certificate for administrative SQL connections Only the administrators or automation that require root access
client.root.key Private key paired with the root client certificate Keep encrypted or otherwise tightly protected

For stricter isolation, issue distinct node certificates for individual hosts while ensuring each certificate contains all names and addresses used to reach that particular node. Follow the certificate-scenario rules for the CockroachDB release you install. Never distribute ca.key to application servers or ordinary database hosts.

Copy certificates safely

Place ca.crt and the node certificate and key required by a host in that host’s certificate directory, such as /var/lib/cockroach/certs. Transfer files over an authenticated, encrypted administrative channel, verify ownership, and set permissions so that only the CockroachDB service account can read private keys. Keep the root client key off the nodes unless an operational procedure explicitly requires it.

Start all three nodes with one common join list

Each process needs a unique store path and unique listening addresses. The join list should be identical on all three nodes so that any node can locate the initial members if another node is restarted.

Node 1

cockroach start 
  --certs-dir=/var/lib/cockroach/certs 
  --store=/var/lib/cockroach/data 
  --listen-addr=node1.example:26257 
  --http-addr=node1.example:8080 
  --join=node1.example:26257,node2.example:26257,node3.example:26257

Node 2

cockroach start 
  --certs-dir=/var/lib/cockroach/certs 
  --store=/var/lib/cockroach/data 
  --listen-addr=node2.example:26257 
  --http-addr=node2.example:8080 
  --join=node1.example:26257,node2.example:26257,node3.example:26257

Node 3

cockroach start 
  --certs-dir=/var/lib/cockroach/certs 
  --store=/var/lib/cockroach/data 
  --listen-addr=node3.example:26257 
  --http-addr=node3.example:8080 
  --join=node1.example:26257,node2.example:26257,node3.example:26257

Run the equivalent command on each host after confirming that its certificate SANs match the address in --listen-addr. A node can advertise an address different from its bind interface in more elaborate network designs, but the address in the join list must be reachable by the other nodes and represented in the certificate. Start all three processes before initialization and watch their logs for certificate, DNS, or connection errors.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Initialize the cluster exactly once

When all three nodes are running and can reach one another, initialize the cluster from any one of the listed SQL/RPC addresses:

cockroach init 
  --certs-dir=/var/lib/cockroach/certs 
  --host=node1.example:26257

A successful operation prints:

Cluster successfully initialized

Initialization is a one-time cluster operation. Do not run it separately on node2 or node3, and do not repeat it after a successful bootstrap. If the command reports that the cluster is already initialized, use the existing cluster rather than trying to create another one.

Verify SQL connectivity, writes, and replication

Connect with the root client certificate

cockroach sql 
  --certs-dir=/var/lib/cockroach/certs 
  --host=node1.example:26257

At the SQL prompt, perform a small write and read test:

CREATE DATABASE appdb;
CREATE TABLE appdb.health_check (
  id INT PRIMARY KEY,
  note STRING
);
INSERT INTO appdb.health_check (id, note)
VALUES (1, 'three-node bootstrap');
SELECT * FROM appdb.health_check;

Connect again through node2 and then node3 with the same CA and client certificate, and run the SELECT. Every node can act as a SQL gateway, so the row should be readable through each address. This check proves client connectivity and a basic write/read path; it does not replace backup, failure, or performance testing.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check the DB Console

Open the HTTPS DB Console address for one node, such as https://node1.example:8080, using a name covered by the node certificate. Confirm that the cluster reports three live nodes. Identical replica counts for the test data across nodes are evidence that replication is occurring through Raft consensus. If only one node appears, inspect the node logs, DNS, firewall rules, and certificate SANs before placing traffic on the cluster.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Create a least-privilege operator

Do not use the root certificate for every console session or application. Create a named SQL user and grant only the roles required for console access and administration. Store the root client key as a break-glass credential, rotate ordinary client certificates according to your policy, and record which automation owns each certificate.

Put the process under systemd

Running cockroach start in an interactive shell is suitable for a temporary test, not a production service. A process manager should start the node after boot, restart it after an unexpected exit, and send output to your normal logging system.

Create one unit on each host and substitute that host’s name in --listen-addr and --http-addr. The join list remains the same:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
[Unit]
Description=CockroachDB node
After=network-online.target
Wants=network-online.target

[Service]
User=cockroach
Group=cockroach
ExecStart=/usr/local/bin/cockroach start --certs-dir=/var/lib/cockroach/certs --store=/var/lib/cockroach/data --listen-addr=node1.example:26257 --http-addr=node1.example:8080 --join=node1.example:26257,node2.example:26257,node3.example:26257
Restart=on-failure
RestartSec=5
LimitNOFILE=35000

[Install]
WantedBy=multi-user.target

Save the unit under the systemd service directory, reload units, enable it for boot, and start it. Then inspect service status and logs before initializing:

sudo systemctl daemon-reload
sudo systemctl enable --now cockroachdb
sudo systemctl status cockroachdb
sudo journalctl -u cockroachdb -f

The exact unit name, account, file paths, resource limits, and logging destination should match your operating standards. Do not create three services that point at the same store; each host must retain its own store directory.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Network, certificate, and bootstrap troubleshooting

“Connection refused” or a node never joins

  • Verify the process is listening on the intended interface and port, not only on localhost.
  • Resolve every join-list name from every host and test TCP 26257 in both directions.
  • Check host firewalls, cloud security rules, and routing between failure domains.
  • Confirm that the join list is spelled identically on all nodes and that no stale address remains after a DNS change.

TLS hostname or SAN errors

  • Connect using a DNS name or IP that is actually present in the certificate SAN field.
  • Regenerate or reissue the node certificate when a production address changes; changing DNS alone does not change certificate contents.
  • Ensure the client trusts the intended ca.crt and that private-key and certificate files are paired.
  • Check file ownership and permissions when the service account cannot read the certificate directory.

Initialization fails or was run twice

Initialize only after all nodes are started and mutually reachable. A message indicating that the cluster is already initialized means the bootstrap succeeded earlier; stop retrying and connect with the SQL client instead. If one node was started with an incorrect store or join address, stop it, correct the configuration, and follow the documented recovery procedure rather than deleting data casually.

The console shows fewer than three live nodes

Inspect each node’s service status and logs, then check 26257 reachability and certificate validity. A node that can serve its own console on 8080 may still be unable to join the cluster if its SQL/RPC address is blocked or not resolvable by the other members.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

An insecure command appears in a tutorial

The --insecure mode provides neither network encryption nor authentication. It is intended for local testing and must not be exposed on a routable production network. Replace it with the certificate-based commands in this guide before allowing external access.

Choose the operating model that fits the environment

Decision Option What changes Important limitation
Infrastructure Self-managed Ubuntu hosts or VMs You control OS patching, disks, firewalls, certificates, upgrades, and service supervision. Availability depends on the failure domains and operational discipline you build.
Infrastructure Managed CockroachDB Cloud The provider handles much of provisioning and service operation; you connect applications to the managed endpoint. The manual Ubuntu procedure here is not the provisioning workflow for a managed service.
Topology Separate physical or virtual failure domains Node loss is less likely to remove a quorum. Requires routable networking and independent capacity for each host.
Topology Several nodes on one host Useful for development and command testing. Not a production high-availability design because one host failure removes every node.
Trust CockroachDB-generated CA Fast to create and straightforward for a self-managed cluster. You must protect the CA key and operate certificate renewal yourself.
Trust Organizational or public PKI Integrates with existing identity and certificate governance. Issuance, SAN policy, renewal, and trust distribution must match CockroachDB’s certificate requirements.
Operations systemd Simple host-level startup, restart, and journal integration. You still own host placement, upgrades, scaling, and failure handling.
Operations Orchestrated deployment Automates scheduling, replacement, and service discovery when designed for stateful workloads. Persistent storage, stable identities, certificates, and failure domains require careful orchestration.

Production hand-off checklist

  • Three nodes run on separate hosts or failure domains, each with its own persistent store.
  • The CockroachDB release is identical on all nodes and recorded for change management.
  • DNS and firewall rules permit only the required SQL/RPC and DB Console paths.
  • Node certificates contain every DNS name and IP address used by nodes, clients, and any load balancer.
  • The CA private key is protected away from ordinary database hosts; node and client private keys have restrictive ownership and permissions.
  • All nodes use the same join list, but unique listen addresses and unique stores.
  • cockroach init was executed once, with the success message recorded.
  • SQL create, insert, and select operations succeed through more than one node.
  • DB Console shows three live nodes and expected replica counts.
  • A non-root operator identity exists with only the roles required for its job.
  • systemd or another service manager starts the process, restarts failures, and forwards logs to an alerting system.
  • Monitoring and alert thresholds cover node liveness, storage capacity, replication health, certificate expiry, and service restarts.
  • Backups, restore testing, upgrade procedures, and a documented response to loss of a node are in place before production traffic is admitted.

What success looks like

A correctly deployed cluster has three independently reachable Ubuntu nodes, encrypted and authenticated connections, one successful initialization, and the same test data visible through multiple SQL gateways. DB Console confirms that all three members are live, while systemd and monitoring keep the deployment observable after the initial setup. Treat colocated nodes and insecure mode as development conveniences only; production resilience comes from separate failure domains, correct certificate SANs, and disciplined operations.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.