You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/03/04 01:14:48 UTC

[GitHub] [apisix-website] hf400159 opened a new pull request #938: docs: add eureka blog

hf400159 opened a new pull request #938:
URL: https://github.com/apache/apisix-website/pull/938


   docs: add eureka blog


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] SylviaBABY commented on a change in pull request #938: docs: add eureka blog

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on a change in pull request #938:
URL: https://github.com/apache/apisix-website/pull/938#discussion_r819231784



##########
File path: website/blog/2022/03/05/apisix-integration-eureka-service-discovery.md
##########
@@ -0,0 +1,266 @@
+---
+title: "How to Integrate API Gateway and Eureka?"
+authors:
+  - name: "Yong Qian"
+    title: "Author"
+    url: "https://github.com/nic-6443"
+    image_url: "https://avatars.githubusercontent.com/u/22141303?v=4"
+  - name: "Fei Han"
+    title: "Technical Writer"
+    url: "https://github.com/hf400159"
+    image_url: "https://avatars.githubusercontent.com/u/97138894?v=4"
+keywords: 
+- API Gateway
+- Apache APISIX
+- Eureka
+- Service Discovery
+- Servici Register
+description: This article describes how to enable Eureka as a service discovery in the API gateway Apache APISIX and how to use diagnostic tools to quickly discover links that forward exceptions.
+tags: [Technology,Ecosystem,Service Discovery]
+---
+
+> This article describes how to enable Eureka as a service discovery in the API gateway Apache APISIX and how to use diagnostic tools to quickly discover links that forward exceptions.
+
+<!--truncate-->
+In microservices architecture, large and complex systems are vertically divided into smaller subsystems based on function or business requirements, which exist as independently deployed sub-processes that communicate with each other through network calls. How these independently deployed services discover each other is the first problem to be solved, so there is often a centralized registry in microservice architectures.
+
+As the most core development framework in the Java ecosystem, Spring continues to liberate the productivity of Java developers from Spring MVC to Spring Boot, and Spring Cloud is Spring's answer to the micro-service architecture in the Cloud native era.
+
+In Spring Cloud, Eureka acts as a registry. Eureka is an open source Registry service written in The Java language by Netflix that plays a key role in Netflix's infrastructure.

Review comment:
       ```suggestion
   In Spring Cloud, Eureka acts as a registry. Eureka is an open source Registry service written in the Java language by Netflix that plays a key role in Netflix's infrastructure.
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] netlify[bot] commented on pull request #938: docs: add eureka blog

Posted by GitBox <gi...@apache.org>.
netlify[bot] commented on pull request #938:
URL: https://github.com/apache/apisix-website/pull/938#issuecomment-1058728317


   👷 Deploy Preview for *apache-apisix* processing.
   
   
   🔨 Explore the source changes: bf4db75ebb8b44eeb6412b00db6d16014fb9e364
   
   🔍 Inspect the deploy log: [https://app.netlify.com/sites/apache-apisix/deploys/62216802354038000726841f](https://app.netlify.com/sites/apache-apisix/deploys/62216802354038000726841f)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] nic-6443 commented on a change in pull request #938: docs: add eureka blog

Posted by GitBox <gi...@apache.org>.
nic-6443 commented on a change in pull request #938:
URL: https://github.com/apache/apisix-website/pull/938#discussion_r819231558



##########
File path: website/blog/2022/03/05/apisix-integration-eureka-service-discovery.md
##########
@@ -0,0 +1,266 @@
+---
+title: "How to Integrate API Gateway and Eureka?"
+authors:
+  - name: "Yong Qian"
+    title: "Author"
+    url: "https://github.com/nic-6443"
+    image_url: "https://avatars.githubusercontent.com/u/22141303?v=4"
+  - name: "Fei Han"
+    title: "Technical Writer"
+    url: "https://github.com/hf400159"
+    image_url: "https://avatars.githubusercontent.com/u/97138894?v=4"
+keywords: 
+- API Gateway
+- Apache APISIX
+- Eureka
+- Service Discovery
+- Servici Register
+description: This article describes how to enable Eureka as a service discovery in the API gateway Apache APISIX and how to use diagnostic tools to quickly discover links that forward exceptions.
+tags: [Technology,Ecosystem,Service Discovery]
+---
+
+> This article describes how to enable Eureka as a service discovery in the API gateway Apache APISIX and how to use diagnostic tools to quickly discover links that forward exceptions.
+
+<!--truncate-->
+In microservices architecture, large and complex systems are vertically divided into smaller subsystems based on function or business requirements, which exist as independently deployed sub-processes that communicate with each other through network calls. How these independently deployed services discover each other is the first problem to be solved, so there is often a centralized registry in microservice architectures.
+
+As the most core development framework in the Java ecosystem, Spring continues to liberate the productivity of Java developers from Spring MVC to Spring Boot, and Spring Cloud is Spring's answer to the micro-service architecture in the Cloud native era.
+
+In Spring Cloud, Eureka acts as a registry. Eureka is an open source Registry service written in The Java language by Netflix that plays a key role in Netflix's infrastructure.
+
+Apache APISIX is a dynamic, real-time, high-performance API gateway that provides rich traffic management features such as load balancing, dynamic upstream, canary release, circuit breaking, authentication, observability, and more. As an industry-leading microservice gateway, Apache APISIX provides native support for Eureka. This article will use the Spring Cloud demo project as an example to show you the main functions and features of Apache APISIX docking Eureka service discovery.
+
+## Preparation Phase
+
+This demonstration uses the official [`spring-cloud-netflix`](https://spring.io/projects/spring-cloud-netflix#overview) tutorial provided by Spring as an example, which provides the Eureka Server started with SpringBoot as the registration center of Spring Cloud. We also use the same method to start the Eureka server for demonstration. Please visit  [`spring-cloud-samples/eureka`](https://github.com/spring-cloud-samples/eureka,) for the project address.
+
+The following will introduce you to the relevant code and startup method.
+
+### Eureka Server
+
+Spring Cloud provides an EnableEurekaServer annotation for Eureka, which can directly start an Eureka Server in the way of Spring Boot.

Review comment:
       ```suggestion
   Spring Cloud provides an `EnableEurekaServer` annotation for Eureka, which can directly start an Eureka Server in the way of Spring Boot.
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] SylviaBABY commented on a change in pull request #938: docs: add eureka blog

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on a change in pull request #938:
URL: https://github.com/apache/apisix-website/pull/938#discussion_r819232176



