Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk9 min

How to Install an Apache ZooKeeper Cluster on Ubuntu VPS Servers

Deploy a resilient Apache ZooKeeper ensemble on three Ubuntu VPS servers with consistent configuration, unique myid files, restricted ports, verified leader election, and production-ready storage and monitoring.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install a production-style ZooKeeper ensemble on three separately reachable Ubuntu VPS servers, with Java, the same zoo.cfg on every host, a unique numeric myid in each data directory, and firewall rules that keep client, quorum, and election traffic on the networks that need it. The procedure below uses zk1, zk2, and zk3; replace those names with stable private DNS records or private IP addresses.

What you are building

ZooKeeper is normally deployed as an ensemble rather than as an isolated server. An ensemble continues serving only when a majority of its configured servers can communicate, so the hosts should be independent machines with reliable private connectivity. Apache recommends at least three servers for fault tolerance and generally prefers an odd number because adding an even-numbered server does not improve the number of failures the majority can tolerate.

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.
Ensemble size Servers required for a majority Failures tolerated while retaining a majority
3 2 1
4 3 1
5 3 2

A four-node deployment therefore costs another machine without improving failure tolerance over three nodes. For a first VPS deployment, place zk1, zk2, and zk3 in separate failure domains when the provider supports that option. A three-instance arrangement on one physical host is not independent enough to provide the resilience implied by an ensemble.

Choose the network and VPS layout first

Use stable private addresses

Give each VPS a private address or private DNS name that remains stable across reboots. Every server must be able to resolve and reach every other server. Do not build the ensemble around changing public addresses or hostnames that resolve differently from one node to another.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

The names used in the configuration below are:

  • zk1 — ensemble server ID 1
  • zk2 — ensemble server ID 2
  • zk3 — ensemble server ID 3

Confirm name resolution and TCP reachability between all three hosts before installing ZooKeeper. If the VPS provider does not offer a private network, use a private overlay or VPN and restrict the resulting source addresses. Do not make quorum or election listeners generally reachable from the internet.

Evaluate a VPS on operational characteristics

For this workload, compare providers and plans using the following criteria rather than CPU count alone:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Private networking between all three instances
  • Predictable disk latency and IOPS, especially for the transaction log
  • Independent availability zones or other failure domains
  • Inbound and outbound firewall controls
  • Persistent-volume, snapshot, and backup support
  • IPv4 and IPv6 behavior that is consistent across the private network
  • Host and guest monitoring facilities
  • Regional availability that matches your applications

A low-cost plan can be suitable only if it still supplies persistent storage, dependable networking, and separate instances. ZooKeeper’s correctness depends more on latency, durability, and connectivity than on peak benchmark throughput.

Prepare each Ubuntu server

Apply updates and install Java

Log in to each VPS, apply the current security updates for the selected Ubuntu release, and install a Java runtime supported by the exact ZooKeeper release you intend to deploy. Java is a prerequisite; the package name can differ between Ubuntu releases and ZooKeeper versions, so use the release documentation and your distribution’s package index rather than copying an unqualified package name.

Record the Ubuntu release, Java runtime version, and ZooKeeper version in your deployment notes. Pin the ZooKeeper version instead of silently following a moving download filename.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Create a dedicated service account and directories

Run ZooKeeper as a non-root account. The following layout separates the program, configuration, persistent snapshots, transaction log, and ordinary logs:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo useradd --system --home /var/lib/zookeeper --shell /usr/sbin/nologin zookeeper
sudo mkdir -p /opt/zookeeper
sudo mkdir -p /etc/zookeeper
sudo mkdir -p /var/lib/zookeeper
sudo mkdir -p /var/lib/zookeeper-log
sudo mkdir -p /var/log/zookeeper
sudo chown -R zookeeper:zookeeper /opt/zookeeper /etc/zookeeper /var/lib/zookeeper /var/lib/zookeeper-log /var/log/zookeeper

Use equivalent paths if your packaging policy requires a different prefix, but keep the paths consistent with the configuration and backup plan. The data directory must be persistent; it must not be a temporary filesystem that disappears when a VPS is recreated.

Download and verify the Apache distribution

Download the selected binary release from Apache’s official download infrastructure. Verify the published checksum or signature before unpacking it. Apache’s download index changes as releases are published, so keep the exact release filename and verification result in your change record.

