NATS服务器配置详解
2016-03-31 15:10
417 查看
NATS服务器配置详解
作者:chszs,未经博主允许不得转载。经许可的转载需注明作者和博客主页:http://blog.csdn.net/chszs尽管NATS可以无配置的运行,但也可以使用配置文件配置NATS服务器。
1)配置项包括
客户端监听器端口 Client listening portHTTP监听器端口 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
相关文章推荐
- 文章标题
- 升级数据库的最佳写法
- keepalived与lvs 调度算法
- linux系统下mysql跳过密码验证登录
- 我的2016年linux学习决心书
- 项目2——游戏中的角色2
- 嵌入式汇编和机器码的反汇编
- 使用苹果企业级开发者账号发布应用程序
- Linux下的Memcache安装
- .Net跨平台中遇到的问题小结
- 固话+手机号码正则
- java操作文件的内容的实现
- AndroidStudio代码前面有红色的感叹号出现原因
- Linux kernel模块管理相关详解Linux kernel模块管理相关详解
- WebStorm 快捷键
- 数据库优化
- 编程修养
- MFC——9.多线程与线程同步
- C++:只用初始化列表初始化变量的几种情况
- android跨进程通信(IPC)——AIDL