6.搭建Eureka

eureka-server自己也是一个微服务,所以eureka-server在启动的时候也会将自己注册到eureka上。eureka集群的时候,会将多个eureka相互注册,这个时候,defaultZone的值会有多个,用逗号隔开。

java 复制代码
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>cloud-demo</artifactId>
        <groupId>com.xkj.org</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>eureka-server</artifactId>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
        </dependency>

    </dependencies>
</project>
java 复制代码
server:
  port: 10086
spring:
  application:
    name: eureka-server #eureka服务名称
eureka:
  client:
    service-url:
      defaultZone: http://localhost:10086/eureka #eureka地址信息,
java 复制代码
@SpringBootApplication
@EnableEurekaServer
public class EurekaApplication {

    public static void main(String[] args) {
        SpringApplication.run(EurekaApplication.class, args);
    }
}
相关推荐
REST_302710 小时前
告别Excel孤岛:一款任务链路可视化工具带来的真实改变
大数据·微服务·云计算·编辑器·excel·动态规划
beibeix201511 小时前
CppMicroServices 核心概念:动态服务注册与模块化系统
微服务·mitk
微三云 - 廖会灵 (私域系统开发)12 小时前
电商系统从单体到微服务拆分实践:拆什么、怎么拆、拆完后怎么办
微服务·云原生·架构
骑上单车去旅行13 小时前
Docker Compose 命令完全指南:从构建到运维
docker·容器·eureka
guslegend16 小时前
领域驱动设计,微服务设计为什么要选择DDD?
微服务·云原生·架构
VortMall18 小时前
全维度打磨细节体验,赋能商城稳定有序运营|VortMall 微服务商城 v1.3.11 版本发布
java·微服务·云原生·架构·商城系统·开源商城·vortmall
豆瓣鸡1 天前
Guava RateLimiter 限流实战:从令牌桶原理到 Nacos 动态配置
spring boot·微服务·nacos·guava
BullSmall2 天前
Sonarqube9.9 docker 镜像启动后 conf 下的配置文件没有了
docker·容器·eureka
spider_xcxc2 天前
Docker 实战:容器化多服务应用,Dockerfile 与 Compose 配置全解析
docker·云原生·eureka·虚拟化·容器化
Wang's Blog2 天前
Go-Zero项目开发10: 微服务治理中心实现原理分析
开发语言·微服务·golang