Unpack the verified archive under /opt/zookeeper, make the chosen release directory readable and executable by the zookeeper account, and place the configuration file in /etc/zookeeper. Do not run the server from a directory that ordinary users can modify.

Write the ensemble configuration

Create /etc/zookeeper/zoo.cfg. This same file, including the complete server list, must be present on all three hosts:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
tickTime=2000
dataDir=/var/lib/zookeeper
dataLogDir=/var/lib/zookeeper-log
clientPort=2181
initLimit=5
syncLimit=2
server.1=zk1:2888:3888
server.2=zk2:2888:3888
server.3=zk3:2888:3888

What each setting controls

  • tickTime=2000 sets ZooKeeper’s basic time unit to 2,000 milliseconds.
  • dataDir=/var/lib/zookeeper stores snapshots and, when no separate log directory is supplied, transaction updates.
  • dataLogDir=/var/lib/zookeeper-log puts transaction logs on a separate path. Keep this path on fast, reliable storage.
  • clientPort=2181 is the listener used by application clients and the command-line client.
  • initLimit=5 and syncLimit=2 are the sample initialization and synchronization limits from the Apache getting-started configuration.
  • Each server.id=host:quorumPort:electionPort entry identifies one ensemble member. Port 2888 carries quorum traffic; port 3888 is used for leader election.

The server list is not a list of only the local machine. Every node must contain all three entries, in a consistent form. A typo, a missing member, or a hostname that resolves differently on one host can prevent quorum formation or cause clients to discover inconsistent ensembles.

Set the required myid file

ZooKeeper maps the numeric ID in myid to the matching server.id line. Create exactly one number in /var/lib/zookeeper/myid on each server; do not add labels, spaces, or extra lines.

# on zk1
printf '1' | sudo tee /var/lib/zookeeper/myid
sudo chown zookeeper:zookeeper /var/lib/zookeeper/myid

# on zk2
printf '2' | sudo tee /var/lib/zookeeper/myid
sudo chown zookeeper:zookeeper /var/lib/zookeeper/myid

# on zk3
printf '3' | sudo tee /var/lib/zookeeper/myid
sudo chown zookeeper:zookeeper /var/lib/zookeeper/myid

Check the result before starting the process:

sudo -u zookeeper cat /var/lib/zookeeper/myid

The value printed on each host must correspond to that host’s server entry. Copying one host’s data directory or myid file to another is a common way to create duplicate IDs; create the file independently on every machine.

Restrict the three network roles with firewalls

Apache recommends deploying ZooKeeper behind a firewall. Apply controls both at the VPS provider’s network layer and on the Ubuntu host when possible.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
TCP port Purpose Permitted sources
2181 Client connections Trusted application and administration networks
2888 Quorum communication Only the private addresses of zk1, zk2, and zk3
3888 Leader-election traffic Only the private addresses of zk1, zk2, and zk3

Do not expose ports 2888 or 3888 to the public internet. Port 2181 should not be open to the world either; allow only the applications that need ZooKeeper. If an application must connect from outside the private network, carry the traffic over a private overlay or VPN, restrict source addresses tightly, and configure the authentication and TLS features supported by the selected ZooKeeper release.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Cloud-firewall syntax varies by VPS provider. The important result is that the three servers can reach one another on 2888 and 3888, trusted clients can reach 2181, and unrelated internet hosts cannot reach any of those listeners.

Start the servers

After checking ownership, DNS, firewall rules, zoo.cfg, and myid, start the ZooKeeper process on each host with the distribution launcher:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo -u zookeeper /opt/zookeeper/bin/zkServer.sh start

If your unpacked release uses a different path, invoke its bin/zkServer.sh file. Start all three members within a short maintenance window so that the ensemble can establish a majority and elect a leader. For long-running operation, run the launcher under a service supervisor appropriate to your Ubuntu policy and ensure the supervisor starts it as the zookeeper account with the intended configuration path.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Verify quorum, leadership, and client access

Check the process and listeners

On every host, confirm that the Java process is running and that the expected listeners are bound. A process being present is not proof that the ensemble is healthy: a node can run while it is isolated from the other members.

Read the server logs

