Nginx :
# 集群配置 http { upstream nacos-cluster { ip_hash; server 127.0.0.1:8858; server 127.0.0.1:8868; server 127.0.0.1:8878; } server { listen 8838; server_name localhost; }
location /nacos {
proxy_pass http://nacos-cluster/nacos;
}
} # nacos的grpc协议配置 stream { # 偏移1000 upstream nacos-grpc{ server 127.0.0.1:9858; server 127.0.0.1:9868; server 127.0.0.1:9878; } server { listen 9838; proxy_pass nacos-grpc; } # 偏移1001 upstream nacos-tcp-9839{ server 127.0.0.1:9859; server 127.0.0.1:9869; server 127.0.0.1:9879; } server { listen 9839; proxy_pass nacos-tcp-9839; } }
Nacos config文件
# application.properties server.port=8858 nacos.inetutils.ip-address=127.0.0.1 spring.datasource.platform=mysql ### Count of DB: db.num=1 ### Connect URL of DB: db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC db.user.0=root db.password.0=root # cluster.conf 127.0.0.1:8858 127.0.0.1:8868 127.0.0.1:8878
解决springcloud注册不上, 需要关闭双写
关闭双写执行以下put请求,请求其中一个实例就可以
localhost:8858/nacos/v1/ns/operator/switches?entry=doubleWriteEnabled&value=false
标签:127.0,0.1,db,Nacos2,nacos,server,Nginx,8858,集群 From: https://www.cnblogs.com/padazala/p/17353132.html