CNCF and Synadia Align on Securing the Future of the NATS.io Project. Read the joint press release.
NATS Docs
NATS.ioNATS by ExampleGitHubSlackTwitter
  • Welcome
  • Release Notes
    • What's New!
      • NATS 2.11
      • NATS 2.10
      • NATS 2.2
      • NATS 2.0
  • NATS Concepts
    • Overview
      • Compare NATS
    • What is NATS
      • Walkthrough Setup
    • Subject-Based Messaging
    • Core NATS
      • Publish-Subscribe
        • Pub/Sub Walkthrough
      • Request-Reply
        • Request-Reply Walkthrough
      • Queue Groups
        • Queueing Walkthrough
    • JetStream
      • Streams
      • Source and Mirror Streams
        • Example
      • Consumers
        • Example
      • JetStream Walkthrough
      • Key/Value Store
        • Key/Value Store Walkthrough
      • Object Store
        • Object Store Walkthrough
      • Headers
    • Subject Mapping and Partitioning
    • NATS Service Infrastructure
      • NATS Adaptive Deployment Architectures
    • Security
    • Connectivity
  • Using NATS
    • NATS Tools
      • nats
        • nats bench
      • nk
      • nsc
        • Basics
        • Streams
        • Services
        • Signing Keys
        • Revocation
        • Managed Operators
      • nats-top
        • Tutorial
    • Developing With NATS
      • Anatomy of a NATS application
      • Connecting
        • Connecting to the Default Server
        • Connecting to a Specific Server
        • Connecting to a Cluster
        • Connection Name
        • Authenticating with a User and Password
        • Authenticating with a Token
        • Authenticating with an NKey
        • Authenticating with a Credentials File
        • Encrypting Connections with TLS
        • Setting a Connect Timeout
        • Ping/Pong Protocol
        • Turning Off Echo'd Messages
        • Miscellaneous functionalities
        • Automatic Reconnections
          • Disabling Reconnect
          • Set the Number of Reconnect Attempts
          • Avoiding the Thundering Herd
          • Pausing Between Reconnect Attempts
          • Listening for Reconnect Events
          • Buffering Messages During Reconnect Attempts
        • Monitoring the Connection
          • Listen for Connection Events
          • Slow Consumers
      • Receiving Messages
        • Synchronous Subscriptions
        • Asynchronous Subscriptions
        • Unsubscribing
        • Unsubscribing After N Messages
        • Replying to a Message
        • Wildcard Subscriptions
        • Queue Subscriptions
        • Draining Messages Before Disconnect
        • Receiving Structured Data
      • Sending Messages
        • Including a Reply Subject
        • Request-Reply Semantics
        • Caches, Flush and Ping
        • Sending Structured Data
      • Building Services
      • JetStream
        • JetStream Model Deep Dive
        • Managing Streams and consumers
        • Consumer Details
        • Publishing to Streams
        • Using the Key/Value Store
        • Using the Object Store
      • Tutorials
        • Advanced Connect and Custom Dialer in Go
    • Running Workloads on NATS
      • Getting Started
        • Installing Nex
        • Building a Service
        • Starting a Node
        • Deploying Services
        • Building a Function
        • Deploying Functions
      • Host Services
        • Javascript | V8
      • Nex Internals
        • Architecture Overview
        • Node Process
        • Nex Agent
        • No Sandbox Mode
        • Root File System
        • Control Interface
      • FAQ
  • Running a NATS service
    • Installing, running and deploying a NATS Server
      • Installing a NATS Server
      • Running and deploying a NATS Server
      • Windows Service
      • Flags
    • Environmental considerations
    • NATS and Docker
      • Tutorial
      • Docker Swarm
      • Python and NGS Running in Docker
      • JetStream
      • NGS Leaf Nodes
    • NATS and Kubernetes
    • NATS Server Clients
    • Configuring NATS Server
      • Configuring JetStream
        • Configuration Management
          • NATS Admin CLI
          • Terraform
          • GitHub Actions
          • Kubernetes Controller
      • Clustering
        • Clustering Configuration
        • v2 Routes
        • JetStream Clustering
          • Administration
          • Troubleshooting
      • Super-cluster with Gateways
        • Configuration
      • Leaf Nodes
        • Configuration
        • JetStream on Leaf Nodes
      • Securing NATS
        • Enabling TLS
        • Authentication
          • Tokens
          • Username/Password
          • TLS Authentication
            • TLS Authentication in clusters
          • NKeys
          • Authentication Timeout
          • Decentralized JWT Authentication/Authorization
            • Account lookup using Resolver
            • Memory Resolver Tutorial
            • Mixed Authentication/Authorization Setup
        • Authorization
        • Multi Tenancy using Accounts
        • OCSP Stapling
        • Auth Callout
      • Logging
      • Enabling Monitoring
      • MQTT
        • Configuration
      • Configuring Subject Mapping
      • System Events
        • System Events & Decentralized JWT Tutorial
      • WebSocket
        • Configuration
    • Managing and Monitoring your NATS Server Infrastructure
      • Monitoring
        • Monitoring JetStream
      • Managing JetStream
        • Account Information
        • Naming Streams, Consumers, and Accounts
        • Streams
        • Consumers
        • Data Replication
        • Disaster Recovery
        • Encryption at Rest
      • Managing JWT Security
        • In Depth JWT Guide
      • Upgrading a Cluster
      • Slow Consumers
      • Signals
      • Lame Duck Mode
      • Profiling
  • Reference
    • FAQ
    • NATS Protocols
      • Protocol Demo
      • Client Protocol
        • Developing a Client
      • NATS Cluster Protocol
      • JetStream wire API Reference
    • Roadmap
    • Contributing
  • Legacy
    • nats-account-server
