Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed introduction of NATS server configuration

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Detailed introduction of NATS server configuration

Foreword:

Although NATS can be run without configuration, the NATS server can also be configured with a configuration file.

1) configuration items include

Client listener port Client listening portHTTP listener port HTTP monitoring port client authentication Client auth cluster definition Cluster definitions cluster routing Cluster routes log Logging maximum number of client connections Max client connections maximum payload Max payload slow consumer threshold Slow consumer threshold

2) configuration file syntax

The format of the NATS server configuration file is flexible, combining the traditional JSON format with the new YAML format.

The NATS configuration file format supports the following syntax:

Mixed Arrays: […] Nested Maps: {… } Multiple comment types: # and / / Key value assigments using: Equals sign (foo = 2) Colon (foo: 2) Whitespace (foo 2) Maps can be assigned with no key separatorSemicolons as value terminators in key/value assignments are optional

Note: YAML is not a markup language, but a language-neutral, read-friendly data serialization standard. The YAML language has been developed in three versions, 1.0,1.1,1.2

3) example of NATS server configuration file

Here is an example of a complete NATS server configuration file:

Port: 4242 # listening port for client connection net: apcera.me # listening network address http_port: 8222 # HTTP monitoring port # authentication information for client connection authorization {user: derek password: T0pS3cr3t timeout: 1} # Cluster definition cluster {host: '127.0.0.1' # Host address port: 4244 # inbound (inbound) port of routing connection # routing connection Authentication information of authorization {user: route_user password: T0pS3cr3tT00! Timeout: 0.5} # Routes are actively solicited and connected to from this server. # Other servers can connect to us if they supply the correct credentials # in their routes definitions from above. Routes = [nats-route://user1:pass1@127.0.0.1:4245 nats-route://user2:pass2@127.0.0.1:4246]} # Log option debug: falsetrace: truelogtime: falselog_file: "/ tmp/gnatsd.log" # PID process file pid_file: "/ tmp/gnatsd.pid" # some system attributes # maximum number of client connections max_connections: 10mm maximum protocol control Maximum payload max_payload: 6553 max_control_line: 51mm slow consumer threshold max_pending_size: 10000000

If you have any questions, please leave a message or go to the community to exchange and discuss, thank you for reading, hope to help you, thank you for your support!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report