下载安装
可以先阅读官网《集群部署说明》
环境说明: win10,springcloud
编辑 conf 目录下的 cluster.conf 文件,如:
#it is ip
#example
192.168.28.44:8488
192.168.28.44:8489
192.168.28.44:8450
192.168.28.44对应自己机器的ip,可以在本地测试部署,使用不同端口区分
编辑conf 目录下 的 application.properties 文件
server.servlet.contextPath=/nacos
server.port=8488
spring.datasource.platform=mysql
db.num=1
db.url.0=数据库连接
db.user=用户名
db.password=密码
server.port=8488 端口对应 cluster.conf 文件中的端口
然后把项目复制两份出来,分别把 application.properties 里面的端口改为:8489,8459
启动项目
cmd 到bin目录,执行命令:startup.cmd -m cluster
注意:集群环境下不能直接双击startup.cmd,因为里面写死是单机模式启动
启动成功会出现:
绑定IP,我使用window版 Nginx
修改Nginx配置:
启动Nginx ,$ start nginx
最后一步,绑定项目的中的server-addr
我使用的是 springcloud :
修改 bootstrap.yml 文件
启动项目
访问:http://192.168.28.44/nacos/index.html
出现2个 FOLLOWER ,1个 LEADER 标识成功