配置
- 配置文件:
/etc/nats-server.conf - 系统服务:
nats-server - 默认端口:
4222 - 监控端点:
http://localhost:8222(通过 SSH 隧道保护)
证书
存储在 /etc/nats-server.conf
访问NATS
连接使用 nats CLI 工具(客户端):
nats sub hello -s nats://USER:PASSWORD@SERVER_IP:4222 nats pub hello "world" -s nats://USER:PASSWORD@SERVER_IP:4222
监控(通过 SSH 隧道)
为了安全起见,监控端点仅绑定 localhost.
要远程访问它,请设置 SSH 隧道:
ssh -L 8222:localhost:8222 root@SERVER_IP
然后在浏览器中打开: http://localhost:8222
服务管理
systemctl status nats-server systemctl restart nats-server
***链接***[]