You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicecomb.apache.org by GitBox <gi...@apache.org> on 2017/12/25 01:14:04 UTC
[GitHub] WillemJiang closed pull request #11: SCB-112 edge service document translation
WillemJiang closed pull request #11: SCB-112 edge service document translation
URL: https://github.com/apache/incubator-servicecomb-website/pull/11
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/_users/nginx.md b/_users/nginx.md
index 3458420..2b994ee 100644
--- a/_users/nginx.md
+++ b/_users/nginx.md
@@ -1,107 +1,111 @@
---
-title: "??confd?Nginx?????"
+title: "Using Confd and Nginx for Edge Service"
lang: en
ref: edging-service-nginx
permalink: /users/edging-service/nginx/
-excerpt: "??confd?Nginx?????"
+excerpt: "Using Confd and Nginx for Edge Service"
last_modified_at: 2017-08-15T15:01:43-04:00
redirect_from:
- /theme-setup/
---
{% include toc %}
-## ????
+## Concept Description
### **confd**
-confd???????????????????[https://github.com/kelseyhightower/confd](https://github.com/kelseyhightower/confd)????????????etcd?consul?dynamodb?redis??zookeeper??confd??????????pull?????????????????????????
+confd is a lightweight configuration management tool. The source code address is: https://github.com/kelseyhightower/confd](https://github.com/kelseyhightower/confd), It can store configuration information in etcd, consul, dynamodb, redis, and zookeeper. confd regularly pulls the latest configuration from storage nodes and then reloads services to complete updating the configuration file.
### **Nginx**
-Nginx \(engine x\)???????HTTP????????????????????????[http://www.nginx.cn/doc/](http://www.nginx.cn/doc/)????????????????Nginx?http?????
+Nginx \(engine x\) is a high-performance HTTP and reverse proxy server that has the load balancing function. For details, see [http://www.nginx.cn/doc/](http://www.nginx.cn/doc/). This secton describes the HTTP proxy function of Nginx.
-## ????
+## Scenario
-???????????nginx+confd????????????ServiceComb??????????????????????????confd????nginx????
+This section describes how to use Nginx and confd to serve as edge services. Also, you can connect Nginx and confd to service center in the Java Chassis microservice framework and dynamically update configuration of Nginx using confd.
-??nginx+confd????????????????[http://www.cnblogs.com/Anker/p/6112022.html](http://www.cnblogs.com/Anker/p/6112022.html)???????confd????ServiceComb????????
+For details about how to use the dynamic reverse proxy of Nginx and confd, see [http://www.cnblogs.com/Anker/p/6112022.html](http://www.cnblogs.com/Anker/p/6112022.html), This section describes how to interconnect Confd with the service center of the Java Chassis framework.
-## ??????
+## Interconnecting with the Service Center
-???????????????confd??????????????????????????????
+This section describes how to enable confd to obtain service information from the service center. The service center provides the following APIs for external calls:
-### **????http??**
+### **Method 1: HTTP call**
-??????http???????????????X-Tenant-Name:tenantName??tenameName????????default???"X-Tenant-Name:default"?
+The tenant header information of "X-Tenant-Name:tenantName" needs to be added to the HTTP API in the Service Center. tenameName is the tenant name. The default value is default, such as X-Tenant-Name:default.
-* ??????????
+* Check the health status of the service center
```http
GET 127.0.0.1:9980/health
```
-* ?????????
+* Obtain all microservice information
```http
GET 127.0.0.1:9980/registry/v3/microservices
```
-* ????id??????
+* Obtain the microservice information with a specified ID
-> 1. ???????????serviceId
+> 1. Obtain the service ID based on the microservice information
>
> ```http
> GET 127.0.0.1:9980/registry/v3/existence?type=microservice&appId={appId}&serviceName={serviceName}&version={version}
> ```
>
-> 2. ?????????serviceId?????????
+> 2. Obtain complete microservice information based on the service ID returned by API
>
> ```http
> GET 127.0.0.1:9980/registry/v3/microservices/{serviceId}
> ```
-* ??????????????
+* Obtain all instance information from specified microservice
```http
GET 127.0.0.1:9980/registry/v3/microservices/{serviceId}/instances
```
- ???header????"X-ConsumerId:{serviceId}"?
+ Add the following information to the header file:
-* ?????????
+ "X-ConsumerId:{serviceId}"
+
+* Searching microservice instance information
```http
GET 127.0.0.1:9980/registry/v3/instances?appId={appId}&serviceName={serviceName}&version={version}
```
- ???header???"X-ConsumerId:{serviceId}"?
+ Add the following information to the header file:
+
+ "X-ConsumerId:{serviceId}"
-???????????????service-center?????????url?{}??????????http???????json??
+NOTE: The preceding service center address is provides as example only. Set the variables enclosed in curly brackets ({}) as needed. The data returned via HTTP is in JSON format.
-### **??????servicecomb??????**
+### **Method 2: Using the open-source code API**
-??????????????servicecomb?????????RegistryUtil.java??????????????????????????
+During the development of the microservice application, you only need to call the API provided by the tool RegistryUtil.java in the ServiceComb framework code to obtain the information in the Service Center. The API is described as follows:
-* ?????????
+* Obtain all microservice information
```java
List<Microservice> getAllMicroservices();
```
-* ?????????
+* Obtain the unique ID of the microservice.
```java
String getMicroserviceId(String appId, String microserviceName, String versionRule);
```
-* ??????????????????
+* Query the microservice static information based on the unique ID of the microservice.
```java
Microservice getMicroservice(String microserviceId);
```
-* ??????????????????????
+* Query all the microservice instance information based on the unique IDs of the microservices.
```java
List<MicroserviceInstance> getMicroserviceInstance(String consumerId, String providerId);
```
-* ??app+interface+version????endpoints??
+* Query the instance end points information based on the application, interface, and version.
```java
List<MicroserviceInstance> findServiceInstance(String consumerId, String appId, String serviceName,String versionRule);
```
-????http??????????????????????????confd????nginx???
+You can obtain information about the microservice and instance of the Service Center using the HTTP API to dynamically update the Nginx configuration using confd.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services