Spring Cloud Alibaba Nacos配置中心 集群与负载均衡配置

网友投稿 235 2022-09-01

Spring Cloud Alibaba Nacos配置中心 集群与负载均衡配置

Nacos 配置中心 集群 与负载均衡

集群配置文件

vim /root/cluster/nacos01/conf/cluster.conf vim /root/cluster/nacos02/conf/cluster.conf vim /root/cluster/nacos03/conf/cluster.conf vim /root/cluster/nacos04/conf/cluster.conf vim /root/cluster/nacos05/conf/cluster.conf

host:

192.168.66.100:8851 192.168.66.100:8852 192.168.66.100:8853 192.168.66.100:8854 192.168.66.100:8855

config:

vim /root/cluster/nacos01/conf/application.properties

mysql:

spring.datasource.platform=mysql

Count of DB:

db.num=1

Connect URL of DB:

db.url.0=jdbc:mysql://192.168.66.100:3306/nacos_config?characterEncoding=utf8&connectTi meout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&se rverTimezone=Asia/Shanghai db.user.0=root db.password.0=root

启动集群: sh /root/cluster/nacos01/bin/startup.sh

关闭: sh /root/cluster/nacos01/bin/shutdown.sh sh /root/cluster/nacos02/bin/shutdown.sh

JVM 调整: vim /root/cluster/nacos01/bin/startup.sh 访问地址: 192.168.66.100:8851/nacos/ 192.168.66.100:8852 192.168.66.100:8853 192.168.66.100:8854 192.168.66.100:8855

负载均衡:

upstream nacos-servers { server 192.168.66.100:8851; server 192.168.66.100:8852; server 192.168.66.100:8853; server 192.168.66.100:8854; server 192.168.66.100:8855; }

server { listen 9999; server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / { #root html; #index index.html index.htm; proxy_pass }

/root/cluster/nacos01/conf/cluster.conf vim /root/cluster/nacos02/conf/cluster.conf vim /root/cluster/nacos03/conf/cluster.conf vim /root/cluster/nacos04/conf/cluster.conf vim /root/cluster/nacos05/conf/cluster.confhost:192.168.66.100:8851192.168.66.100:8852192.168.66.100:8853192.168.66.100:8854192.168.66.100:8855config:vim /root/cluster/nacos01/conf/application.propertiesmysql:spring.datasource.platform=mysql### Count of DB:db.num=1### Connect URL of DB:db.url.0=jdbc:mysql://192.168.66.100:3306/nacos_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=Asia/Shanghaidb.user.0=rootdb.password.0=root启动集群:sh /root/cluster/nacos01/bin/startup.sh 关闭:sh /root/cluster/nacos01/bin/shutdown.sh sh /root/cluster/nacos02/bin/shutdown.sh JVM 调整:vim /root/cluster/nacos01/bin/startup.sh 访问地址:192.168.66.100:8851/nacos/192.168.66.100:8852192.168.66.100:8853192.168.66.100:8854192.168.66.100:8855日志:tail -f /root/cluster/nacos03/logs/start.out负载均衡:upstream nacos-servers {server 192.168.66.100:8851;server 192.168.66.100:8852;server 192.168.66.100:8853;server 192.168.66.100:8854;server 192.168.66.100:8855; } server { listen 9999; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { #root html; #index index.html index.htm; proxy_pass }启动Nginx加载配置启动./nginx -c /usr/nginx/conf/nginx.conf查看是否启动ps -ef|grep nginx通过Nginx访问Nacoshttp://192.168.127.154:9999/nacos

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:SpringBoot 的.yml配置文件通用模板
下一篇:[ERROR] Failed to execute goal on project springcloud: Could not resolve dependencies for project co
相关文章

 发表评论

暂时没有评论,来抢沙发吧~