Darui's blog

Home | About | Contacts | Archive

Nacos集群部署说明

Nacos集群部署说明

集群部署架构图

因此开源的时候推荐用户把所有服务列表放到一个vip下面,然后挂到一个域名下面

http://ip1:port/openAPI 直连ip模式,机器挂则需要修改ip才可以使用。

http://VIP:port/openAPI 挂载VIP模式,直连vip即可,下面挂server真实ip,可读性不好。

http://nacos.com:port/openAPI 域名 + VIP模式/Nginx,可读性好,而且换ip方便,推荐模式。

nacos-clusters

1. 预备环境准备

安装环境:

  1. 64 bit Contos7;
  2. 64 bit JDK 1.8+;
  3. 3个或3个以上Nacos节点才能构成集群;
  4. mysql5.7
  5. nginx

2. 下载安装包

More info: download

3. 配置集群配置文件

在nacos的解压目录nacos/的conf目录下,有配置文件cluster.conf,请每行配置成ip:port。(请配置3个或3个以上节点)

# ip:port
200.8.9.16:8848
200.8.9.17:8848
200.8.9.18:8848

4. 确定数据源

使用内置数据源

无需进行任何配置

使用外置数据源

生产使用建议至少主备模式,或者采用高可用数据库。

具体的操作步骤:

spring.datasource.platform=mysql

db.num=1
db.url.0=jdbc:mysql://11.162.196.16:3306/nacos_devtest?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true
db.user=nacos_devtest
db.password=youdontknow

5. 启动服务器

集群模式

使用外置数据源

sh startup.sh

6. 关闭服务器

sh shutdown.sh

7. Nginx配置

upstream nacoscluster {
        server 200.8.9.16:8848;
        server 200.8.9.17:8848;
        server 200.8.9.18:8848;
}

server {
        listen 80;
        server_name     200.8.9.15;
        location / {
                proxy_pass http://nacoscluster;
                index index.html index.htm;
        }
}

欢迎评论: weibo

Category: Alibaba-cloud
Tags: [ Nacos  ]

Darui's blog | 鲁ICP备 15018213号-1 | 本站作品采用知识共享署名-非商业性使用 4.0 国际许可协议进行许可。 | Build with Github and true minimal theme