当前位置:网站首页>nats集群部署
nats集群部署
2022-06-30 17:51:00 【帅大大的架构之路】
nats集群部署
说明: 集群采用三台机器部署,每台机器的目录、安装包、配置名都一样,但配置里面每个节点的ip和路由不一样,自己注意对应更改,如果在一台机器配置部署,就需要更改每个节点的端口,避免端口冲突
1.下载
NATS Server当前的最新版本为v2.8.4版,有三种二进制发布包,详见:https://github.com/nats-io/nats-server/releases
- nats-server-v2.8.4-darwin-amd64.tar.gz for Mac的版本
- nats-server-v2.8.4-linux-amd64.tar.gz for Linux x64的版本
- nats-server-v2.8.4-linux-arm.tar.gz for Linux ARM的版本
2.解压
mkdir /biz-code/nats/ -p
cd /biz-code/nats/
wget https://github.com/nats-io/nats-server/releases/download/v2.8.4/nats-server-v2.8.4-linux-amd64.tar.gz
tar xf nats-server-v2.8.4-linux-amd64.tar.gz
cd nats-server-v2.8.4-linux-amd64/
3.添加配置
vim gnastd.conf
节点一:
port: 4333
http: 6333
net: 0.0.0.0
cluster {
host: 172.16.0.15
port: 8333
# authorization {
# user: root
# password: 123456
# timeout: 1
# }
routes = [
nats-route://172.16.0.18:8333
nats-route://172.16.0.24:8333
]
}
debug: true
trace: true
log_file: "/biz-code/nats/gnatsd-4222.log"
# max_connections
max_connections: 100
# Duration the server can block on a socket write to a client. Exceeding the
# deadline will designate a client as a slow consumer.
# 测试下是否有问题
write_deadline: "2s"
节点二:
port: 4333
http: 6333
net: 0.0.0.0
cluster {
host: 172.16.0.18
port: 8333
# authorization {
# user: root
# password: 123456
# timeout: 1
# }
routes = [
nats-route://172.16.0.15:8333
nats-route://172.16.0.24:8333
]
}
debug: true
trace: true
log_file: "/biz-code/nats/gnatsd-4222.log"
# max_connections
max_connections: 100
# Duration the server can block on a socket write to a client. Exceeding the
# deadline will designate a client as a slow consumer.
# 测试下是否有问题
write_deadline: "2s"
节点三:
port: 4333
http: 6333
net: 0.0.0.0
cluster {
host: 172.16.0.24
port: 8333
# authorization {
# user: root
# password: 123456
# timeout: 1
# }
routes = [
nats-route://172.16.0.18:8333
nats-route://172.16.0.15:8333
]
}
debug: true
trace: true
log_file: "/biz-code/nats/gnatsd-4222.log"
# max_connections
max_connections: 100
# Duration the server can block on a socket write to a client. Exceeding the
# deadline will designate a client as a slow consumer.
# 测试下是否有问题
write_deadline: "2s"
有个问题: 我这里配置文件里面写了集群通信认证的账号密码,但是在调试的过程中一直报错认证失败,然后我就把它注释了,在启动的时候通过参数指定的账号密码
4.启动
./nats-server --config gnastd.conf --user root --pass 123456
5.查看日志
cd /biz-code/nats
tail -f gnatsd-4222.log
日志中如果没有出现ERR,那估计就是启动成功了,另外调试完了可以将配置中的debug: true选项注释
边栏推荐
- C WinForm program interface optimization example
- Adhering to the concept of 'home in China', 2022 BMW children's traffic safety training camp was launched
- Glacier teacher's book
- NFT technology for gamefi chain game system development
- slice
- TCP packet sticking problem
- 3.10 haas506 2.0 development tutorial example TFT
- 全栈代码测试覆盖率及用例发现系统的建设和实践
- 《被讨厌的勇气:“自我启发之父”阿德勒的哲学课》
- Ambient light and micro distance detection system based on stm32f1
猜你喜欢

德国AgBB VoC有害物质测试

视频内容生产与消费创新

PyTorch学习(三)

Countdowncatch and completabilefuture and cyclicbarrier

Leader: who can use redis expired monitoring to close orders and get out of here!

Nodejs installation and introduction

【合集- 行业解决方案】如何搭建高性能的数据加速与数据编排平台

ONEFLOW source code parsing: automatic inference of operator signature

Unlimited cloud "vision" innovation | the 2022 Alibaba cloud live summit was officially launched

opencv数据类型代码表 dtype
随机推荐
torch.roll
Distributed transaction
开发那些事儿:如何在视频中添加文字水印?
Teach you to quickly set up a live studio in 30 minutes
Countdowncatch and completabilefuture and cyclicbarrier
Dependencies tool to view exe and DLL dependencies
Nodejs 安装与介绍
Dlib library for face key point detection (openCV Implementation)
服务器之间传文件夹,文件夹内容为空
Pytorch learning (III)
Lenovo Yoga 27 2022, full upgrade of super configuration
《所谓情商高,就是会说话》读书笔记
mysql函数获取全路径
PHP uses queues to solve maze problems
Neon optimization 2: arm optimization high frequency Instruction Summary
联想YOGA 27 2022,超强配置全面升级
PyTorch学习(三)
Entry node of link in linked list - linked list topic
开发那些事儿:Linux系统中如何安装离线版本MySQL?
NFT technology for gamefi chain game system development