znats/

directory
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2020 License: Apache-2.0

README

Install nats-server

go get github.com/nats-io/nats-server

Auth

single username/password

nat-server --user a --pass b

multiple users

authorization: {
    users: [
        {user: a, password: b},
        {user: b, password: a}
    ]
}

password bcrypt

https://raw.githubusercontent.com/nats-io/nats-server/master/util/mkpasswd/mkpasswd.go

Cluster

Group
nats-server -D -p 4222 -cluster nats://localhost:6222 -routes nats://localhost:6222,nats://localhost:6223,nats://localhost:6224
nats-server -D -p 4223 -cluster nats://localhost:6223 -routes nats://localhost:6222,nats://localhost:6223,nats://localhost:6224
nats-server -D -p 4224 -cluster nats://localhost:6224 -routes nats://localhost:6222,nats://localhost:6223,nats://localhost:6224
Seed
nats-server -D -p 4222 -cluster nats://localhost:6222
nats-server -D -p 4333 -cluster nats://localhost:6333 -routes nats://localhost:6222
nats-server -D -p 4444 -cluster nats://localhost:6444 -routes nats://localhost:6222

Signals

On Unix systems, the NATS server responds to the following signals:

Signal Result
SIGKILL Kills the process immediately
SIGINT Stops the server gracefully
SIGUSR1 Reopens the log file for log rotation
SIGHUP Reloads server configuration file
SIGUSR2 Stops the server after evicting all clients (lame duck mode)

The nats-server binary can be used to send these signals to running NATS servers using the -sl flag:

# Quit the server
nats-server --signal quit

# Stop the server
nats-server --signal stop

# Reopen log file for log rotation
nats-server --signal reopen

# Reload server configuration
nats-server --signal reload

# Lame duck mode server configuration
nats-server --signal ldm

If there are multiple nats-server processes running, or if pgrep isn't available, you must either specify a PID or the absolute path to a PID file:

nats-server --signal stop=<pid>
nats-server --signal stop=/path/to/pidfile

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL