Skip to main content

NATS (nats)

Messaging system with JetStream persistence for events and work queues. Single server or clustered with routes.

Generated from catalog/services/nats.yaml: do not edit by hand.

Summary​

Version2.11.17
Useinstall and configure
Layerinfrastructure (shown apart)
CategoryData platforms
Installation methodsbinary, podman
External connectionnats
Sandbox onlyno

Licence​

SPDX identifierApache-2.0
Licence policycore licence (MIT or Apache-2.0)
Licence exception-
Platform componentnats

Packages and artifacts​

A package the project of the service publishes (its image, its binary archive, its Python or OS package) carries the licence of the service; a third-party package carries the licence written on its row, read from the official upstream metadata.

KindPackageVersionLicenceDetails
container imagedocker.io/library/nats2.11.17Apache-2.0image key nats, used by server, digest sha256:c991221cdddd53a24893cd18a90faf7a42396108496aed076bb982a349e76484
binary archivenats-server-v2.11.17-linux-amd64.tar.gz2.11.17Apache-2.0https://github.com/nats-io/nats-server/releases/download/v2.11.17/nats-server-v2.11.17-linux-amd64.tar.gz, x86_64, checksum sha256

Images are pinned by tag in the descriptor, and by digest when the descriptor declares one (the offline bundle then refuses a pulled image that does not carry it); the digest is recorded in the mirror of the Manager when the offline bundle is imported, and every pull or load is checked against it.

Supported systems and architectures​

MethodOperating systemsArchitectures
binaryRHEL family (dnf), Debian family (apt), Arch Linux (pacman)x86_64 (architecture of the artifacts of the descriptor)
podmanRHEL family (dnf), Debian family (apt), Arch Linux (pacman)x86_64, aarch64 (not restricted by the descriptor)

Certified host systems: RHEL 8/9/10, Rocky Linux 8/9/10, AlmaLinux 8/9/10, Oracle Linux 8/9, CentOS Stream 9/10, Ubuntu 22.04/24.04, Debian 12, Arch Linux (rolling). The host preflight accepts these systems (other releases of a known family give a warning, end of life releases are refused) and the x86_64 and aarch64 architectures.

Prerequisites​

Host​

  • at least 1024 MB of memory (blocking, memory).

Network and ports​

ComponentPort namePortOpened in the host firewall
serverclient4222/tcpyes
serverroute6222/tcpyes
servermonitor8222/tcpyes

Services and connections needed​

This service has no dependency.

Installation methods and modes​

MethodDefaultWhat the method uses
binaryyesthe binary archives of the descriptor, unpacked under the service directory
podman-the container images of the descriptor, run by Podman under systemd

Components​

ComponentKindInstallation methodsPorts
NATS server (server)masterbinary, podman4222/tcp, 6222/tcp, 8222/tcp

Single server (standalone) (default)​

One NATS server.

What the mode deploys:

ComponentPlacement
servermin 1, max 1

Cluster (cluster)​

Servers joined by routes; JetStream needs an odd count (3 or 5) for its Raft quorum.

What the mode deploys:

ComponentPlacement
servermin 3, odd number, recommended 3

Install this service​

The install wizard of the Navin Manager plans, validates and runs the installation; you need the services:install permission on the cluster.

  1. Open the wizard. In Clusters, choose the row action Install services of the target cluster. The wizard opens on its first step, Service.

  2. Choose the service. On the Service step, select NATS. The card shows the licence Apache-2.0. Pick the Method among binary, podman (default binary). To register an existing nats service of your organisation instead, turn on Use an existing external service.

  3. Choose the hosts and the mode. On the Hosts step, tick the hosts, then choose the Mode: standalone (default), cluster. Each mode deploys the components listed in Installation methods and modes.

  4. Bindings. This service has no dependency: the Bindings step has nothing to bind.

  5. Configure. On the Configure step, review the parameters (see Configuration parameters). Passwords left empty with a generated default are generated and sealed by the Manager.

  6. Review and install. On the Install step the Manager validates the plan and shows the installation order; when it says "The plan is valid. Ready to install.", choose Install. A highly available mode is installed only when its HA checks pass.

  7. Verify. The operation ends when the health checks of every instance pass (see Health checks); the service then shows as running in Services. Open the service and choose Run the smoke test in the Checks card: Subscribes to a fresh subject, publishes a message on it and waits for its delivery (core NATS protocol).

