NATS服务器配置的细致介绍
发布时间:05/16 来源:未知 浏览:
关键词:
NATS服务器配置的细致介绍
前言:
只管NATS可以无配置的运转,但也可以运用配置文件配置NATS服务器。
1)配置项包括
- 客户端监听器端口 Client listening port
- HTTP监听器端口 HTTP monitoring port
- 客户端认证 Client auth
- 集群定义 Cluster definitions
- 集群路由 Cluster routes
- 日志 Logging
- 最大客户端连贯数 Max client connections
- 最大有效负载 Max payload
- 慢消费者阀值 Slow consumer threshold
2)配置文件的语法
NATS服务器配置文件的格局比较灵活,联合了传统的JSON格局和新的YAML格局的格调。
NATS配置文件格局支撑下列语法:
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 separator Semicolons as value terminators in key/value assignments are optional
注:YAML不是标志说话,而是一种说话中立的、对浏览友爱的数据序列化规范。YAML说话开展了三个版本,1.0、1.1、1.2,
3)NATS服务器配置文件示例
下面是一个完备的NATS服务器配置文件样例:
port: 4242 # 供客户端连贯的监听端口 net: apcera.me # 监听的网络地址 http_port: 8222 # HTTP监控端口 # 客户端连贯的认证信息 authorization { user: derek password: T0pS3cr3t timeout: 1 } # 集群定义 cluster { host: '127.0.0.1' # 主机地址 port: 4244 # 路由连贯的入站(inbound)端口 # 路由连贯的认证信息 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 ] } # 日志选项 debug: false trace: true logtime: false log_file: "/tmp/gnatsd.log" # PID进程文件 pid_file: "/tmp/gnatsd.pid" # 一些系统属性 # 客户端最大连贯数 max_connections: 100 # 最大协定控制行 max_control_line: 512 # 最大的有效负载 max_payload: 65536 # 慢消费者阀值 max_pending_size: 10000000
若有疑难请留言或者到本站社区交换计议,谢谢浏览,但愿能帮忙到大家,感谢大家对本站的支撑!
热门标签:dede模板 / destoon模板 / dedecms模版 / 织梦模板责任编辑:QmVhv