Powered by GitBook
On this page
  • Server Options
  • JetStream Options
  • Authentication Options
  • Logging Options
  • TLS Options
  • Cluster Options
  • Common Options

Was this helpful?

Edit on GitHub
Export as PDF
  1. Running a NATS service
  2. Installing, running and deploying a NATS Server

Flags

The NATS server has many flags to customize its behavior without having to write a configuration file.

The configuration flags revolve around:

  • Server Options

  • Logging

  • Authorization

  • TLS Security

  • Clustering

  • Information

Server Options

Flag
Description

-a, --addr, --net

Host address to bind to (default: 0.0.0.0 - all interfaces).

-p, --port

NATS client port (default: 4222).

-n, --name, --server_name

Server name (default auto).

-P, --pid

File to store the process ID (PID).

-m, --http_port

HTTP port for monitoring dashboard (exclusive of --https_port).

-ms, --https_port

HTTPS port monitoring for monitoring dashboard (exclusive of --http_port).

-c, --config

Path to NATS server configuration file.

-sl, --signal

--client_advertise

Client HostPort to advertise to other servers.

-t

Test configuration and exit

`--ports_file_dir

Creates a ports file in the specified directory (<executable_name>_.ports).

JetStream Options

Flag
Description

-js, --jetstream

Enable JetStream functionality.

-sd, --store_dir

Set the storage directory.

Authentication Options

The following options control straightforward authentication:

Flag
Description

--user

Required username for connections (exclusive of --auth).

--pass

Required password for connections (exclusive of --auth).

--auth

Required authorization token for connections (exclusive of --user and --password).

Logging Options

The following flags are available on the server to configure logging:

Flag
Description

-l, --log

File to redirect log output

-T, --logtime

Specify -T=false to disable timestamping log entries

-s, --syslog

Log to syslog or windows event log

-r, --remote_syslog

The syslog server address, like udp://localhost:514

-D, --debug

Enable debugging output

-V, --trace

Enable protocol trace log messages

-VV

Verbose trace (traces system account as well)

-DV

Enable both debug and protocol trace messages

-DVV

Debug and verbose trace (traces system account as well)

--max_traced_msg_len

Maximum printable length for traced messages. 0 for unlimited

--max_traced_msg_len

Maximum printable length for traced messages (default: unlimited)

TLS Options

Flag
Description

--tls

Enable TLS, do not verify clients

--tlscert

Server certificate file

--tlskey

Private key for server certificate

--tlsverify

Enable client TLS certificate verification

--tlscacert

Client certificate CA for verification

Cluster Options

The following flags are available on the server to configure clustering:

Flag
Description

--routes

Comma-separated list of cluster URLs to solicit and connect

--cluster

Cluster URL for clustering requests

--no_advertise

Do not advertise known cluster information to clients

--cluster_advertise

Cluster URL to advertise to other servers

--connect_retries

For implicit routes, number of connect retries

--cluster_listen

Cluster url from which members can solicit routes

Common Options

Flag
Description

-h, --help

Show this message

-v, --version

Show version

--help_tls

TLS help

PreviousWindows ServiceNextEnvironmental considerations

Last updated 1 month ago

Was this helpful?

Send a signal to nats-server process. See .

See , and for more information.

You can read more about .

You can read more about .

You can read more about .

token authentication
username/password
logging configuration here
tls configuration here
clustering configuration here
process signaling