# Enterprise features

**Target length:** 12 minutes  
**Kernel on camera:** 2.74.26  
**Audience:** Operator setting up one primary and one testdb replica. Trial is enough for the lab. A `VELOCE-EE-` key is what keeps it after the trial. `VELOCE-EN-` and `VELOCE-ENT-` still verify. `VELOCE-W5-` and `VELOCE-WG-` do not.

One primary. The example fence identity is `host03-1584`: hostname `host03`, cluster port 1584, which is the default node id when `VELOCE_NODE_ID` is unset. The replica holds testdb only. Replica `INSERT` and `MINSERT` are accepted and forwarded to the primary on TCP 1584, then mirrored into the replica’s memory and journal. That is a proxy. It is not two primaries.

If the replica stops hearing the primary, it promotes itself. Default wait is `VELOCE_FAILOVER_MS`, 1500 milliseconds. Restarting the primary while the replica is up looks like that silence. **Stop the replica before you restart the primary.** Start the replica again after the primary is listening. Otherwise you get two primaries. The fence is the repair: higher epoch wins. You still do not want the split.

Firewall: loopback, plus the peer as a `/32`. Never `0.0.0.0/0` on 1583, 2143, 1584, or 8098. Never set `VELOCE_BIND=0.0.0.0`.

## On-screen beats

1. `SHOW LICENSE` with `enterprise: true` (trial or an EE key). If it is false, stop. This demo will return `ERROR enterprise`.
2. Diagram: primary `host03-1584` ↔ replica, TCP 1584, testdb only.
3. `SHOW CLUSTER` on the primary. Point at `nodeId`, `role`, `epoch`.
4. Replica process environment. Do not use the primary’s ports.
5. Insert on the replica. `GET` on the primary.
6. The stop-replica-first restart rule, said twice.
7. `FAILOVER` without YES, then do **not** run `FAILOVER RESUME YES` unless this is a lab you can fence.
8. UFW or Windows firewall slide: peer `/32` only.

## GUI vs CLI

| Show in the GUI | Show in the terminal |
| --- | --- |
| Control Center → Cluster. That pane is `health.cluster` from `/health` | `SHOW CLUSTER`, `SHOW ROLE`, inserts, the replica unit environment |
| Overview license chip so `enterprise` is visible before you start | `BACKUP TESTDB` if you want a file under the data directory’s `backups/` |

`SHOW CLUSTER` in the SQL box is routed through operator HTTP catalogs. The cluster pane is the live snapshot. Prefer the pane plus a real line on port 2143 so both agree.

## Spoken script

“Enterprise on this kernel is testdb high availability. One primary. One replica. Writes commit on the primary. The replica can take the same insert line and forward it. Reads can come from the replica after `SET ROLE replica`. I am going to show membership, the forward path, backup, and the restart rule. I am not going to pull the plug on a machine that has users.”

```text
SHOW LICENSE
```

“I need `enterprise` true. During the thirty-day trial that flag is true with no key. After the trial it stays true for prefix EE, EN, or ENT. A W5 or WG key sets it false, and then `BACKUP TESTDB`, `SET ROLE cluster-replica`, and `CLUSTER STANDBY` return `ERROR enterprise`. If I still need the trial’s HA, I do this video before I activate Standard.”

```text
SHOW CLUSTER
SHOW ROLE
```

“Both are JSON. `SHOW ROLE` has version, role, nodeId, epoch, fence. On a host whose name is host03 and whose cluster port is fifteen eighty-four, the default node id is `host03-1584`. That is the fence name. You can override it with `VELOCE_NODE_ID`. I want the room to see a single role: primary.”

“Same host, the primary also opens an in-process standby when enterprise is on, role is primary, and `VELOCE_REPLICA_LISTEN` is not zero. Those ports are eleven five eighty-three, twelve one four three, and eleven five eighty-four. That standby is WAL inside this process. It is not the second machine. Leave it out of the diagram or label it in-process.”

**Second machine, the setup to describe.** Bind each engine to that host’s own address, not to every interface. Primary peers at the replica’s address, port 1584. Replica peers at the primary’s address, port 1584.

Primary environment:

```text
VELOCE_BIND=<primary address>
VELOCE_CLUSTER_ROLE=primary
VELOCE_NODE_ID=host03-1584
VELOCE_CLUSTER_PEERS=<replica address>:1584
```

Replica environment:

