type
status
date
slug
summary
tags
category
icon
password
一、安装
step1:
step2:
切换到 bin 目录下,并执行以下命令
访问localhost:8848/nacos即可
二、注册中心
2.1 服务注册
1、先在父项目中引入依赖
2、分别在子项目的配置文件中加入以下
3、启动项目,之后注册成功会在服务管理里面看到如下

4、我们也可以去启动几份项目,搞下集群


2.2 服务发现
1、在启动类上表注解
2、去做下测试
2.3 远程调用
1、基本流程

2、下单场景

3、远程调用实现
建一个model模块,存放公共的实体类

之后在service的pom文件里面导入model依赖
Product模块如下
ProductController代码
ProductServiceImpl代码
Oder模块如下
OrderController代码
OrderServiceConfig代码
OrderServiceImpl代码
最后我们去请求


如果我们现在停掉了product的9000端口的应用,order应用去请求9001端口的应用,日志打印信息如下
2.4负载均衡
- Author:Blinky
- URL:http://preview.tangly1024.com/article/nacos
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!