High availability​

Clusternative (native)
High availabilitynative (native)
Failoverclient side (client)
Replicationnative (native)
QuorumRaft (raft)
Discoverystatic (static)
Entry pointclient discovery (client-discovery)
Official documentationhttps://docs.nats.io/learn/clustering/
Peer TLS parametertls_enabled
Cluster status commandserver_report

Topology per mode​

ModesHighest catalog levelDistributionQuorum componentFault domainsDescription
standalonestandalone (standalone)single (single)-1One NATS server.
clustercluster (cluster)active-active (active-active)server3Servers joined by routes; JetStream keeps a Raft quorum over an odd number of servers.

Notes​

  • JetStream streams are replicated only when created with 3 (or 5) replicas; clients list several servers and reconnect by themselves.

Configuration parameters​

Network​

ParameterTypeDefaultAllowed valuesRequiredSecretRestartDescription
Client port (client_port)port4222-nononoPort of the client connections.
Route port (cluster_port)port6222-nononoPort of the routes between cluster servers.
Monitoring port (monitor_port)port8222-nononoPort of the HTTP monitoring endpoints (/healthz, /varz).

JetStream​

ParameterTypeDefaultAllowed valuesRequiredSecretRestartDescription
JetStream (jetstream_enabled)booltrue-nononoEnable the persistent streams.
JetStream disk (jetstream_max_file)size10g-nononoMaximum disk used by streams.
JetStream memory (jetstream_max_memory)size1g-nononoMaximum memory used by memory streams.

Security​

ParameterTypeDefaultAllowed valuesRequiredSecretRestartDescription
TLS (tls_enabled)boolfalse-nononoRequire TLS for clients and routes with the manager CA certificate.
User (username)stringnavin^[A-Za-z0-9_-]{1,64}$nononoUser of the client connections.
Password (password)passwordgenerated-noyesnoPassword of the client user.
Route password (route_password)passwordgenerated-noyesnoCredential of the routes between servers.

Endpoints​

EndpointSchemeComponentPortPathTLS parameterBinding parametersBinding secretsProvisioning command
clientnatsserver4222 (client_port)-tls_enabledusernamepassword-

Commands​

CommandComponentTargetDescription
Server report (server_report)serverevery hostReads /varz and /routez of every server (connections, routes, memory).
JetStream report (jetstream_report)serverfirst hostReads /jsz (streams, consumers, meta leader).

Health checks​

Liveness (per instance)​

ComponentCheckDetails
serverHTTP http://{{ host.ip or '127.0.0.1' }}:{{ config.monitor_port }}/healthzExpected 200; 30 retries

Readiness (service check)​

CheckDetails
HTTP http://{{ host.ip or '127.0.0.1' }}:{{ config.monitor_port }}/healthz?js-enabled-only=trueExpected 200

Smoke test​

Subscribes to a fresh subject, publishes a message on it and waits for its delivery (core NATS protocol). (server: publish_subscribe)

Preflight checks​

CheckTypeMeaningSeverityComponents
memorymemory_mb {"min": 1024}at least 1024 MB of memoryblockingevery component
client_port_freeport_free {"param": "client_port"}port 4222 free on the hostblockingevery component

Backup and restore​

Archive of the JetStream store taken while the server is stopped for a few seconds (streams, consumers and messages).

Formatnats-jetstream
Componentserver
Files{{ backup.dir }}/jetstream.tar.gz
Restore testno
Instances stopped for the restoreyes

Upgrade​

Supported from2.11.4
Statefulyes
Backup before the upgradeyes
Rollbackyes

Uninstall​

Paths removed when the data is purged: {{ paths.data }}, {{ paths.log }}.

  • Monitoring: http://{{ host.fqdn }}:{{ config.monitor_port }}/varz

Upstream documentation​