##########
File path: website/blog/2022/03/05/apisix-integration-eureka-service-discovery.md
##########
@@ -0,0 +1,266 @@
+---
+title: "How to Integrate API Gateway and Eureka?"

Review comment:
       ```suggestion
   title: "How to Integrate API Gateway with Eureka?"
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] netlify[bot] edited a comment on pull request #938: docs: add eureka blog

Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #938:
URL: https://github.com/apache/apisix-website/pull/938#issuecomment-1058728317


   ✔️ Deploy Preview for *apache-apisix* ready!
   
   
   🔨 Explore the source changes: 64615425f606dc8c4547e0cfb943b761cc1d07fb
   
   🔍 Inspect the deploy log: [https://app.netlify.com/sites/apache-apisix/deploys/62217cb6928ae600077e242d](https://app.netlify.com/sites/apache-apisix/deploys/62217cb6928ae600077e242d)
   
   😎 Browse the preview: [https://deploy-preview-938--apache-apisix.netlify.app](https://deploy-preview-938--apache-apisix.netlify.app)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] netlify[bot] edited a comment on pull request #938: docs: add eureka blog

Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #938:
URL: https://github.com/apache/apisix-website/pull/938#issuecomment-1058728317


   👷 Deploy Preview for *apache-apisix* processing.
   
   
   🔨 Explore the source changes: e1f8497cf4a12d950f5b30376a266b8b29115d50
   
   🔍 Inspect the deploy log: [https://app.netlify.com/sites/apache-apisix/deploys/6221acc0fe83880007826443](https://app.netlify.com/sites/apache-apisix/deploys/6221acc0fe83880007826443)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] netlify[bot] edited a comment on pull request #938: docs: add eureka blog

Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #938:
URL: https://github.com/apache/apisix-website/pull/938#issuecomment-1058728317


   👷 Deploy Preview for *apache-apisix* processing.
   
   
   🔨 Explore the source changes: e0d06696d48a88a72c9f15d8cf7587770edc13af
   
   🔍 Inspect the deploy log: [https://app.netlify.com/sites/apache-apisix/deploys/62216e0b2978a5000792e9f3](https://app.netlify.com/sites/apache-apisix/deploys/62216e0b2978a5000792e9f3)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] netlify[bot] edited a comment on pull request #938: docs: add eureka blog

Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #938:
URL: https://github.com/apache/apisix-website/pull/938#issuecomment-1058728317


   👷 Deploy Preview for *apache-apisix* processing.
   
   
   🔨 Explore the source changes: 64615425f606dc8c4547e0cfb943b761cc1d07fb
   
   🔍 Inspect the deploy log: [https://app.netlify.com/sites/apache-apisix/deploys/62217cb6928ae600077e242d](https://app.netlify.com/sites/apache-apisix/deploys/62217cb6928ae600077e242d)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] yzeng25 commented on a change in pull request #938: docs: add eureka blog

Posted by GitBox <gi...@apache.org>.
yzeng25 commented on a change in pull request #938:
URL: https://github.com/apache/apisix-website/pull/938#discussion_r819261113



##########
File path: website/blog/2022/03/05/apisix-integration-eureka-service-discovery.md
##########
@@ -0,0 +1,266 @@
+---
+title: "How to Integrate API Gateway and Eureka?"
+authors:
+  - name: "Yong Qian"
+    title: "Author"
+    url: "https://github.com/nic-6443"
+    image_url: "https://avatars.githubusercontent.com/u/22141303?v=4"
+  - name: "Fei Han"
+    title: "Technical Writer"
+    url: "https://github.com/hf400159"
+    image_url: "https://avatars.githubusercontent.com/u/97138894?v=4"
+keywords: 
+- API Gateway
+- Apache APISIX
+- Eureka
+- Service Discovery
+- Servici Register
+description: This article describes how to enable Eureka as a service discovery in the API gateway Apache APISIX and how to use diagnostic tools to quickly discover links that forward exceptions.
+tags: [Technology,Ecosystem,Service Discovery]
+---
+
+> This article describes how to enable Eureka as a service discovery in the API gateway Apache APISIX and how to use diagnostic tools to quickly discover links that forward exceptions.
+
+<!--truncate-->
+In microservices architecture, large and complex systems are vertically divided into smaller subsystems based on function or business requirements, which exist as independently deployed sub-processes that communicate with each other through network calls. How these independently deployed services discover each other is the first problem to be solved, so there is often a centralized registry in microservice architectures.
+
+As the most core development framework in the Java ecosystem, Spring continues to liberate the productivity of Java developers from Spring MVC to Spring Boot, and Spring Cloud is Spring's answer to the micro-service architecture in the Cloud native era.
+
+In Spring Cloud, Eureka acts as a registry. Eureka is an open source Registry service written in The Java language by Netflix that plays a key role in Netflix's infrastructure.
+
+Apache APISIX is a dynamic, real-time, high-performance API gateway that provides rich traffic management features such as load balancing, dynamic upstream, canary release, circuit breaking, authentication, observability, and more. As an industry-leading microservice gateway, Apache APISIX provides native support for Eureka. This article will use the Spring Cloud demo project as an example to show you the main functions and features of Apache APISIX docking Eureka service discovery.
+
+## Preparation Phase
+
+This demonstration uses the official [`spring-cloud-netflix`](https://spring.io/projects/spring-cloud-netflix#overview) tutorial provided by Spring as an example, which provides the Eureka Server started with SpringBoot as the registration center of Spring Cloud. We also use the same method to start the Eureka server for demonstration. Please visit  [`spring-cloud-samples/eureka`](https://github.com/spring-cloud-samples/eureka,) for the project address.
+
+The following will introduce you to the relevant code and startup method.
+
+### Eureka Server

Review comment:
       ```suggestion
   ## Eureka Server
   ```

##########
File path: website/i18n/zh/docusaurus-plugin-content-blog/2022/03/05/apisix-integration-eureka-service-discovery.md
##########
@@ -0,0 +1,266 @@
+---
+title: "生态系统持续完善,API 网关 Apache APISIX 集成 Eureka 作为服务发现"
+authors:
+  - name: "钱勇"
+    title: "Author"
+    url: "https://github.com/nic-6443"
+    image_url: "https://avatars.githubusercontent.com/u/22141303?v=4"
+  - name: "韩飞"
+    title: "Technical Writer"
+    url: "https://github.com/hf400159"
+    image_url: "https://avatars.githubusercontent.com/u/97138894?v=4"
+keywords: 
+- Apache APISIX
+- API Gateway
+- Eureka
+- 服务发现
+- 服务注册
+description: 本文介绍了如何在 API 网关 Apache APISIX 中启用 Eureka 作为服务发现以及如何使用诊断工具快速发现转发异常的链路。
+tags: [Technology,Ecosystem,Service Discovery]
+---
+
+> 本文介绍了如何在 API 网关 Apache APISIX 中启用 Eureka 作为服务发现以及如何使用诊断工具快速发现转发异常的链路。
+
+<!--truncate-->
+微服务架构中,大型复杂的系统按功能或者业务需求垂直切分成更小的子系统,这些子系统以独立部署的子进程存在,它们之间通过网络调用进行通信。这些独立部署的服务如何发现对方成为了首先要解决的问题,所以在微服务架构中往往都会存在一个中心化的注册中心。
+
+Spring 作为 Java 生态中最核心的开发框架,从 Spring MVC 到 Spring Boot 持续不断解放着 Java 开发者的生产力,而 Spring Cloud 是 Spring 面向云原生时代微服务架构给出的答案。
+
+在 Spring Cloud 中,Eureka 就扮演了注册中心的角色。Eureka 是一款由 Netflix 开源,使用 Java 语言编写的注册中心服务,其在 Netflix 的基础设施中扮演着重要角色。
+
+Apache APISIX 是一个动态、实时、高性能的 API 网关,提供了负载均衡、动态上游、灰度发布、服务熔断、身份认证、可观测性等丰富的流量管理功能。Apache APISIX 作为业界领先的微服务 API 网关,对 Eureka 提供了原生支持。本文将会使用 Spring Cloud 演示项目作为案例,为大家展示 Apache APISIX 对接 Eureka 服务发现的主要功能及特性。
+
+## 准备阶段
+
+本次演示使用 Spring 官方提供的 [`spring-cloud-netflix`](https://spring.io/projects/spring-cloud-netflix#overview) 教程作为示例,该教程中提供了使用 SpringBoot 启动的 Eureka Server 作为 Spring Cloud 的注册中心,我们也使用相同的方式来启动用于演示的 Eureka 服务端。该项目地址请访问 [`spring-cloud-samples/eureka`](https://github.com/spring-cloud-samples/eureka,)。
+
+接下来将为您介绍相关代码和启动方式。
+
+### Eureka Server

Review comment:
       ```suggestion
   ## Eureka Server
   ```

##########
File path: website/i18n/zh/docusaurus-plugin-content-blog/2022/03/05/apisix-integration-eureka-service-discovery.md
##########
@@ -0,0 +1,266 @@
+---
+title: "生态系统持续完善,API 网关 Apache APISIX 集成 Eureka 作为服务发现"
+authors:
+  - name: "钱勇"
+    title: "Author"
+    url: "https://github.com/nic-6443"
+    image_url: "https://avatars.githubusercontent.com/u/22141303?v=4"
+  - name: "韩飞"
+    title: "Technical Writer"
+    url: "https://github.com/hf400159"
+    image_url: "https://avatars.githubusercontent.com/u/97138894?v=4"
+keywords: 
+- Apache APISIX
+- API Gateway
+- Eureka
+- 服务发现
+- 服务注册
+description: 本文介绍了如何在 API 网关 Apache APISIX 中启用 Eureka 作为服务发现以及如何使用诊断工具快速发现转发异常的链路。
+tags: [Technology,Ecosystem,Service Discovery]
+---
+
+> 本文介绍了如何在 API 网关 Apache APISIX 中启用 Eureka 作为服务发现以及如何使用诊断工具快速发现转发异常的链路。
+
+<!--truncate-->
+微服务架构中,大型复杂的系统按功能或者业务需求垂直切分成更小的子系统,这些子系统以独立部署的子进程存在,它们之间通过网络调用进行通信。这些独立部署的服务如何发现对方成为了首先要解决的问题,所以在微服务架构中往往都会存在一个中心化的注册中心。
+
+Spring 作为 Java 生态中最核心的开发框架,从 Spring MVC 到 Spring Boot 持续不断解放着 Java 开发者的生产力,而 Spring Cloud 是 Spring 面向云原生时代微服务架构给出的答案。
+
+在 Spring Cloud 中,Eureka 就扮演了注册中心的角色。Eureka 是一款由 Netflix 开源,使用 Java 语言编写的注册中心服务,其在 Netflix 的基础设施中扮演着重要角色。
+
+Apache APISIX 是一个动态、实时、高性能的 API 网关,提供了负载均衡、动态上游、灰度发布、服务熔断、身份认证、可观测性等丰富的流量管理功能。Apache APISIX 作为业界领先的微服务 API 网关,对 Eureka 提供了原生支持。本文将会使用 Spring Cloud 演示项目作为案例,为大家展示 Apache APISIX 对接 Eureka 服务发现的主要功能及特性。
+
+## 准备阶段
+
+本次演示使用 Spring 官方提供的 [`spring-cloud-netflix`](https://spring.io/projects/spring-cloud-netflix#overview) 教程作为示例,该教程中提供了使用 SpringBoot 启动的 Eureka Server 作为 Spring Cloud 的注册中心,我们也使用相同的方式来启动用于演示的 Eureka 服务端。该项目地址请访问 [`spring-cloud-samples/eureka`](https://github.com/spring-cloud-samples/eureka,)。
+
+接下来将为您介绍相关代码和启动方式。
+
+### Eureka Server
+
+Spring Cloud 为 Eureka 提供了一个 `EnableEurekaServer` 的注解,可以直接以 Spring Boot 的方式启动一个 Eureka Server。
+
+代码示例如下:
+
+```Java
+@SpringBootApplication
+@EnableEurekaServer
+public class EurekaApplication {
+        public static void main(String[] args) {
+                SpringApplication.run(EurekaApplication.class,args);
+        }
+}
+```
+
+启动方式可直接参考下方代码:
+
+```Shell
+git clone git@github.com:spring-cloud-samples/eureka.git
+# 在项目根目录执行
+./gradlew bootRun
+```
+
+`resources` 目录中的 `application.yml` 文件定义了 Eureka Server 监听在 `8761` 端口。
+
+```YAML
+server:
+  port: 8761
+```
+
+### 接入 Eureka Client 的 HTTP 服务
+
+与 `EnableEurekaServer` 对应的客户端注解是 `EnableEurekaClient`,使用 `EnableEurekaClient` 可以非常简单得将一个使用 Spring Boot 启动的 HTTP 应用注册到 Eureka 上。
+
+以下为示例代码:
+
+```Java
+@SpringBootApplication
+@EnableEurekaClient
+@RestController
+public class Application {
+
+        @Value("${server.port}")
+        int serverPort;
+
+        @RequestMapping("/")
+        public String home() {
+                return String.format("server-%s",serverPort);
+        }
+
+        public static void main(String[] args) {
+                new SpringApplicationBuilder(Application.class).web(WebApplicationType.SERVLET).run(args);
+        }
+
+}
+```
+
+这里我们在 `/` 路径上暴露一个 HTTP 服务,返回当前 Spring Boot 使用的端口,这样我们可以使用不同的配置文件,启动多个实例,来演示 APISIX 对注册到 Eureka 的服务端实例列表进行负载均衡的效果。
+
+配置文件如下:
+
+```JAVA
+spring.application.name=a-bootiful-client #将会作为注册到 Eureka 中的 application name
+server.port=8080 # 修改监听端口以启动多个实例
+```
+
+设置监听端口为 `8080`,`8081`,`8082`,并启动三个 Spring Boot 实例,完成后,使用浏览器访问 Eureka Server 的 `8761` 端口,可以查看服务注册的结果。
+
+![error/results example.png](https://static.apiseven.com/202108/1646350535070-7615a784-df05-4e94-a88e-b039c111de53.png)
+
+您可以看到应用 `A-BOOTIFUL-CLIENT` (注意:spring.application.name 被全部转为大写字符)下注册了三个实例,分别暴露了 `8080`,`8081`,`8082` 端口,并且均处于 UP 状态。
+
+## 使用 APISIX 代理 SpringCloud 应用
+
+接下来,我们将会实现如下图所示的请求链路:
+
+![error/request link.png](https://static.apiseven.com/202108/1646350644536-7b68a4a3-b523-4c82-8e19-822624ff2c95.png)
+
+### 启动 Apache APISIX
+
+首先,需要在 Apache APISIX 的配置文件 `config.yaml` 中找到 `apisix.discovery`,修改 Eureka Server 连接信息的相关配置,并启动 APISIX。
+
+```YAML
+  discovery:                       # service discovery center
+      eureka:
+        host:                        # it's possible to define multiple eureka hosts addresses of the same eureka cluster.
+          - "http://172.23.79.129:8761" # Access address of Eureka Server started by Spring Boot
+        prefix: /eureka/
+        fetch_interval: 30           # default 30s
+        weight: 100                  # default weight for node
+        timeout:
+          connect: 2000              # default 2000ms
+          send: 2000                 # default 2000ms
+          read: 5000                 # default 5000ms
+
+```
+
+### 创建路由
+
+创建一个 Route,并在 Upstream 中配置启用 Eureka Service Discovery 插件。
+
+- `upstream.discovery_type` 为 `eureka`。
+- `upstream.service_name` 是应用在 Eureka 中注册的应用名 `A-BOOTIFUL-CLIENT`。
+
+```Shell
+curl http://172.30.45.72:9180/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+    "uri": "/*",
+    "host": "eureka-demo",
+    "upstream": {
+        "service_name": "A-BOOTIFUL-CLIENT",
+        "type": "roundrobin",
+        "discovery_type": "eureka"
+    }
+}'
+```
+
+### 请求路由
+
+使用 `curl` 命令进行多次请求,验证负载均衡效果。
+
+```Shell
+$ curl http://172.30.45.72:9080/ -H "Host: eureka-demo"
+server-8081%
+$ curl http://172.30.45.72:9080/ -H "Host: eureka-demo"
+server-8080%
+$ curl http://172.30.45.72:9080/ -H "Host: eureka-demo"
+server-8082%
+$ curl http://172.30.45.72:9080/ -H "Host: eureka-demo"
+server-8081%
+$ curl http://172.30.45.72:9080/ -H "Host: eureka-demo"
+server-8080%
+$ curl http://172.30.45.72:9080/ -H "Host: eureka-demo"
+server-8082%
+```
+
+从上述返回结果可以看到,请求被依次分配到 Eureka 中注册的三个实例上,这是因为我们使用的负载均衡算法是 `roundrobin`,所有的后端实例会被轮流分配请求。
+
+### 模拟实例宕机
+
+关闭其中 `8081` 实例,模拟实例宕机场景,观察请求效果。
+
+```Shell
+$ while true; do curl http://172.30.45.72:9080/ -H "Host: eureka-demo"; echo; sleep 1; done
+
+server-8080
+server-8082
+server-8081
+
+server-8080
+server-8082
+server-8081
+
+server-8080
+server-8082
+
+server-8080
+server-8082
+```
+
+由上述结果可以看出,关闭 `8081` 实例后,Apache APISIX 会及时同步到 Eureka 的最新实例列表,然后将请求转发给正确的后端。
+
+### 诊断工具
+
+在微服务系统中,经常会遇到非预期转发的问题,这些问题的原因可能来自服务发现中的各个链路,例如:客户端注册异常,注册中心本身数据异常,网关读取注册数据异常等等,因此发生异常时链路中可以使用的诊断工具将会尤为重要。
+
+所以 APISIX 在 Service Discovery 插件中提供了一个诊断接口,可以方便的查询出当前网关正在使用的服务列表,结合注册中心的控制台,我们就对网关到注册中心这一链路做出快速诊断。
+
+诊断接口默认暴露在回环接口的 `9090` 端口,访问方式为 `GET /v1/discovery/{discovery_type}/dump`,例:
+
+```Shell
+curl http://localhost:9090/v1/discovery/eureka/dump
+
+{
+  "services": {
+    "A-BOOTIFUL-CLIENT": [
+      {
+        "weight": 100,
+        "metadata": {
+          "management.port": "8081"
+        },
+        "host": "192.168.50.164",
+        "port": 8081
+      },
+      {
+        "weight": 100,
+        "metadata": {
+          "management.port": "8080"
+        },
+        "host": "192.168.50.164",
+        "port": 8080
+      },
+      {
+        "weight": 100,
+        "metadata": {
+          "management.port": "8082"
+        },
+        "host": "192.168.50.164",
+        "port": 8082
+      }
+    ]
+  },
+  "config": {
+    "prefix": "\/eureka\/",
+    "timeout": {
+      "connect": 2000,
+      "send": 2000,
+      "read": 5000
+    },
+    "fetch_interval": 30,
+    "host": [
+      "http:\/\/172.23.79.129:8761"
+    ],
+    "weight": 100
+  }
+}
+```
+
+通过上述示例就可以查询到 APISIX 正在使用的 Eureka 数据。
+
+### 总结

Review comment:
       I am pretty sure this should be `##` section topic. Double check all section topics.

