You read the YugabyteDB pitch and the YSQL surface convinced you — wire-protocol-compatible with Postgres on port 5433, distributed under the hood, replication factor configurable per table, and an optional YCQL surface on 9042 if you ever want Cassandra semantics on the same storage. You ran the docker single-node, your psql client connected, your existing application schema applied without a rewrite, and the boss said “ship it.” Then you started reading the operations docs and realized that “ship it” requires you to understand yb-master, yb-tserver, why the cluster needs an explicit master_addresses argument on every binary, and what happens when you forget to bump ulimits. This guide is the gap.
What’s happening
A YugabyteDB cluster is two services on each node. yb-master is the cluster’s metadata layer — a Raft group across (typically) three master nodes that owns table catalogs, tablet placement, and load balancing decisions. yb-tserver is the data plane — every tablet of every table is replicated across (typically) three tserver nodes, also via Raft. In a small cluster, master and tserver run on the same VM; in larger ones you separate them. The query layer is split into two surfaces: YSQL on port 5433 is a fork of the PostgreSQL query layer running on top of the distributed storage; you connect to it with psql, you apply Postgres schemas, you run Postgres SQL. YCQL on port 9042 is a Cassandra-compatible query layer over the same storage; you ignore it unless you have a CQL client to point at it.
The cluster is created by starting yb-master on each master node with the full master_addresses list, then starting yb-tserver on each tserver node with the same master_addresses list. There is no separate “init” step the way CockroachDB has — the cluster bootstraps as soon as the masters can form Raft quorum. Replication factor (typically 3) is set per-table or as a cluster default, and writes are quorum-acknowledged before returning.
This installer wires the OS prep (ulimits, transparent hugepages off, NTP tight, swap off), pulls the YugabyteDB tarball, writes systemd units for yb-master and yb-tserver, and starts both with the right flags. Repeat on three Ubuntu 22.04 VMs and you have an RF=3 cluster.
How to verify
Cluster state from any node:
/opt/yugabyte/bin/yb-admin \
--master_addresses=10.40.0.11:7100,10.40.0.12:7100,10.40.0.13:7100 \
list_all_masters
# Master UUID RPC Host/Port State Role
# 11111111-1111-1111-1111-111111111 10.40.0.11:7100 ALIVE LEADER
# 22222222-2222-2222-2222-222222222 10.40.0.12:7100 ALIVE FOLLOWER
# 33333333-3333-3333-3333-333333333 10.40.0.13:7100 ALIVE FOLLOWER
Tservers and their tablet counts:
/opt/yugabyte/bin/yb-admin \
--master_addresses=10.40.0.11:7100,10.40.0.12:7100,10.40.0.13:7100 \
list_all_tablet_servers
YSQL surface (Postgres-compatible):
ysqlsh -h 10.40.0.11 -p 5433 -U yugabyte -d yugabyte -c "SELECT version();"
# PostgreSQL 11.2-YB-2.20.4.0-b0 ...
Replication factor and per-table tablet count:
ysqlsh -h 10.40.0.11 -p 5433 -U yugabyte -d yugabyte -c "
SELECT relname, num_tablets, num_hash_key_columns, is_colocated
FROM yb_table_properties((SELECT oid FROM pg_class WHERE relname='your_table'));
"
NTP drift (YugabyteDB hybrid time depends on bounded clock skew):
chronyc tracking | grep "System time"
Anything beyond a few hundred milliseconds is a fault — fix NTP before traffic.
The fix
Save the script below as /root/setup-yugabyte-node.sh on each of the three Ubuntu 22.04 VMs. Edit the variables and run.
#!/usr/bin/env bash
set -euo pipefail
### Ubuntu 22.04 YugabyteDB 2.20 LTS 3-node cluster installer
### Run on each of the 3 nodes after editing the variables below
### Each node runs yb-master + yb-tserver (small cluster footprint)
### Snapshots are taken at the volume level
### yb-admin create_snapshot is a logical layer on top
if [[ "$(id -u)" -ne 0 ]]; then
echo "Run as root."
exit 1
fi
# === EDIT PER NODE ===
NODE_NAME="yb01"
NODE_IP="10.40.0.11"
PEER_IPS=("10.40.0.11" "10.40.0.12" "10.40.0.13")
YB_VERSION="2.20.4.0"
YB_BUILD="b0"
DATA_DEVICE="/dev/sdb"
DATA_MOUNT="/mnt/yugabyte"
PLACEMENT_CLOUD="local"
PLACEMENT_REGION="local-1"
PLACEMENT_ZONE="${NODE_NAME}"
# =====================
MASTER_ADDRS="${PEER_IPS[0]}:7100,${PEER_IPS[1]}:7100,${PEER_IPS[2]}:7100"
echo
echo "========================================"
echo "YugabyteDB node ${NODE_NAME} (${NODE_IP})"
echo "========================================"
echo
echo "==> Updating base OS"
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get -y upgrade
apt-get -y install curl wget gnupg ca-certificates chrony fail2ban \
unattended-upgrades net-tools iproute2 jq lsof tcpdump xfsprogs \
lvm2 numactl psmisc
systemctl enable --now chrony
# Hybrid time requires tight clocks
cat > /etc/chrony/chrony.conf <<'CHRONY'
pool 2.pool.ntp.org iburst maxsources 4
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
logdir /var/log/chrony
CHRONY
systemctl restart chrony
echo "==> Hardening SSH"
sed -i 's|^[#[:space:]]*PermitRootLogin.*|PermitRootLogin prohibit-password|' /etc/ssh/sshd_config
sed -i 's|^[#[:space:]]*PasswordAuthentication.*|PasswordAuthentication no|' /etc/ssh/sshd_config
sshd -t && systemctl restart ssh
echo "==> fail2ban + auto security updates"
cat > /etc/fail2ban/jail.d/sshd.local <<'FAIL2BAN'
[sshd]
enabled = true
port = ssh
backend = systemd
maxretry = 4
findtime = 10m
bantime = 1h
FAIL2BAN
systemctl enable --now fail2ban
dpkg-reconfigure -f noninteractive unattended-upgrades
echo "==> Disabling transparent hugepages"
cat > /etc/systemd/system/disable-thp.service <<'THP'
[Unit]
Description=Disable Transparent Huge Pages
After=sysinit.target local-fs.target
[Service]
Type=oneshot
ExecStart=/bin/sh -c "echo never > /sys/kernel/mm/transparent_hugepage/enabled; echo never > /sys/kernel/mm/transparent_hugepage/defrag"
RemainAfterExit=yes
[Install]
WantedBy=basic.target
THP
systemctl daemon-reload
systemctl enable --now disable-thp.service
echo "==> Disabling swap"
swapoff -a
sed -i '/swap/s/^/#/' /etc/fstab
echo "==> sysctl tuning"
cat > /etc/sysctl.d/99-yugabyte.conf <<'SYSCTL'
vm.swappiness = 0
vm.max_map_count = 262144
fs.file-max = 2097152
net.core.somaxconn = 65535
net.ipv4.tcp_max_syn_backlog = 65535
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.ip_local_port_range = 10240 65535
kernel.dmesg_restrict = 1
SYSCTL
sysctl --system
echo "==> ulimits for yugabyte user"
cat > /etc/security/limits.d/99-yugabyte.conf <<'LIMITS'
yugabyte soft nofile 1048576
yugabyte hard nofile 1048576
yugabyte soft nproc 12000
yugabyte hard nproc 12000
yugabyte soft core unlimited
yugabyte hard core unlimited
yugabyte soft stack 32768
yugabyte hard stack 32768
LIMITS
echo "==> Creating yugabyte system user"
id yugabyte >/dev/null 2>&1 || useradd --system --home /home/yugabyte --shell /bin/bash --create-home yugabyte
echo "==> Preparing data mount"
mkdir -p "${DATA_MOUNT}"
if [[ -n "${DATA_DEVICE}" && -b "${DATA_DEVICE}" ]]; then
if ! blkid "${DATA_DEVICE}" >/dev/null 2>&1; then
echo "Formatting ${DATA_DEVICE} as xfs"
mkfs.xfs -f -L yugabyte "${DATA_DEVICE}"
fi
if ! grep -q "${DATA_MOUNT}" /etc/fstab; then
echo "LABEL=yugabyte ${DATA_MOUNT} xfs defaults,noatime,nofail 0 0" >> /etc/fstab
fi
mount -a
fi
mkdir -p "${DATA_MOUNT}/master" "${DATA_MOUNT}/tserver"
chown -R yugabyte:yugabyte "${DATA_MOUNT}"
echo "==> Installing YugabyteDB ${YB_VERSION}"
cd /tmp
TARBALL="yugabyte-${YB_VERSION}-${YB_BUILD}-linux-x86_64.tar.gz"
wget -q "https://downloads.yugabyte.com/releases/${YB_VERSION}/${TARBALL}"
tar -xzf "${TARBALL}" -C /opt
rm -rf /opt/yugabyte
mv "/opt/yugabyte-${YB_VERSION}" /opt/yugabyte
chown -R yugabyte:yugabyte /opt/yugabyte
echo "==> Running post-install (sets up bundled libs)"
sudo -u yugabyte /opt/yugabyte/bin/post_install.sh
echo "==> Writing yb-master systemd unit"
cat > /etc/systemd/system/yb-master.service <<EOF
[Unit]
Description=YugabyteDB yb-master
Wants=network-online.target
After=network-online.target
[Service]
User=yugabyte
Group=yugabyte
LimitCORE=infinity
LimitNOFILE=1048576
LimitNPROC=12000
ExecStart=/opt/yugabyte/bin/yb-master \\
--fs_data_dirs=${DATA_MOUNT}/master \\
--master_addresses=${MASTER_ADDRS} \\
--rpc_bind_addresses=${NODE_IP}:7100 \\
--webserver_interface=${NODE_IP} \\
--webserver_port=7000 \\
--placement_cloud=${PLACEMENT_CLOUD} \\
--placement_region=${PLACEMENT_REGION} \\
--placement_zone=${PLACEMENT_ZONE} \\
--replication_factor=3 \\
--logtostderr
Restart=on-failure
RestartSec=5
TimeoutStopSec=120
KillMode=process
[Install]
WantedBy=multi-user.target
EOF
echo "==> Writing yb-tserver systemd unit"
cat > /etc/systemd/system/yb-tserver.service <<EOF
[Unit]
Description=YugabyteDB yb-tserver
Wants=network-online.target yb-master.service
After=network-online.target yb-master.service
[Service]
User=yugabyte
Group=yugabyte
LimitCORE=infinity
LimitNOFILE=1048576
LimitNPROC=12000
ExecStart=/opt/yugabyte/bin/yb-tserver \\
--fs_data_dirs=${DATA_MOUNT}/tserver \\
--tserver_master_addrs=${MASTER_ADDRS} \\
--rpc_bind_addresses=${NODE_IP}:9100 \\
--webserver_interface=${NODE_IP} \\
--webserver_port=9000 \\
--pgsql_proxy_bind_address=${NODE_IP}:5433 \\
--cql_proxy_bind_address=${NODE_IP}:9042 \\
--start_pgsql_proxy=true \\
--start_cql_proxy=true \\
--placement_cloud=${PLACEMENT_CLOUD} \\
--placement_region=${PLACEMENT_REGION} \\
--placement_zone=${PLACEMENT_ZONE} \\
--logtostderr
Restart=on-failure
RestartSec=5
TimeoutStopSec=120
KillMode=process
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable yb-master yb-tserver
systemctl start yb-master
sleep 10
systemctl start yb-tserver
echo "==> Waiting for listeners"
for i in {1..60}; do
LISTEN=$(ss -lnt | awk '{print $4}' | grep -E "${NODE_IP}:(7100|9100|5433|9042)" | wc -l || true)
if [[ "${LISTEN}" -ge 4 ]]; then break; fi
sleep 2
done
echo
echo "========================================"
echo "DONE on ${NODE_NAME}"
echo "========================================"
echo
echo "Listeners:"
ss -lntp | grep -E ':(5433|7000|7100|9000|9042|9100)\b' || true
echo
echo "After all 3 nodes are up, verify from any node:"
echo " /opt/yugabyte/bin/yb-admin --master_addresses=${MASTER_ADDRS} list_all_masters"
echo " /opt/yugabyte/bin/yb-admin --master_addresses=${MASTER_ADDRS} list_all_tablet_servers"
echo
echo "YSQL connection:"
echo " ysqlsh -h ${NODE_IP} -p 5433 -U yugabyte"
echo
echo "Master UI: http://${NODE_IP}:7000/"
echo "TServer UI: http://${NODE_IP}:9000/"
Make it executable and run on each node:
chmod 700 /root/setup-yugabyte-node.sh
/root/setup-yugabyte-node.sh
Once all three nodes are up, the cluster auto-bootstraps. From any node, verify and create your application database:
/opt/yugabyte/bin/yb-admin \
--master_addresses=10.40.0.11:7100,10.40.0.12:7100,10.40.0.13:7100 \
list_all_masters
ysqlsh -h 10.40.0.11 -p 5433 -U yugabyte
Inside ysqlsh:
CREATE DATABASE app;
\c app
CREATE USER app WITH ENCRYPTED PASSWORD 'CHANGE_ME';
GRANT ALL ON DATABASE app TO app;
For backups, YugabyteDB exposes yb-admin create_snapshot for an in-cluster snapshot of all or specified tables; pair it with volume snapshots of /mnt/yugabyte on each node every six hours. The in-cluster snapshot lets you restore a specific table without rebuilding the cluster; the volume snapshot is your fast single-node recovery. Schedule a ysql_dump to object storage weekly as a third layer — that one survives even a wholesale fleet replacement.
Do a failover drill before production traffic: stop yb-master on the current leader and confirm the cluster keeps accepting writes. If it pauses for longer than the Raft election timeout (default 1.5s), the cluster is wrong somewhere — fix it now.
Run YugabyteDB on Stack Harbor’s managed dedicated cloud with NTP discipline, monitoring, and the snapshot policy operated under environment management, or start a scoping call if you’d like us to size the cluster with you.