การตั้งค่า
- Config file:
/etc/nats-server.conf - System service:
nats-server - Default port:
4222 - Monitoring endpoint:
http://localhost:8222(เชื่อมต่อผ่าน SSH tunnel)
Credentials
Stored in /etc/nats-server.conf
Accessing NATS
Connection using nats CLI tool (client):
nats sub hello -s nats://USER:PASSWORD@SERVER_IP:4222 nats pub hello "world" -s nats://USER:PASSWORD@SERVER_IP:4222
การมอนิเตอร์ (ผ่าน SSH tunnel)
เพื่อความปลอดภัย endpoint สำหรับมอนิเตอร์จะผูกกับ localhost.
หากต้องการเข้าถึงจากระยะไกล ให้ตั้งค่า SSH tunnel ดังนี้:
ssh -L 8222:localhost:8222 root@SERVER_IP
จากนั้นเปิดในเบราว์เซอร์: http://localhost:8222
Service Management
systemctl status nats-server systemctl restart nats-server
***LINKS***[]