imlidian closed pull request #41: update content of index page URL: https://github.com/apache/incubator-servicecomb-docs/pull/41
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/saga-reference/LANGS.md b/saga-reference/LANGS.md index 4106f21..b9c8e33 100644 --- a/saga-reference/LANGS.md +++ b/saga-reference/LANGS.md @@ -1,2 +1,2 @@ -* [英文](en_US/) -* [中文](zh_CN/) \ No newline at end of file +* [中文](zh_CN/) +* [English](en_US/) \ No newline at end of file diff --git a/saga-reference/en_US/README.md b/saga-reference/en_US/README.md index 58a2b2b..69e216d 100644 --- a/saga-reference/en_US/README.md +++ b/saga-reference/en_US/README.md @@ -1,5 +1,4 @@ # Saga User Guide -[](user_guide_zh.md) ## Prerequisites You will need: diff --git a/saga-reference/zh_CN/README.md b/saga-reference/zh_CN/README.md index ba5386e..e70850b 100644 --- a/saga-reference/zh_CN/README.md +++ b/saga-reference/zh_CN/README.md @@ -1,5 +1,4 @@ # Saga 用户指南 -[](user_guide.md) ## 准备环境 1. 安装[JDK 1.8][jdk] diff --git a/service-center-reference/LANGS.md b/service-center-reference/LANGS.md index 4106f21..b9c8e33 100644 --- a/service-center-reference/LANGS.md +++ b/service-center-reference/LANGS.md @@ -1,2 +1,2 @@ -* [英文](en_US/) -* [中文](zh_CN/) \ No newline at end of file +* [中文](zh_CN/) +* [English](en_US/) \ No newline at end of file diff --git a/service-center-reference/book.json b/service-center-reference/book.json deleted file mode 100644 index 30c4ecc..0000000 --- a/service-center-reference/book.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "structure": { - "readme": "design.md" - } -} \ No newline at end of file diff --git a/service-center-reference/en_US/README.md b/service-center-reference/en_US/README.md index 1b618b6..98f3527 100644 --- a/service-center-reference/en_US/README.md +++ b/service-center-reference/en_US/README.md @@ -1,9 +1,97 @@ -## Index +# Development Guide -* [Design](design.md) +This chapter is about how to implement the feature of micro-service discovery with ServiceCenter, +and you can get more detail at [here](/server/core/swagger/v3.yaml) -* [Development Guide](dev-guide.md) +## Micro-service registration +```bash +curl -X POST \ + http://127.0.0.1:30100/registry/v3/microservices \ + -H 'content-type: application/json' \ + -H 'x-domain-name: default' \ + -d '{ + "service": + { + "appId": "default", + "serviceName": "DemoService", + "version":"1.0.0" + } +}' +``` -* [Cluster Mode](sc-cluster.md) - -* [Deploy with TLS](security-tls.md) +and then you can get the 'DemoService' ID like below: + +```json +{ + "serviceId": "a3fae679211211e8a831286ed488fc1b" +} +``` + +## Instance registration + +mark down the micro-service ID and call the instance registration API, +according to the ServiceCenter definition: One process should be registered as one instance + +```bash +curl -X POST \ + http://127.0.0.1:30100/registry/v3/microservices/a3fae679211211e8a831286ed488fc1b/instances \ + -H 'content-type: application/json' \ + -H 'x-domain-name: default' \ + -d '{ + "instance": + { + "hostName":"demo-pc", + "endpoints": [ + "rest://127.0.0.1:8080" + ] + } +}' +``` + +the successful response like below: + +```json +{ + "instanceId": "288ad703211311e8a831286ed488fc1b" +} +``` + +if all are successful, it means you have completed the micro-service registration and instance publish + +## Discovery + +the next step is that discovery the micro-service instance by service name and version rule + +```bash +curl -X GET \ + 'http://127.0.0.1:30100/registry/v3/instances?appId=default&serviceName=DemoService&version=latest' \ + -H 'content-type: application/json' \ + -H 'x-consumerid: a3fae679211211e8a831286ed488fc1b' \ + -H 'x-domain-name: default' +``` + +here, you can get the information from the response + +```json +{ + "instances": [ + { + "instanceId": "b4c9e57f211311e8a831286ed488fc1b", + "serviceId": "a3fae679211211e8a831286ed488fc1b", + "version": "1.0.0", + "hostName": "demo-pc", + "endpoints": [ + "rest://127.0.0.1:8080" + ], + "status": "UP", + "healthCheck": { + "mode": "push", + "interval": 30, + "times": 3 + }, + "timestamp": "1520322915", + "modTimestamp": "1520322915" + } + ] +} +``` \ No newline at end of file diff --git a/service-center-reference/en_US/SUMMARY.md b/service-center-reference/en_US/SUMMARY.md index 1b618b6..98f3527 100644 --- a/service-center-reference/en_US/SUMMARY.md +++ b/service-center-reference/en_US/SUMMARY.md @@ -1,9 +1,97 @@ -## Index +# Development Guide -* [Design](design.md) +This chapter is about how to implement the feature of micro-service discovery with ServiceCenter, +and you can get more detail at [here](/server/core/swagger/v3.yaml) -* [Development Guide](dev-guide.md) +## Micro-service registration +```bash +curl -X POST \ + http://127.0.0.1:30100/registry/v3/microservices \ + -H 'content-type: application/json' \ + -H 'x-domain-name: default' \ + -d '{ + "service": + { + "appId": "default", + "serviceName": "DemoService", + "version":"1.0.0" + } +}' +``` -* [Cluster Mode](sc-cluster.md) - -* [Deploy with TLS](security-tls.md) +and then you can get the 'DemoService' ID like below: + +```json +{ + "serviceId": "a3fae679211211e8a831286ed488fc1b" +} +``` + +## Instance registration + +mark down the micro-service ID and call the instance registration API, +according to the ServiceCenter definition: One process should be registered as one instance + +```bash +curl -X POST \ + http://127.0.0.1:30100/registry/v3/microservices/a3fae679211211e8a831286ed488fc1b/instances \ + -H 'content-type: application/json' \ + -H 'x-domain-name: default' \ + -d '{ + "instance": + { + "hostName":"demo-pc", + "endpoints": [ + "rest://127.0.0.1:8080" + ] + } +}' +``` + +the successful response like below: + +```json +{ + "instanceId": "288ad703211311e8a831286ed488fc1b" +} +``` + +if all are successful, it means you have completed the micro-service registration and instance publish + +## Discovery + +the next step is that discovery the micro-service instance by service name and version rule + +```bash +curl -X GET \ + 'http://127.0.0.1:30100/registry/v3/instances?appId=default&serviceName=DemoService&version=latest' \ + -H 'content-type: application/json' \ + -H 'x-consumerid: a3fae679211211e8a831286ed488fc1b' \ + -H 'x-domain-name: default' +``` + +here, you can get the information from the response + +```json +{ + "instances": [ + { + "instanceId": "b4c9e57f211311e8a831286ed488fc1b", + "serviceId": "a3fae679211211e8a831286ed488fc1b", + "version": "1.0.0", + "hostName": "demo-pc", + "endpoints": [ + "rest://127.0.0.1:8080" + ], + "status": "UP", + "healthCheck": { + "mode": "push", + "interval": 30, + "times": 3 + }, + "timestamp": "1520322915", + "modTimestamp": "1520322915" + } + ] +} +``` \ No newline at end of file diff --git a/service-center-reference/zh_CN/README.md b/service-center-reference/zh_CN/README.md index 19d6864..2fd6e28 100644 --- a/service-center-reference/zh_CN/README.md +++ b/service-center-reference/zh_CN/README.md @@ -1,9 +1,94 @@ -## 目录 +# 开发指南 -* [设计原理](design-zh.md) +这个章节是关于如何基于实现微服务发现功能,你可以找到更多细节 [here](/server/core/swagger/v3.yaml) -* [开发手册](dev-guide.md) +## Micro-service注册 +```bash +curl -X POST \ + http://127.0.0.1:30100/registry/v3/microservices \ + -H 'content-type: application/json' \ + -H 'x-domain-name: default' \ + -d '{ + "service": + { + "appId": "default", + "serviceName": "DemoService", + "version":"1.0.0" + } +}' +``` +这时候你可以额获取'DemoService'的ID,如下: -* [集群方式部署](sc-cluster.md) +```json +{ + "serviceId": "a3fae679211211e8a831286ed488fc1b" +} +``` -* [TLS部署](security-tls.md) +## 实例注册 + +标记micro-service ID并调用实例注册API,根据Service CeCube定义:一个进程应该注册一个实例。 + +```bash +curl -X POST \ + http://127.0.0.1:30100/registry/v3/microservices/a3fae679211211e8a831286ed488fc1b/instances \ + -H 'content-type: application/json' \ + -H 'x-domain-name: default' \ + -d '{ + "instance": + { + "hostName":"demo-pc", + "endpoints": [ + "rest://127.0.0.1:8080" + ] + } +}' +``` + +响应成功如下: + +```json +{ + "instanceId": "288ad703211311e8a831286ed488fc1b" +} +``` + +如果全部成功,意味着你已经完成微服务的注册于实例的发布。 + +## 服务发现 + +下一步是根据服务名称和版本规则的微服务实例发现。 + +```bash +curl -X GET \ + 'http://127.0.0.1:30100/registry/v3/instances?appId=default&serviceName=DemoService&version=latest' \ + -H 'content-type: application/json' \ + -H 'x-consumerid: a3fae679211211e8a831286ed488fc1b' \ + -H 'x-domain-name: default' +``` + +这里,你可以从响应中获取信息。 + +```json +{ + "instances": [ + { + "instanceId": "b4c9e57f211311e8a831286ed488fc1b", + "serviceId": "a3fae679211211e8a831286ed488fc1b", + "version": "1.0.0", + "hostName": "demo-pc", + "endpoints": [ + "rest://127.0.0.1:8080" + ], + "status": "UP", + "healthCheck": { + "mode": "push", + "interval": 30, + "times": 3 + }, + "timestamp": "1520322915", + "modTimestamp": "1520322915" + } + ] +} +``` \ No newline at end of file diff --git a/service-center-reference/zh_CN/SUMMARY.md b/service-center-reference/zh_CN/SUMMARY.md index 19d6864..2fd6e28 100644 --- a/service-center-reference/zh_CN/SUMMARY.md +++ b/service-center-reference/zh_CN/SUMMARY.md @@ -1,9 +1,94 @@ -## 目录 +# 开发指南 -* [设计原理](design-zh.md) +这个章节是关于如何基于实现微服务发现功能,你可以找到更多细节 [here](/server/core/swagger/v3.yaml) -* [开发手册](dev-guide.md) +## Micro-service注册 +```bash +curl -X POST \ + http://127.0.0.1:30100/registry/v3/microservices \ + -H 'content-type: application/json' \ + -H 'x-domain-name: default' \ + -d '{ + "service": + { + "appId": "default", + "serviceName": "DemoService", + "version":"1.0.0" + } +}' +``` +这时候你可以额获取'DemoService'的ID,如下: -* [集群方式部署](sc-cluster.md) +```json +{ + "serviceId": "a3fae679211211e8a831286ed488fc1b" +} +``` -* [TLS部署](security-tls.md) +## 实例注册 + +标记micro-service ID并调用实例注册API,根据Service CeCube定义:一个进程应该注册一个实例。 + +```bash +curl -X POST \ + http://127.0.0.1:30100/registry/v3/microservices/a3fae679211211e8a831286ed488fc1b/instances \ + -H 'content-type: application/json' \ + -H 'x-domain-name: default' \ + -d '{ + "instance": + { + "hostName":"demo-pc", + "endpoints": [ + "rest://127.0.0.1:8080" + ] + } +}' +``` + +响应成功如下: + +```json +{ + "instanceId": "288ad703211311e8a831286ed488fc1b" +} +``` + +如果全部成功,意味着你已经完成微服务的注册于实例的发布。 + +## 服务发现 + +下一步是根据服务名称和版本规则的微服务实例发现。 + +```bash +curl -X GET \ + 'http://127.0.0.1:30100/registry/v3/instances?appId=default&serviceName=DemoService&version=latest' \ + -H 'content-type: application/json' \ + -H 'x-consumerid: a3fae679211211e8a831286ed488fc1b' \ + -H 'x-domain-name: default' +``` + +这里,你可以从响应中获取信息。 + +```json +{ + "instances": [ + { + "instanceId": "b4c9e57f211311e8a831286ed488fc1b", + "serviceId": "a3fae679211211e8a831286ed488fc1b", + "version": "1.0.0", + "hostName": "demo-pc", + "endpoints": [ + "rest://127.0.0.1:8080" + ], + "status": "UP", + "healthCheck": { + "mode": "push", + "interval": 30, + "times": 3 + }, + "timestamp": "1520322915", + "modTimestamp": "1520322915" + } + ] +} +``` \ No newline at end of file ---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