```text
VELOCE_BIND=<replica address>
VELOCE_CLUSTER_ROLE=replica
VELOCE_NODE_ID=<replica hostname>-1584
VELOCE_CLUSTER_PEERS=<primary address>:1584
VELOCE_REPLICA_LISTEN=0
VELOCE_NATIVE_ISAM=0
```

“`VELOCE_CLUSTER_ROLE=replica` arms auto-promote. The replica’s store is testdb. `VELOCE_REPLICA_LISTEN=0` stops the replica from also opening the in-process standby ports. `VELOCE_NATIVE_ISAM=0` keeps the C acceptor off so you are looking at the Node listeners while you learn the ports. On Windows the C acceptor is already off.”

**Same-box lab, if you only have one computer.** The second process cannot bind 1583, 2143, 1584, and 8098. The primary’s in-process standby already wants 11583, 12143, and 11584. Use another set, the same idea as the private unit files in `deploy/`: for example workgroup 12583, SQL 13143, cluster 12584, HTTP 19098. Set `VELOCE_REPLICA_LISTEN=0` and `VELOCE_CLUSTER_ROLE=replica`. Point `VELOCE_CLUSTER_PEERS` at `127.0.0.1:1584`. Bind stays `127.0.0.1`. Data directory must be a different folder from the primary, or you will share a journal you do not want to share.

“Membership is not a command you have to type by hand. Each process sends `JOIN CLUSTER` and `HEARTBEAT` to the peer on fifteen eighty-four. You can still ask.”

```text
SHOW CLUSTER
```

“Point at members, role, epoch, lsn. Two members, one primary.”

On the replica’s SQL port:

```text
INSERT TESTDB ent-1 from-replica
```

“The replica forwards `INSERT TESTDB ent-1 from-replica` to the primary. The reply is the primary’s ack, and the replica mirrors the row so a local `GET` can hit after `OK`. On the primary:”

```text
GET TESTDB ent-1
```

“`OK from-replica`. That is the proof. A replica `MINSERT` forwards the same way. This is not multi-master. If the primary is down, the forward fails. The replica does not quietly become a second writer unless it promotes, and promotion is the next rule.”

“`SET ROLE replica` on a connection asks that connection’s reads to use the replica path. `GET` and `MGET` follow it. There is an optional balancer, `engine/velocedb-lb.mjs`. It binds one twenty-seven dot zero dot zero dot one port thirty-five eighty-three unless you change `VELOCE_LB_PORT`. It discovers members with `SHOW CLUSTER` on `VELOCE_LB_SEED`, default `127.0.0.1:1584`. Writes still go to the primary. Reads round-robin. I mention it so you know the binary is in the payload. I do not need it for the forward proof.”

**Restart rule. Say it, then show the unit stop, do not actually bounce production.**

“Auto-promote runs on the replica when enterprise is allowed, the role is replica, and the primary has been quiet longer than `VELOCE_FAILOVER_MS`. Default fifteen hundred milliseconds. A primary restart is that quiet period. Stop the replica first. Restart the primary. Wait until `SHOW CLUSTER` on the primary says primary and the port is open. Then start the replica. If you restart the primary with the replica still running, the replica can promote, and you have two writers until the fence sorts the epoch. That is the split. Avoid it.”

Linux shape of the stop, using your unit name:

```bash
sudo systemctl stop velocedb-replica.service
sudo systemctl restart velocedb-workgroup.service
sudo systemctl start velocedb-replica.service
```

“The stock installer unit is named `velocedb-workgroup.service` for the primary. A replica unit is one you write with the environment above. Windows is the scheduled task `VeloceDBWorkgroup` for the default install. Disable or stop the replica task before you restart the primary task.”

“Manual failover is dual-control. I am going to show the refusal, and I am not going to promote on camera.”

```text
FAILOVER
```

“Reply: `ERROR dual-control — FAILOVER RESUME YES`. The phrase that does promote is `FAILOVER RESUME YES`, or `CLUSTER FAILOVER RESUME YES`. The HTTP form is a POST to `http://127.0.0.1:8098/api/v1/cluster/failover` with body `{"resume":"YES"}`. Run those only in a lab where you can stand the old primary back down and accept a new epoch. `CLUSTER SIMULATE PRIMARY DOWN` promotes and skips the fence. That one is for a test process, not for host03.”

Backup, while you are still primary and enterprise is true:

```text
BACKUP TESTDB
```

