当前位置: 首页 > news >正文

杭州做网站haomae什么平台发广告最有效

杭州做网站haomae,什么平台发广告最有效,视频网站开发用什么服务器,制作企业网站得多长时间微服务框架中最为重要的就是注册中心,如果只是单注册中心,一旦出现问题,容易导致整个微服务环境不可用,所以建议注册中心集群。 目前SpringCloud框架中使用Eureka作为注册中心,本文简单介绍一下Eureka的集群配置&…

微服务框架中最为重要的就是注册中心,如果只是单注册中心,一旦出现问题,容易导致整个微服务环境不可用,所以建议注册中心集群。

目前SpringCloud框架中使用Eureka作为注册中心,本文简单介绍一下Eureka的集群配置,主要的思路就是相互注册,形成一组相互注册的注册中心,达到高可用的效果。

一般来说集群配置至少需要2台以上的服务器,这里是采用本机测试,道理是一样的。

集群配置

依赖配置

<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.0.3.RELEASE</version><relativePath/> <!-- lookup parent from repository -->
</parent><!-- 管理依赖 -->
<dependencyManagement><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>Finchley.RELEASE</version><type>pom</type><scope>import</scope></dependency></dependencies>
</dependencyManagement><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-server</artifactId></dependency>
</dependencies><repositories><repository><id>spring-milestones</id><name>Spring Milestones</name><url>https://repo.spring.io/milestone</url><snapshots><enabled>false</enabled></snapshots></repository>
</repositories>

注册中心配置

第一个注册中心配置

# 服务端口号
server:port: 8100
# 服务名称必须一样
spring:application:name: app-eureka
eureka:instance:# 注册中心ip地址(本机地址)hostname: 127.0.0.1client:service-url:# 注册地址,注册到9100的注册中心,如果是三台以上,一样可以在这边添加# 主要是实现相互注册defaultZone: http://127.0.0.1:9100/eureka/  # 将自己注册给自己的注册中心register-with-eureka: true# 检索自己服务信息fetch-registry: false

第二个注册中心配置

# 服务端口号
server:port: 9100
# 服务名称必须一样
spring:application:name: app-eurekaeureka:instance:# 注册中心ip地址(本机地址)hostname: 127.0.0.1client:service-url:# 注册地址,注册到8100的注册中心,如果是三台以上,一样可以在这边添加# 主要是实现相互注册defaultZone: http://127.0.0.1:8100/eureka/  # 将自己注册给自己的注册中心register-with-eureka: true# 检索自己服务信息fetch-registry: false

启动

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;@SpringBootApplication
@EnableEurekaServer //开启EurekaServer服务 开启注册中心
public class AppEureka {public static void main(String[] args) {SpringApplication.run(AppEureka.class, args);}
}

客户端配置

# 订单服务的端口号
server:port: 8001# 服务别名 -- 服务注册到注册中心名称
spring:application:name: app-ordereureka:client:service-url:# 当前订单服务注册到eureka服务地址,两个注册中心都注册defaultZone: http://localhost:8100/eureka,http://localhost:9100/eureka# 需要将服务注册到eurekaregister-with-eureka: true# 需要检索服务fetch-registry: true

客户端启动

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;@SpringBootApplication
@EnableEurekaClient
public class AppOrder {public static void main(String[] args) {SpringApplication.run(AppOrder.class, args);	}
}

总结

以上即是Eureka的集群配置,还是比较简单易懂的。

http://www.hkea.cn/news/116295/

相关文章:

  • 行政事业单位网站建设建议营销策划公司
  • 网络推广网站怎么做百度联盟广告点击一次收益
  • wordpress居中样式宁波seo网络推广外包报价
  • java做网站用到哪些技术网络营销的重要性与意义
  • 网络营销推广的作用谷歌seo什么意思
  • 免费网站建设解决方案郑州网络营销公司哪个好
  • 转转怎么做钓鱼网站税收大数据
  • 株洲专业网站排名优化深圳产品网络推广
  • 深圳美食教学网站制作如何免费搭建自己的网站
  • 兰州移动端网站建设广东整治互联网霸王条款
  • 彩票网站该怎么建设天津seo实战培训
  • 原平的旅游网站怎么做的新冠疫情最新情况最新消息
  • 网站开发软件著作权归谁seo外包
  • 小说网站的网编具体做哪些工作南宁网站快速排名提升
  • 承德网站设计seo互联网营销培训
  • 工信部网站备案查询 手机seo专员的工作内容
  • 淘宝活动策划网站视频营销成功的案例
  • 精准营销数据杭州排名优化软件
  • 中卫网站建站设计seo学习论坛
  • wordpress初始登录seo排名赚app靠谱吗
  • 软件外包保密协议seo相关岗位
  • 后台网站开发文档下载班级优化大师app
  • 辛集城乡建设管理局网站网络营销网络推广
  • 阿里云部署一个自己做的网站吗电商网站搭建
  • 免费汽车租赁网站模板网站域名解析ip查询
  • 企业解决方案官网国内seo排名分析主要针对百度
  • 变态版手游石景山区百科seo
  • 阿里云控制台登录入口seo矩阵培训
  • wordpress苗木模板网站搜索排优化怎么做
  • 网站图片引导页怎么做重庆seo招聘