##########
File path: website/i18n/zh/docusaurus-plugin-content-blog/2022/03/05/apisix-integration-eureka-service-discovery.md
##########
@@ -0,0 +1,266 @@
+---
+title: "生态系统持续完善,API 网关 Apache APISIX 集成 Eureka 作为服务发现"
+authors:
+  - name: "钱勇"
+    title: "Author"
+    url: "https://github.com/nic-6443"
+    image_url: "https://avatars.githubusercontent.com/u/22141303?v=4"
+  - name: "韩飞"
+    title: "Technical Writer"
+    url: "https://github.com/hf400159"
+    image_url: "https://avatars.githubusercontent.com/u/97138894?v=4"
+keywords: 
+- Apache APISIX
+- API Gateway
+- Eureka
+- 服务发现
+- 服务注册
+description: 本文介绍了如何在 API 网关 Apache APISIX 中启用 Eureka 作为服务发现以及如何使用诊断工具快速发现转发异常的链路。
+tags: [Technology,Ecosystem,Service Discovery]
+---
+
+> 本文介绍了如何在 API 网关 Apache APISIX 中启用 Eureka 作为服务发现以及如何使用诊断工具快速发现转发异常的链路。
+
+<!--truncate-->
+微服务架构中,大型复杂的系统按功能或者业务需求垂直切分成更小的子系统,这些子系统以独立部署的子进程存在,它们之间通过网络调用进行通信。这些独立部署的服务如何发现对方成为了首先要解决的问题,所以在微服务架构中往往都会存在一个中心化的注册中心。
+
+Spring 作为 Java 生态中最核心的开发框架,从 Spring MVC 到 Spring Boot 持续不断解放着 Java 开发者的生产力,而 Spring Cloud 是 Spring 面向云原生时代微服务架构给出的答案。
+
+在 Spring Cloud 中,Eureka 就扮演了注册中心的角色。Eureka 是一款由 Netflix 开源,使用 Java 语言编写的注册中心服务,其在 Netflix 的基础设施中扮演着重要角色。
+
+Apache APISIX 是一个动态、实时、高性能的 API 网关,提供了负载均衡、动态上游、灰度发布、服务熔断、身份认证、可观测性等丰富的流量管理功能。Apache APISIX 作为业界领先的微服务 API 网关,对 Eureka 提供了原生支持。本文将会使用 Spring Cloud 演示项目作为案例,为大家展示 Apache APISIX 对接 Eureka 服务发现的主要功能及特性。
+
+## 准备阶段
+
+本次演示使用 Spring 官方提供的 [`spring-cloud-netflix`](https://spring.io/projects/spring-cloud-netflix#overview) 教程作为示例,该教程中提供了使用 SpringBoot 启动的 Eureka Server 作为 Spring Cloud 的注册中心,我们也使用相同的方式来启动用于演示的 Eureka 服务端。该项目地址请访问 [`spring-cloud-samples/eureka`](https://github.com/spring-cloud-samples/eureka,)。
+
+接下来将为您介绍相关代码和启动方式。
+
+### Eureka Server
+
+Spring Cloud 为 Eureka 提供了一个 `EnableEurekaServer` 的注解,可以直接以 Spring Boot 的方式启动一个 Eureka Server。
+
+代码示例如下:
+
+```Java
+@SpringBootApplication
+@EnableEurekaServer
+public class EurekaApplication {
+        public static void main(String[] args) {
+                SpringApplication.run(EurekaApplication.class,args);
+        }
+}
+```
+
+启动方式可直接参考下方代码:
+
+```Shell
+git clone git@github.com:spring-cloud-samples/eureka.git
+# 在项目根目录执行
+./gradlew bootRun
+```
+
+`resources` 目录中的 `application.yml` 文件定义了 Eureka Server 监听在 `8761` 端口。
+
+```YAML
+server:
+  port: 8761
+```
+
+### 接入 Eureka Client 的 HTTP 服务
+
+与 `EnableEurekaServer` 对应的客户端注解是 `EnableEurekaClient`,使用 `EnableEurekaClient` 可以非常简单得将一个使用 Spring Boot 启动的 HTTP 应用注册到 Eureka 上。
+
+以下为示例代码:
+
+```Java
+@SpringBootApplication
+@EnableEurekaClient
+@RestController
+public class Application {
+
+        @Value("${server.port}")
+        int serverPort;
+
+        @RequestMapping("/")
+        public String home() {
+                return String.format("server-%s",serverPort);
+        }
+
+        public static void main(String[] args) {
+                new SpringApplicationBuilder(Application.class).web(WebApplicationType.SERVLET).run(args);
+        }
+
+}
+```
+
+这里我们在 `/` 路径上暴露一个 HTTP 服务,返回当前 Spring Boot 使用的端口,这样我们可以使用不同的配置文件,启动多个实例,来演示 APISIX 对注册到 Eureka 的服务端实例列表进行负载均衡的效果。
+
+配置文件如下:
+
+```JAVA
+spring.application.name=a-bootiful-client #将会作为注册到 Eureka 中的 application name
+server.port=8080 # 修改监听端口以启动多个实例
+```
+
+设置监听端口为 `8080`,`8081`,`8082`,并启动三个 Spring Boot 实例,完成后,使用浏览器访问 Eureka Server 的 `8761` 端口,可以查看服务注册的结果。
+
+![error/results example.png](https://static.apiseven.com/202108/1646350535070-7615a784-df05-4e94-a88e-b039c111de53.png)
+
+您可以看到应用 `A-BOOTIFUL-CLIENT` (注意:spring.application.name 被全部转为大写字符)下注册了三个实例,分别暴露了 `8080`,`8081`,`8082` 端口,并且均处于 UP 状态。
+
+## 使用 APISIX 代理 SpringCloud 应用
+
+接下来,我们将会实现如下图所示的请求链路:
+
+![error/request link.png](https://static.apiseven.com/202108/1646350644536-7b68a4a3-b523-4c82-8e19-822624ff2c95.png)
+
+### 启动 Apache APISIX
+
+首先,需要在 Apache APISIX 的配置文件 `config.yaml` 中找到 `apisix.discovery`,修改 Eureka Server 连接信息的相关配置,并启动 APISIX。
+
+```YAML
+  discovery:                       # service discovery center
+      eureka:
+        host:                        # it's possible to define multiple eureka hosts addresses of the same eureka cluster.
+          - "http://172.23.79.129:8761" # Access address of Eureka Server started by Spring Boot
+        prefix: /eureka/
+        fetch_interval: 30           # default 30s
+        weight: 100                  # default weight for node
+        timeout:
+          connect: 2000              # default 2000ms
+          send: 2000                 # default 2000ms
+          read: 5000                 # default 5000ms
+
+```
+
+### 创建路由
+
+创建一个 Route,并在 Upstream 中配置启用 Eureka Service Discovery 插件。
+
+- `upstream.discovery_type` 为 `eureka`。
+- `upstream.service_name` 是应用在 Eureka 中注册的应用名 `A-BOOTIFUL-CLIENT`。
+
+```Shell
+curl http://172.30.45.72:9180/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+    "uri": "/*",
+    "host": "eureka-demo",
+    "upstream": {
+        "service_name": "A-BOOTIFUL-CLIENT",
+        "type": "roundrobin",
+        "discovery_type": "eureka"
+    }
+}'
+```
+
+### 请求路由
+
+使用 `curl` 命令进行多次请求,验证负载均衡效果。
+
+```Shell
+$ curl http://172.30.45.72:9080/ -H "Host: eureka-demo"
+server-8081%
+$ curl http://172.30.45.72:9080/ -H "Host: eureka-demo"
+server-8080%
+$ curl http://172.30.45.72:9080/ -H "Host: eureka-demo"
+server-8082%
+$ curl http://172.30.45.72:9080/ -H "Host: eureka-demo"
+server-8081%
+$ curl http://172.30.45.72:9080/ -H "Host: eureka-demo"
+server-8080%
+$ curl http://172.30.45.72:9080/ -H "Host: eureka-demo"
+server-8082%
+```
+
+从上述返回结果可以看到,请求被依次分配到 Eureka 中注册的三个实例上,这是因为我们使用的负载均衡算法是 `roundrobin`,所有的后端实例会被轮流分配请求。
+
+### 模拟实例宕机
+
+关闭其中 `8081` 实例,模拟实例宕机场景,观察请求效果。
+
+```Shell
+$ while true; do curl http://172.30.45.72:9080/ -H "Host: eureka-demo"; echo; sleep 1; done
+
+server-8080
+server-8082
+server-8081
+
+server-8080
+server-8082
+server-8081
+
+server-8080
+server-8082
+
+server-8080
+server-8082
+```
+
+由上述结果可以看出,关闭 `8081` 实例后,Apache APISIX 会及时同步到 Eureka 的最新实例列表,然后将请求转发给正确的后端。
+
+### 诊断工具
+
+在微服务系统中,经常会遇到非预期转发的问题,这些问题的原因可能来自服务发现中的各个链路,例如:客户端注册异常,注册中心本身数据异常,网关读取注册数据异常等等,因此发生异常时链路中可以使用的诊断工具将会尤为重要。
+
+所以 APISIX 在 Service Discovery 插件中提供了一个诊断接口,可以方便的查询出当前网关正在使用的服务列表,结合注册中心的控制台,我们就对网关到注册中心这一链路做出快速诊断。
+
+诊断接口默认暴露在回环接口的 `9090` 端口,访问方式为 `GET /v1/discovery/{discovery_type}/dump`,例:
+
+```Shell
+curl http://localhost:9090/v1/discovery/eureka/dump
+
+{
+  "services": {
+    "A-BOOTIFUL-CLIENT": [
+      {
+        "weight": 100,
+        "metadata": {
+          "management.port": "8081"
+        },
+        "host": "192.168.50.164",
+        "port": 8081
+      },
+      {
+        "weight": 100,
+        "metadata": {
+          "management.port": "8080"
+        },
+        "host": "192.168.50.164",
+        "port": 8080
+      },
+      {
+        "weight": 100,
+        "metadata": {
+          "management.port": "8082"
+        },
+        "host": "192.168.50.164",
+        "port": 8082
+      }
+    ]
+  },
+  "config": {
+    "prefix": "\/eureka\/",
+    "timeout": {
+      "connect": 2000,
+      "send": 2000,
+      "read": 5000
+    },
+    "fetch_interval": 30,
+    "host": [
+      "http:\/\/172.23.79.129:8761"
+    ],
+    "weight": 100
+  }
+}
+```
+
+通过上述示例就可以查询到 APISIX 正在使用的 Eureka 数据。
+
+### 总结

Review comment:
       ```suggestion
   ## 总结
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] netlify[bot] edited a comment on pull request #938: docs: add eureka blog

Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #938:
URL: https://github.com/apache/apisix-website/pull/938#issuecomment-1058728317






-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] netlify[bot] edited a comment on pull request #938: docs: add eureka blog

Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #938:
URL: https://github.com/apache/apisix-website/pull/938#issuecomment-1058728317


   ✔️ Deploy Preview for *apache-apisix* ready!
   
   
   🔨 Explore the source changes: 3c912b8291d09dfcae4e6f678438862ad8a6aaf7
   
   🔍 Inspect the deploy log: [https://app.netlify.com/sites/apache-apisix/deploys/6221ad4d126a900008a8e461](https://app.netlify.com/sites/apache-apisix/deploys/6221ad4d126a900008a8e461)
   
   😎 Browse the preview: [https://deploy-preview-938--apache-apisix.netlify.app](https://deploy-preview-938--apache-apisix.netlify.app)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] SylviaBABY commented on a change in pull request #938: docs: add eureka blog

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on a change in pull request #938:
URL: https://github.com/apache/apisix-website/pull/938#discussion_r819232067



##########
File path: website/i18n/zh/docusaurus-plugin-content-blog/2022/03/05/apisix-integration-eureka-service-discovery.md
##########
@@ -0,0 +1,266 @@
+---
+title: "生态系统持续完善,API 网关 Apache APISIX 集成 Eureka 作为服务发现"

Review comment:
       集成 Eureka 这个事情,不是最新的功能,而是以前就有的。所以我觉得用「生态持续完善」可能会有些误导?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] netlify[bot] edited a comment on pull request #938: docs: add eureka blog

Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #938:
URL: https://github.com/apache/apisix-website/pull/938#issuecomment-1058728317


   ✔️ Deploy Preview for *apache-apisix* ready!
   
   
   🔨 Explore the source changes: bf4db75ebb8b44eeb6412b00db6d16014fb9e364
   
   🔍 Inspect the deploy log: [https://app.netlify.com/sites/apache-apisix/deploys/62216802354038000726841f](https://app.netlify.com/sites/apache-apisix/deploys/62216802354038000726841f)
   
   😎 Browse the preview: [https://deploy-preview-938--apache-apisix.netlify.app](https://deploy-preview-938--apache-apisix.netlify.app)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] netlify[bot] edited a comment on pull request #938: docs: add eureka blog

Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #938:
URL: https://github.com/apache/apisix-website/pull/938#issuecomment-1058728317






-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] nic-6443 commented on a change in pull request #938: docs: add eureka blog

Posted by GitBox <gi...@apache.org>.
nic-6443 commented on a change in pull request #938:
URL: https://github.com/apache/apisix-website/pull/938#discussion_r819233525



##########
File path: website/blog/2022/03/05/apisix-integration-eureka-service-discovery.md
##########
@@ -0,0 +1,266 @@
+---
+title: "How to Integrate API Gateway and Eureka?"
+authors:
+  - name: "Yong Qian"
+    title: "Author"
+    url: "https://github.com/nic-6443"
+    image_url: "https://avatars.githubusercontent.com/u/22141303?v=4"
+  - name: "Fei Han"
+    title: "Technical Writer"
+    url: "https://github.com/hf400159"
+    image_url: "https://avatars.githubusercontent.com/u/97138894?v=4"
+keywords: 
+- API Gateway
+- Apache APISIX
+- Eureka
+- Service Discovery
+- Servici Register
+description: This article describes how to enable Eureka as a service discovery in the API gateway Apache APISIX and how to use diagnostic tools to quickly discover links that forward exceptions.

Review comment:
       ```suggestion
   description: This article describes how to enable Eureka as a service discovery in the API gateway Apache APISIX and how to use diagnostic tools to find problems in the link.
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] netlify[bot] edited a comment on pull request #938: docs: add eureka blog

Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #938:
URL: https://github.com/apache/apisix-website/pull/938#issuecomment-1058728317


   ✔️ Deploy Preview for *apache-apisix* ready!
   
   
   🔨 Explore the source changes: 7adda1a6c377658e529d170cdff84999d7c1c444
   
   🔍 Inspect the deploy log: [https://app.netlify.com/sites/apache-apisix/deploys/62216ead62f9b500070215db](https://app.netlify.com/sites/apache-apisix/deploys/62216ead62f9b500070215db)
   
   😎 Browse the preview: [https://deploy-preview-938--apache-apisix.netlify.app](https://deploy-preview-938--apache-apisix.netlify.app)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] yzeng25 merged pull request #938: docs: add eureka blog

Posted by GitBox <gi...@apache.org>.
yzeng25 merged pull request #938:
URL: https://github.com/apache/apisix-website/pull/938


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org