“JSON with `ok` true, native testdb, an lsn, and a path under the data directory `backups/`, including `testdb.latest.jsonl`. `RESTORE TESTDB` reads that latest file back. It is a testdb snapshot, not a Postgres dump. pgwire is not a backup target. The CLI `veloce backup --dir <data>` writes the same files without the enterprise wire command. I am not restoring over the rows I just inserted unless this directory is a lab.”

```text
SET MAINTENANCE on
```

“Reply includes maintenance on. New inserts then fail with `ERROR maintenance`. Turn it off before you finish.”

```text
SET MAINTENANCE off
```

“Firewall, last, and it is part of the feature. On the two-host setup, allow TCP fifteen eighty-three, twenty-one forty-three, fifteen eighty-four, and eighty ninety-eight from one twenty-seven dot zero dot zero dot one and from the other host’s exact address, slash thirty-two. Then deny anywhere, IPv4 and IPv6. Operator HTTP stays off the public website. Nginx on host03 for veloce.tuce.app is a different process on port four four three. Do not punch eighty ninety-eight through that proxy for this demo. Local installs stay on one twenty-seven dot zero dot zero dot one and do not need a world rule. The Windows installer only adds firewall rules when the bind is not loopback. If you bind a real address, make those rules a `/32`, not Any.”

“What this is not. It is not Always On, not a multi-region fabric, not DPDK, not an XDP filter, not a SPIRE agent dial, not Kubernetes, not EKS, not RDS. `SHOW FABRICMESH` and `SHOW PROVEBENCH` will tell you those leftovers if you open them. They are catalogs. The feature you configured is one primary, one testdb replica, forward writes, and stop the replica before you restart the primary.”

## Exact commands

```text
SHOW LICENSE
SHOW CLUSTER
SHOW ROLE
SHOW REPLICA
CLUSTER STATUS
INSERT TESTDB ent-1 from-replica
MINSERT TESTDB ent-2 a ent-3 b
GET TESTDB ent-1
SET ROLE replica
BACKUP TESTDB
SET MAINTENANCE on
SET MAINTENANCE off
FAILOVER
```

`FAILOVER` and `CLUSTER FAILOVER` reply `ERROR dual-control — FAILOVER RESUME YES`.

Lab-only, not for the recording unless the room agreed to a promotion:

```text
FAILOVER RESUME YES
CLUSTER FAILOVER RESUME YES
```

```text
POST /api/v1/cluster/failover
{"resume":"YES"}
```

Environment the process reads: `VELOCE_BIND`, `VELOCE_DATA`, `VELOCE_CLUSTER_ROLE` (`primary` or `replica`), `VELOCE_NODE_ID`, `VELOCE_CLUSTER_PEERS` (comma-separated `host:1584`), `VELOCE_FAILOVER_MS` (default 1500), `VELOCE_REPLICA_LISTEN` (`0` to skip 11583 / 12143 / 11584), `VELOCE_NATIVE_ISAM` (`0` on the learning replica), `VELOCE_PORT_WG`, `VELOCE_PORT_SQL`, `VELOCE_PORT_CLUSTER`, `VELOCE_PORT_HTTP`.

Optional balancer, from the payload `engine` directory:

```bash
node velocedb-lb.mjs
```

Defaults: bind `127.0.0.1`, port `3583`, seed `127.0.0.1:1584`.

After a W5 or WG activation, expect `ERROR enterprise` on `BACKUP TESTDB` and on `SET ROLE cluster-replica`.

## Do not say

- Always On, RAC, Kubernetes, EKS, RDS, DPDK, XDP, a live SPIRE agent, or GenRM as features you just turned on.
- Multi-master, or “the replica commits on its own.” It forwards, then mirrors.
- “Restart the primary any time.” Stop the replica first or it can auto-promote.
- Bind `0.0.0.0` or a firewall rule of Anywhere / `0.0.0.0/0`.
- Actian Zen, Pervasive, Btrieve, a Community SKU, or a headless enterprise edition.
- That a five-user or unlimited Standard key keeps this after the trial. It returns `ERROR enterprise`. Trial and `VELOCE-EE-` (plus older `EN` / `ENT`) are the unlocks.
- `CLUSTER SIMULATE PRIMARY DOWN` as an operator procedure. It promotes with the fence skipped.
- A benchmark for ship lag. `SHOW CLUSTER` has the LSN. Read that.
