杨梅冲
每天在想什么呢?
随笔 - 198,  文章 - 0,  评论 - 8,  阅读 - 17万

环境:

3台机器采用同样的目录名字和文件名称

服务器
192.168.10.30
192.168.10.31
192.168.10.32

nats版本2.9.15

配置文件

复制代码
# 192.168.10.30配置文件
port: 4242 # 供client连接的监听端口 net: 0.0.0.0 # 监听的网络地址 http_port: 8222 # HTTP监控端口 # client连接的认证信息 authorization { user: nats password: wg1q2w3e timeout: 1 } # 集群定义 cluster { host: '192.168.10.30' # 本机IP port: 4244 # 路由连接的入站(inbound)端口 # 路由连接的认证信息 authorization { user: "nats" password: "wg1q2w3e" 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://nats:wg1q2w3e@192.168.10.31:4244 # 修改对应IP和对应端口、账号、密码 nats-route://nats:wg1q2w3e@192.168.10.32:4244 ] } # 日志选项 debug: false # 正式环境可以关闭 trace: true logtime: false log_file: "/tmp/gnatsd.log" # PID进程文件 pid_file: "/tmp/gnatsd.pid" # 一些系统属性 # client最大连接数 max_connections: 100 # 最大协议控制行 max_control_line: 512 # 最大的有效负载 max_payload: 65536
复制代码
# 其余2台机器修改下面2个地方,端口如果修改了routes也需要修改为对应端口
host: '192.168.10.30'
port: 4244
和
  routes = [
    nats-route://nats:wg1q2w3e@192.168.10.31:4244
    nats-route://nats:wg1q2w3e@192.168.10.32:4244
  ]

启动命令

./nats-server -c gnatsd.yml

 

posted on   杨梅冲  阅读(908)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示