Inspect the ZooKeeper logs for successful connections between members, quorum formation, and leader election. You should be able to identify one leader and the expected followers. Investigate repeated connection attempts, election restarts, authorization errors, or storage errors before directing applications to the ensemble.

Connect with the command-line client

From an allowed administration host, use the CLI shipped with the exact release you installed. A typical invocation is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
/opt/zookeeper/bin/zkCli.sh -server zk1:2181

Use the command syntax documented by that release. In a disposable test path, perform a harmless read and write, then remove the test node. For example, the familiar CLI sequence is:

create /installation-check "ok"
get /installation-check
delete /installation-check

Do not use an application’s production znode for this test. A successful CLI connection proves that one client path works; it does not by itself prove that all ensemble members agree.

Perform a controlled maintenance test

After the initial checks, stop one member during a planned window and verify that the remaining majority still has a leader and accepts the test client’s request. Restart the stopped member and confirm that it rejoins and catches up. Record the observed behavior for your exact release, network, and storage configuration; do not advertise failover capability until this test has actually succeeded.

Production storage and JVM practices

Protect the transaction log

Transaction-log placement is performance-critical. Keep dataLogDir on fast, reliable storage and avoid sharing the device with a workload that creates unpredictable latency. Persistent volumes should survive a process restart and be included in the backup and recovery design.

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

Size memory conservatively

Set the maximum Java heap only after considering the operating system, ZooKeeper’s native needs, and filesystem cache. Leaving no memory headroom can cause swapping; the administrator guidance warns that swapping severely degrades ZooKeeper performance. Load-test with your expected request rate and data shape before selecting a final heap value, and monitor garbage collection and process memory after deployment.

Back up and monitor

  • Schedule snapshots or backups that match your recovery-point and recovery-time objectives.
  • Document the selected release’s snapshot and restore procedure before automating recovery.
  • Rotate logs so diagnostic files cannot consume the data volume.
  • Alert on disk utilization, transaction-log latency, heap pressure, request latency, process restarts, and loss of quorum.
  • Monitor leader and follower state using the monitoring facilities supported by the installed release.

Backups do not replace quorum. They provide a recovery path for corruption, operator error, or loss of infrastructure; normal availability still depends on a majority of live, communicating members.

Troubleshoot the failures that matter most

No leader is elected

  • Compare zoo.cfg byte-for-byte across all hosts and verify that all three server.* entries exist everywhere.
  • Check that each myid contains a different number matching its server entry.
  • Test private DNS or address resolution from every node to every other node.
  • Review provider and host firewalls for TCP 2888 and 3888 in both directions.
  • Check logs and disk health for repeated restarts or transaction-log errors.

A client receives connection refused or times out

  • Confirm that the process is listening on the configured client port, 2181.
  • Verify that the client’s source address is allowed by both firewall layers.
  • Check that the client uses the private address or approved overlay route, not an unreachable public address.
  • Review logs for authentication or protocol settings required by the selected release.

A member starts but does not rejoin

  • Ensure its data and transaction-log paths are writable by zookeeper.
  • Confirm that its clock, hostname resolution, and server ID are correct.
  • Look for storage latency, a full volume, or a stale process holding the configured ports.
  • Do not delete persistent data as a first response; follow the release’s documented recovery procedure and preserve backups.

The ensemble becomes slow under load

  • Inspect transaction-log latency and move the log to faster storage if necessary.
  • Check for swapping and reduce the heap or add memory so the operating system retains cache headroom.
  • Review disk contention, network latency, and request patterns rather than adding an arbitrary fourth member.
  • Use load testing to validate heap and storage choices before changing production limits.

Pre-flight checklist

  • Three independent Ubuntu VPS instances have stable private addresses or DNS.
  • The same pinned Apache ZooKeeper release and supported Java runtime are installed on each host.
  • The service account owns the installation, configuration, data, transaction-log, and log paths.
  • zoo.cfg is identical on all members and lists every server.
  • Each data directory contains exactly one correct numeric myid.
  • Clients can reach 2181 only from trusted networks.
  • Only the three ensemble addresses can reach 2888 and 3888.
  • Logs show a leader and connected followers after startup.
  • A disposable CLI read/write test succeeds.
  • A controlled one-node stop and restart has been tested.
  • Persistent storage, backups, log rotation, monitoring, and alerting are documented.

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 from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver 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.