SpringCloud搭建netflix-eureka微服务集群的方法


这篇“SpringCloud搭建netflix-eureka微服务集群的方法”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“SpringCloud搭建netflix-eureka微服务集群的方法”文章吧。打开网址:https://start.spring.io/选择需要引入的组件,然后下载下来即可为了测试的方便,需将项目结构更改为多模块的项目。步骤如下:(1) 依次新建子模块register-center/provider/consumer,删除父模块中多余的src、target等文件夹(2) 修改父模块的pom文件:仅保留配置节,配置节全部注释掉,因为可在子模块按需添加依赖。(3) 修改register-center的pom中的依赖配置(4) 修改provider和consumer的pom中依赖配置启动类yml配置启动类服务注册类yml配置启动类服务调用测试类RestTemplate负责均衡配置类yml配置127.0.0.1 peer1.com
127.0.0.1 peer2.com
127.0.0.1 peer3.com三个注册中心节点运行配置两个服务提供者的运行配置(1) 启动注册中心依次启动RegisterCenter1->RegisterCenter2->RegisterCenter3,启动成功后,可访问http://localhost:8091/ 或http://localhost:8092/ 或http://localhost:8093/ 查看是否启动成功(2)启动服务提供者provider依次启动Provider1->Provider2, 随便访问一个注册中心地址首页即可查看状态,如下图(3) 启动消费者cosumer(4) 在浏览器中进行测试(5) 在Provider1/Provider2的控制台中可以看到输出结果2021-04-07 15:26:56.043 INFO 8796 — [nio-8081-exec-1] c.h.s.provider.restservice.RestService : sayHello was called
2021-04-07 15:26:58.860 INFO 8796 — [nio免费云主机域名-8081-exec-2] c.h.s.provider.restservice.RestService : sayHello was called
2021-04-07 15:26:59.535 INFO 8796 — [nio-8081-exec-3] c.h.s.provider.restservice.RestService : sayHello was called
2021-04-07 15:26:59.925 INFO 8796 — [nio-8081-exec-4] c.h.s.provider.restservice.RestService : sayHello was called
2021-04-07 15:27:00.266 INFO 8796 — [nio-8081-exec-5] c.h.s.provider.restservice.RestService : sayHello was called
2021-04-07 15:27:00.663 INFO 8796 — [nio-8081-exec-6] c.h.s.provider.restservice.RestService : sayHello was called
2021-04-07 15:27:00.938 INFO 8796 — [nio-8081-exec-7] c.h.s.provider.restservice.RestService : sayHello was called2021-04-07 15:26:58.602 INFO 17828 — [nio-8082-exec-1] c.h.s.provider.restservice.RestService : sayHello was called
2021-04-07 15:26:59.194 INFO 17828 — [nio-8082-exec-2] c.h.s.provider.restservice.RestService : sayHello was called
2021-04-07 15:26:59.737 INFO 17828 — [nio-8082-exec-3] c.h.s.provider.restservice.RestService : sayHello was called
2021-04-07 15:27:00.109 INFO 17828 — [nio-8082-exec-4] c.h.s.provider.restservice.RestService : sayHello was called
2021-04-07 15:27:00.414 INFO 17828 — [nio-8082-exec-5] c.h.s.provider.restservice.RestService : sayHello was called
2021-04-07 15:27:00.815 INFO 17828 — [nio-8082-exec-6] c.h.s.provider.restservice.RestService : sayHello was called以上就是关于“SpringCloud搭建netflix-eureka微服务集群的方法”这篇文章的内容,相信大家都有了一定的了解,希望小编分享的内容对大家有帮助,若想了解更多相关的知识内容,请关注百云主机行业资讯频道。

相关推荐: html如何在网页中用按钮来控制前页,后页和主页的显示

这篇文章将为大家详细讲解有关html如何在网页中用按钮来控制前页,后页和主页的显示,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。在网页中用按钮来控制前页,后页和主页的显示。关于“html如何在网页中用按钮来控制前页,后页和主…

免责声明:本站发布的图片视频文字,以转载和分享为主,文章观点不代表本站立场,本站不承担相关法律责任;如果涉及侵权请联系邮箱:360163164@qq.com举报,并提供相关证据,经查实将立刻删除涉嫌侵权内容。

Like (0)
Donate 微信扫一扫 微信扫一扫
Previous 09/05 16:47
Next 09/05 16:47

相关推荐