├── .gitattributes ├── .github ├── stale.yml └── workflows │ └── maven.yml ├── .gitignore ├── LICENSE ├── README.md ├── discovery-guide-console ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── nepxion │ │ └── discovery │ │ └── guide │ │ └── console │ │ └── DiscoveryGuideConsole.java │ └── resources │ ├── bootstrap.properties │ └── logback.xml ├── discovery-guide-gateway ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── nepxion │ │ └── discovery │ │ └── guide │ │ └── gateway │ │ └── DiscoveryGuideGateway.java │ └── resources │ ├── bootstrap.properties │ └── logback.xml ├── discovery-guide-service ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── nepxion │ │ └── discovery │ │ └── guide │ │ └── service │ │ ├── DiscoveryGuideServiceA1.java │ │ ├── DiscoveryGuideServiceA2.java │ │ ├── DiscoveryGuideServiceB1.java │ │ ├── DiscoveryGuideServiceB2.java │ │ ├── core │ │ └── CoreImpl.java │ │ ├── feign │ │ ├── AFeign.java │ │ ├── AFeignImpl.java │ │ ├── BFeign.java │ │ └── BFeignImpl.java │ │ └── rest │ │ ├── ARestImpl.java │ │ └── BRestImpl.java │ └── resources │ ├── application-a1.properties │ ├── application-a2.properties │ ├── application-b1.properties │ ├── application-b2.properties │ ├── bootstrap.properties │ └── logback.xml ├── discovery-guide-zuul ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── nepxion │ │ └── discovery │ │ └── guide │ │ └── zuul │ │ └── DiscoveryGuideZuul.java │ └── resources │ ├── bootstrap.properties │ └── logback.xml ├── pmd.xml ├── pom.xml └── postman.json /.gitattributes: -------------------------------------------------------------------------------- 1 | # Declare files that will always have UNIX line endings on checkout. 2 | *.sh text eol=lf -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # General configuration 2 | # Number of days of inactivity before an issue becomes stale 3 | daysUntilStale: 60 4 | # Issues with these labels will never be considered stale 5 | exemptLabels: 6 | - good first issue 7 | - contribution welcome 8 | - bug 9 | - discussion 10 | - enhancement 11 | - feature 12 | - feature request 13 | - help wanted 14 | - info 15 | - need investigation 16 | - tips 17 | 18 | # Set to true to ignore issues in a project (defaults to false) 19 | exemptProjects: true 20 | # Set to true to ignore issues in a milestone (defaults to false) 21 | exemptMilestones: true 22 | # Set to true to ignore issues with an assignee (defaults to false) 23 | exemptAssignees: true 24 | # Label to use when marking an issue as stale 25 | staleLabel: stale 26 | 27 | # Pull request specific configuration 28 | pulls: 29 | # Number of days of inactivity before a stale Issue or Pull Request is closed. 30 | # Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. 31 | daysUntilClose: 30 32 | # Comment to post when marking as stale. Set to `false` to disable 33 | markComment: > 34 | This pull request has been automatically marked as stale because it has not had activity 35 | in the last 90 days. It will be closed in 30 days if no further activity occurs. Please 36 | feel free to give a status update now, ping for review, or re-open when it's ready. 37 | Thank you for your contributions! 38 | # Comment to post when closing a stale Issue or Pull Request. 39 | closeComment: > 40 | This pull request has been automatically closed because it has not had 41 | activity in the last 30 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. 42 | Thank you for your contributions! 43 | # Limit the number of actions per hour, from 1-30. Default is 30 44 | limitPerRun: 1 45 | 46 | # Issue specific configuration 47 | issues: 48 | # Number of days of inactivity before a stale Issue or Pull Request is closed. 49 | daysUntilClose: 14 50 | # Comment to post when marking as stale. Set to `false` to disable 51 | markComment: > 52 | This issue has been automatically marked as stale because it has not had activity in the 53 | last 90 days. It will be closed in 14 days unless it is tagged "help wanted" or other activity 54 | occurs. Thank you for your contributions. 55 | # Comment to post when closing a stale Issue or Pull Request. 56 | closeComment: > 57 | This issue has been automatically closed because it has not had activity in the 58 | last 14 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". 59 | Thank you for your contributions. 60 | # Limit the number of actions per hour, from 1-30. Default is 30 61 | limitPerRun: 1 -------------------------------------------------------------------------------- /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven 3 | 4 | name: build 5 | 6 | on: 7 | push: 8 | branches: [ 6.x.x-simple ] 9 | pull_request: 10 | branches: [ 6.x.x-simple ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Set up JDK 8 20 | uses: actions/setup-java@v2 21 | with: 22 | java-version: '8' 23 | distribution: 'adopt' 24 | - name: Build with Maven 25 | run: mvn -B package --file pom.xml -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | .classpath 4 | .springBeans 5 | .factorypath 6 | # Mobile Tools for Java (J2ME) 7 | .mtj.tmp/ 8 | 9 | *.class 10 | *.classpath 11 | *.project 12 | *.springBeans 13 | bin/ 14 | log/ 15 | test-output/ 16 | 17 | # Package Files # 18 | *.jar 19 | *.war 20 | *.ear 21 | *.zip 22 | *.tar.gz 23 | *.rar 24 | *.swp 25 | *.log 26 | *.ctxt 27 | # nodejs local modules 28 | .tags* 29 | .idea/ 30 | *.iml 31 | .gradle/ 32 | .settings/ 33 | target/ 34 | hs_err_pid* -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](https://nepxion.github.io/Discovery/docs/discovery-doc/Banner.png) 2 | 3 | # Discovery【探索】云原生微服务解决方案 4 | ![Total visits](https://visitor-badge.laobi.icu/badge?page_id=Nepxion&title=total%20visits) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?label=license)](https://github.com/Nepxion/Discovery/blob/6.x.x/LICENSE) [![Maven Central](https://img.shields.io/maven-central/v/com.nepxion/discovery.svg?label=maven)](https://search.maven.org/artifact/com.nepxion/discovery) [![Javadocs](http://www.javadoc.io/badge/com.nepxion/discovery-plugin-framework-starter.svg)](http://www.javadoc.io/doc/com.nepxion/discovery-plugin-framework-starter) [![Build Status](https://github.com/Nepxion/Discovery/workflows/build/badge.svg)](https://github.com/Nepxion/Discovery/actions) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/5c42eb719ef64def9cad773abd877e8b)](https://www.codacy.com/gh/Nepxion/Discovery/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Nepxion/Discovery&utm_campaign=Badge_Grade) [![Stars](https://img.shields.io/github/stars/Nepxion/Discovery.svg?label=Stars&style=flat&logo=GitHub)](https://github.com/Nepxion/Discovery/stargazers) [![Stars](https://gitee.com/Nepxion/Discovery/badge/star.svg?theme=gvp)](https://gitee.com/Nepxion/Discovery/stargazers) 5 | 6 | [![Wiki](https://badgen.net/badge/icon/wiki?icon=wiki&label=GitHub)](https://github.com/Nepxion/Discovery/wiki) [![Wiki](https://badgen.net/badge/icon/wiki?icon=wiki&label=Gitee)](https://gitee.com/nepxion/Discovery/wikis/pages?sort_id=3993615&doc_id=1124387) [![Discovery PPT](https://img.shields.io/badge/Discovery%20-ppt-brightgreen?logo=Microsoft%20PowerPoint)](https://nepxion.github.io/Discovery/docs/link-doc/discovery-ppt.html) [![Discovery Page](https://img.shields.io/badge/Discovery%20-page-brightgreen?logo=Microsoft%20Edge)](https://nepxion.github.io/Discovery/) [![Discovery Platform Page](https://img.shields.io/badge/Discovery%20Platform%20-page-brightgreen?logo=Microsoft%20Edge)](https://nepxion.github.io/DiscoveryPlatform) [![Discovery Desktop Page](https://img.shields.io/badge/Discovery%20Desktop%20-page-brightgreen?logo=Microsoft%20Edge)](https://nepxion.github.io/DiscoveryDesktop) [![Polaris Page](https://img.shields.io/badge/Polaris%20-page-brightgreen?logo=Microsoft%20Edge)](https://polaris-paas.github.io/polaris-wiki) 7 | 8 |             9 | 10 | 如果您觉得本框架具有一定的参考价值和借鉴意义,请帮忙在页面右上角 [**Star**] 11 | 12 | ## 入门必读 13 | 本文只介绍入门Discovery【探索】最基础的功能和用法,更多资料请参考相关文档 14 | 15 | ### 快速上手 16 | [如何快速搭建和运行示例](https://github.com/Nepxion/Discovery/wiki/如何快速搭建和运行示例) 17 | 18 | ### 解决方案 19 | 配置较简单,灵活性不强,适用于DevOps运维能力较弱的公司
20 | [如何执行全链路简单蓝绿发布](https://github.com/Nepxion/Discovery/wiki/如何执行全链路简单蓝绿发布)
21 | [如何执行全链路简单灰度发布](https://github.com/Nepxion/Discovery/wiki/如何执行全链路简单灰度发布)

22 | 配置较复杂,灵活性较强,适用于DevOps运维能力较弱的公司
23 | [如何执行全链路高级蓝绿发布](https://github.com/Nepxion/Discovery/wiki/如何执行全链路高级蓝绿发布)
24 | [如何执行全链路高级灰度发布](https://github.com/Nepxion/Discovery/wiki/如何执行全链路高级灰度发布)

25 | 配置很简单,灵活性较弱,适用于DevOps运维能力较弱的公司
26 | [如何执行全链路无编排高级蓝绿灰度发布](https://github.com/Nepxion/Discovery/wiki/如何执行全链路无编排高级蓝绿灰度发布)

27 | 界面驱动,配置很简单,灵活性很强,流程化管理,落地成本较高,需自行研发界面整合到DevOps运维系统中,适用于DevOps运维能力较强的公司
28 | [如何执行全链路智能编排高级蓝绿灰度发布](https://github.com/Nepxion/Discovery/wiki/如何执行全链路智能编排高级蓝绿灰度发布)
29 | [如何设计全链路智能编排高级蓝绿灰度发布界面](https://github.com/Nepxion/Discovery/wiki/如何设计全链路智能编排高级蓝绿灰度发布界面) 30 | 31 | ### 快速集成 32 | [如何快速集成框架](https://github.com/Nepxion/Discovery/wiki/如何快速集成框架) 33 | 34 | ### 流量染色 35 | 通过增加启动参数`-Dmetadata.version=1.0`进行染色
36 | [如何设置元数据标签](https://github.com/Nepxion/Discovery/wiki/如何设置元数据标签)

37 | 通过`git-commit-id-plugin`插件代替启动参数进行染色
38 | [如何基于Git插件自动创建版本号](https://github.com/Nepxion/Discovery/wiki/如何基于Git插件自动创建版本号)

39 | 通过截取统一规范的服务名前缀进行组染色
40 | [如何基于服务名前缀自动创建组名](https://github.com/Nepxion/Discovery/wiki/如何基于服务名前缀自动创建组名) 41 | 42 | ### 故障定位 43 | 开启Debug模式,通过增加启动参数`-Dstrategy.debug=true`启动所有的网关和服务
44 | [如何解决蓝绿灰度发布失效问题](https://github.com/Nepxion/Discovery/wiki/如何解决蓝绿灰度发布失效问题) 45 | 46 | ### 异步探针 47 | 开启异步探针,通过增加启动参数`-javaagent:C:/opt/discovery-agent/discovery-agent-starter-1.3.0.jar`启动所有的网关和服务,`C:/opt`需要变更为具体使用场景下的目录。Spring Cloud 2020及以上版本必须引入异步探针
48 | [如何在异步场景下使用探针Agent](https://github.com/Nepxion/Discovery/wiki/如何在异步场景下使用探针Agent) 49 | 50 | ### 自动化测试 51 | 开发环境和测试环境下的全方位自动化测试
52 | [如何执行全链路自动化模拟流程测试](https://github.com/Nepxion/Discovery/wiki/如何执行全链路自动化模拟流程测试)

53 | 生产环境下的自动化测试
54 | [如何执行全链路自动化流量侦测测试](https://github.com/Nepxion/Discovery/wiki/如何执行全链路自动化流量侦测测试) 55 | 56 | ## 请联系我 57 | 微信、钉钉、公众号和文档 58 | 59 | ![](https://nepxion.github.io/Discovery/docs/contact-doc/wechat-1.jpg)![](https://nepxion.github.io/Discovery/docs/contact-doc/dingding-1.jpg)![](https://nepxion.github.io/Discovery/docs/contact-doc/gongzhonghao-1.jpg)![](https://nepxion.github.io/Discovery/docs/contact-doc/document-1.jpg) 60 | 61 | ## Star走势图 62 | [![Stargazers over time](https://starchart.cc/Nepxion/Discovery.svg)](https://starchart.cc/Nepxion/Discovery) -------------------------------------------------------------------------------- /discovery-guide-console/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | discovery-guide-console 5 | Nepxion Discovery Guide Console 6 | jar 7 | 4.0.0 8 | 9 | 10 | com.nepxion 11 | discovery-guide 12 | 1.0.0 13 | 14 | 15 | 16 | 17 | 18 | com.alibaba.cloud 19 | spring-cloud-starter-alibaba-nacos-discovery 20 | 21 | 22 | 23 | 24 | com.nepxion 25 | discovery-console-starter-nacos 26 | 27 | 28 | -------------------------------------------------------------------------------- /discovery-guide-console/src/main/java/com/nepxion/discovery/guide/console/DiscoveryGuideConsole.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.discovery.guide.console; 2 | 3 | /** 4 | *

Title: Nepxion Discovery

5 | *

Description: Nepxion Discovery

6 | *

Copyright: Copyright (c) 2017-2050

7 | *

Company: Nepxion

8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.springframework.boot.autoconfigure.SpringBootApplication; 13 | import org.springframework.boot.builder.SpringApplicationBuilder; 14 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 15 | 16 | @SpringBootApplication 17 | @EnableDiscoveryClient 18 | public class DiscoveryGuideConsole { 19 | public static void main(String[] args) { 20 | new SpringApplicationBuilder(DiscoveryGuideConsole.class).run(args); 21 | } 22 | } -------------------------------------------------------------------------------- /discovery-guide-console/src/main/resources/bootstrap.properties: -------------------------------------------------------------------------------- 1 | # Spring cloud config 2 | spring.application.name=discovery-guide-console 3 | server.port=6001 4 | 5 | # Nacos config for discovery 6 | spring.cloud.nacos.discovery.server-addr=localhost:8848 7 | 8 | # Nacos config for rule 9 | spring.cloud.nacos.config.server-addr=localhost:8848 10 | 11 | # Ribbon config 12 | ribbon.ServerListRefreshInterval=5000 13 | ribbon.ConnectTimeout=60000 14 | ribbon.ReadTimeout=60000 15 | ribbon.maxAutoRetries=3 16 | ribbon.maxAutoRetriesNextServer=3 17 | ribbon.okToRetryOnAllOperations=true 18 | 19 | # 精简教程,请访问 20 | # https://github.com/Nepxion/Discovery/wiki 21 | # https://gitee.com/nepxion/Discovery/wikis 22 | # 详细教程,请访问 23 | # http://nepxion.com/discovery/ 24 | -------------------------------------------------------------------------------- /discovery-guide-console/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | %d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${PID:- } --- [%15.15t] %-40.40logger{39} : %msg%n 8 | 9 | UTF-8 10 | 11 | 12 | log/discovery-%d{yyyy-MM-dd}.%i.log 13 | 50MB 14 | 15 | 16 | INFO 17 | 18 | 19 | true 20 | 21 | 22 | 23 | 0 24 | 512 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | %d{yyyy-MM-dd HH:mm:ss.SSS} %levelColor(%5p) %magenta(${PID:- }) --- [%15.15t] %cyan(%-40.40logger{39}) : %msg%n 34 | 35 | 36 | 37 | INFO 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /discovery-guide-gateway/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | discovery-guide-gateway 5 | Nepxion Discovery Guide Gateway 6 | jar 7 | 4.0.0 8 | 9 | 10 | com.nepxion 11 | discovery-guide 12 | 1.0.0 13 | 14 | 15 | 16 | 17 | 18 | com.nepxion 19 | discovery-plugin-register-center-starter-nacos 20 | 21 | 22 | 23 | 24 | com.nepxion 25 | discovery-plugin-config-center-starter-nacos 26 | 27 | 28 | 29 | 30 | com.nepxion 31 | discovery-plugin-admin-center-starter 32 | 33 | 34 | 35 | 36 | com.nepxion 37 | discovery-plugin-strategy-starter-gateway 38 | 39 | 40 | -------------------------------------------------------------------------------- /discovery-guide-gateway/src/main/java/com/nepxion/discovery/guide/gateway/DiscoveryGuideGateway.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.discovery.guide.gateway; 2 | 3 | /** 4 | *

Title: Nepxion Discovery

5 | *

Description: Nepxion Discovery

6 | *

Copyright: Copyright (c) 2017-2050

7 | *

Company: Nepxion

8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.springframework.boot.autoconfigure.SpringBootApplication; 13 | import org.springframework.boot.builder.SpringApplicationBuilder; 14 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 15 | 16 | @SpringBootApplication 17 | @EnableDiscoveryClient 18 | public class DiscoveryGuideGateway { 19 | public static void main(String[] args) { 20 | new SpringApplicationBuilder(DiscoveryGuideGateway.class).run(args); 21 | } 22 | } -------------------------------------------------------------------------------- /discovery-guide-gateway/src/main/resources/bootstrap.properties: -------------------------------------------------------------------------------- 1 | # Spring cloud config 2 | spring.application.name=discovery-guide-gateway 3 | server.port=5001 4 | 5 | # Nacos config for discovery 6 | spring.cloud.nacos.discovery.server-addr=localhost:8848 7 | 8 | # Nacos config for rule 9 | spring.cloud.nacos.config.server-addr=localhost:8848 10 | 11 | # Spring cloud discovery metadata config 12 | spring.cloud.discovery.metadata.group=discovery-guide-group 13 | 14 | # Nepxion discovery config 15 | # 当外界传值Header的时候,网关也设置并传递同名的Header,需要决定哪个Header传递到后边的服务去。如果下面开关为true,以网关设置为优先,否则以外界传值为优先。缺失则默认为true 16 | spring.application.strategy.gateway.header.priority=false 17 | # 当以网关设置为优先的时候,网关未配置Header,而外界配置了Header,仍旧忽略外界的Header。缺失则默认为true 18 | # spring.application.strategy.gateway.original.header.ignored=true 19 | # 开启和关闭网关订阅配置中心的动态路由策略。缺失则默认为false 20 | spring.application.strategy.gateway.dynamic.route.enabled=true 21 | 22 | # Ribbon config 23 | ribbon.ServerListRefreshInterval=5000 24 | ribbon.ConnectTimeout=60000 25 | ribbon.ReadTimeout=60000 26 | ribbon.maxAutoRetries=3 27 | ribbon.maxAutoRetriesNextServer=3 28 | ribbon.okToRetryOnAllOperations=true 29 | 30 | # Spring cloud gateway config 31 | # 手工配置路由 32 | spring.cloud.gateway.routes[0].id=route0 33 | spring.cloud.gateway.routes[0].predicates[0]=Path=/discovery-guide-service-a/** 34 | spring.cloud.gateway.routes[0].filters[0]=StripPrefix=1 35 | spring.cloud.gateway.routes[0].uri=lb://discovery-guide-service-a 36 | 37 | # 注册发现自动路由 38 | # 开启和关闭自动路由。缺失则默认关闭自动路由 39 | # spring.cloud.gateway.discovery.locator.enabled=true 40 | # 当启动自动路由(locator.enabled=true)时候,必须关闭reactive模式,否则无法执行蓝绿灰度发布。只有H版需要该配置 41 | # spring.cloud.discovery.reactive.enabled=false 42 | 43 | # 精简教程,请访问 44 | # https://github.com/Nepxion/Discovery/wiki 45 | # https://gitee.com/nepxion/Discovery/wikis 46 | # 详细教程,请访问 47 | # http://nepxion.com/discovery/ 48 | -------------------------------------------------------------------------------- /discovery-guide-gateway/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | %d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${PID:- } --- [%15.15t] %X{n-d-service-version} %X{n-d-service-region} %X{n-d-service-env} %X{n-d-service-zone} %-40.40logger{39} : %msg%n 8 | 9 | UTF-8 10 | 11 | 12 | log/discovery-%d{yyyy-MM-dd}.%i.log 13 | 50MB 14 | 15 | 16 | INFO 17 | 18 | 19 | true 20 | 21 | 22 | 23 | 0 24 | 512 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | %d{yyyy-MM-dd HH:mm:ss.SSS} %levelColor(%5p) %magenta(${PID:- }) --- [%15.15t] %levelColor(%X{n-d-service-version}) %levelColor(%X{n-d-service-region}) %levelColor(%X{n-d-service-env}) %levelColor(%X{n-d-service-zone}) %cyan(%-40.40logger{39}) : %msg%n 34 | 35 | 36 | 37 | INFO 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /discovery-guide-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | discovery-guide-service 5 | Nepxion Discovery Guide Service 6 | jar 7 | 4.0.0 8 | 9 | 10 | com.nepxion 11 | discovery-guide 12 | 1.0.0 13 | 14 | 15 | 16 | 17 | 18 | com.nepxion 19 | discovery-plugin-register-center-starter-nacos 20 | 21 | 22 | 23 | 24 | com.nepxion 25 | discovery-plugin-config-center-starter-nacos 26 | 27 | 28 | 29 | 30 | com.nepxion 31 | discovery-plugin-admin-center-starter 32 | 33 | 34 | 35 | 36 | com.nepxion 37 | discovery-plugin-strategy-starter-service 38 | 39 | 40 | -------------------------------------------------------------------------------- /discovery-guide-service/src/main/java/com/nepxion/discovery/guide/service/DiscoveryGuideServiceA1.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.discovery.guide.service; 2 | 3 | /** 4 | *

Title: Nepxion Discovery

5 | *

Description: Nepxion Discovery

6 | *

Copyright: Copyright (c) 2017-2050

7 | *

Company: Nepxion

8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.springframework.boot.autoconfigure.SpringBootApplication; 13 | import org.springframework.boot.builder.SpringApplicationBuilder; 14 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 15 | import org.springframework.cloud.client.loadbalancer.LoadBalanced; 16 | import org.springframework.cloud.openfeign.EnableFeignClients; 17 | import org.springframework.context.annotation.Bean; 18 | import org.springframework.web.client.RestTemplate; 19 | 20 | @SpringBootApplication 21 | @EnableDiscoveryClient 22 | @EnableFeignClients 23 | public class DiscoveryGuideServiceA1 { 24 | public static void main(String[] args) { 25 | System.setProperty("spring.profiles.active", "a1"); 26 | 27 | new SpringApplicationBuilder(DiscoveryGuideServiceA1.class).run(args); 28 | } 29 | 30 | @Bean 31 | @LoadBalanced 32 | public RestTemplate restTemplate() { 33 | return new RestTemplate(); 34 | } 35 | } -------------------------------------------------------------------------------- /discovery-guide-service/src/main/java/com/nepxion/discovery/guide/service/DiscoveryGuideServiceA2.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.discovery.guide.service; 2 | 3 | /** 4 | *

Title: Nepxion Discovery

5 | *

Description: Nepxion Discovery

6 | *

Copyright: Copyright (c) 2017-2050

7 | *

Company: Nepxion

8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.springframework.boot.autoconfigure.SpringBootApplication; 13 | import org.springframework.boot.builder.SpringApplicationBuilder; 14 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 15 | import org.springframework.cloud.openfeign.EnableFeignClients; 16 | 17 | @SpringBootApplication 18 | @EnableDiscoveryClient 19 | @EnableFeignClients 20 | public class DiscoveryGuideServiceA2 { 21 | public static void main(String[] args) { 22 | System.setProperty("spring.profiles.active", "a2"); 23 | 24 | new SpringApplicationBuilder(DiscoveryGuideServiceA2.class).run(args); 25 | } 26 | } -------------------------------------------------------------------------------- /discovery-guide-service/src/main/java/com/nepxion/discovery/guide/service/DiscoveryGuideServiceB1.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.discovery.guide.service; 2 | 3 | /** 4 | *

Title: Nepxion Discovery

5 | *

Description: Nepxion Discovery

6 | *

Copyright: Copyright (c) 2017-2050

7 | *

Company: Nepxion

8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.springframework.boot.autoconfigure.SpringBootApplication; 13 | import org.springframework.boot.builder.SpringApplicationBuilder; 14 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 15 | import org.springframework.cloud.openfeign.EnableFeignClients; 16 | 17 | @SpringBootApplication 18 | @EnableDiscoveryClient 19 | @EnableFeignClients 20 | public class DiscoveryGuideServiceB1 { 21 | public static void main(String[] args) { 22 | System.setProperty("spring.profiles.active", "b1"); 23 | 24 | new SpringApplicationBuilder(DiscoveryGuideServiceB1.class).run(args); 25 | } 26 | } -------------------------------------------------------------------------------- /discovery-guide-service/src/main/java/com/nepxion/discovery/guide/service/DiscoveryGuideServiceB2.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.discovery.guide.service; 2 | 3 | /** 4 | *

Title: Nepxion Discovery

5 | *

Description: Nepxion Discovery

6 | *

Copyright: Copyright (c) 2017-2050

7 | *

Company: Nepxion

8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.springframework.boot.autoconfigure.SpringBootApplication; 13 | import org.springframework.boot.builder.SpringApplicationBuilder; 14 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 15 | import org.springframework.cloud.openfeign.EnableFeignClients; 16 | 17 | @SpringBootApplication 18 | @EnableDiscoveryClient 19 | @EnableFeignClients 20 | public class DiscoveryGuideServiceB2 { 21 | public static void main(String[] args) { 22 | System.setProperty("spring.profiles.active", "b2"); 23 | 24 | new SpringApplicationBuilder(DiscoveryGuideServiceB2.class).run(args); 25 | } 26 | } -------------------------------------------------------------------------------- /discovery-guide-service/src/main/java/com/nepxion/discovery/guide/service/core/CoreImpl.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.discovery.guide.service.core; 2 | 3 | /** 4 | *

Title: Nepxion Discovery

5 | *

Description: Nepxion Discovery

6 | *

Copyright: Copyright (c) 2017-2050

7 | *

Company: Nepxion

8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | 14 | import com.nepxion.discovery.plugin.framework.adapter.PluginAdapter; 15 | 16 | public class CoreImpl { 17 | @Autowired 18 | private PluginAdapter pluginAdapter; 19 | 20 | public String getPluginInfo(String value) { 21 | return pluginAdapter.getPluginInfo(value); 22 | } 23 | } -------------------------------------------------------------------------------- /discovery-guide-service/src/main/java/com/nepxion/discovery/guide/service/feign/AFeign.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.discovery.guide.service.feign; 2 | 3 | /** 4 | *

Title: Nepxion Discovery

5 | *

Description: Nepxion Discovery

6 | *

Copyright: Copyright (c) 2017-2050

7 | *

Company: Nepxion

8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.springframework.cloud.openfeign.FeignClient; 13 | import org.springframework.web.bind.annotation.GetMapping; 14 | import org.springframework.web.bind.annotation.PathVariable; 15 | 16 | @FeignClient(value = "discovery-guide-service-a") 17 | public interface AFeign { 18 | @GetMapping(path = "/invoke/{value}") 19 | String invoke(@PathVariable(value = "value") String value); 20 | } -------------------------------------------------------------------------------- /discovery-guide-service/src/main/java/com/nepxion/discovery/guide/service/feign/AFeignImpl.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.discovery.guide.service.feign; 2 | 3 | /** 4 | *

Title: Nepxion Discovery

5 | *

Description: Nepxion Discovery

6 | *

Copyright: Copyright (c) 2017-2050

7 | *

Company: Nepxion

8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.slf4j.Logger; 13 | import org.slf4j.LoggerFactory; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 16 | import org.springframework.web.bind.annotation.PathVariable; 17 | import org.springframework.web.bind.annotation.RestController; 18 | 19 | import com.nepxion.discovery.common.constant.DiscoveryConstant; 20 | import com.nepxion.discovery.guide.service.core.CoreImpl; 21 | 22 | @RestController 23 | @ConditionalOnProperty(name = DiscoveryConstant.SPRING_APPLICATION_NAME, havingValue = "discovery-guide-service-a") 24 | public class AFeignImpl extends CoreImpl implements AFeign { 25 | private static final Logger LOG = LoggerFactory.getLogger(AFeignImpl.class); 26 | 27 | @Autowired 28 | private BFeign bFeign; 29 | 30 | @Override 31 | public String invoke(@PathVariable(value = "value") String value) { 32 | value = getPluginInfo(value); 33 | value = bFeign.invoke(value); 34 | 35 | LOG.info("调用路径:{}", value); 36 | 37 | return value; 38 | } 39 | } -------------------------------------------------------------------------------- /discovery-guide-service/src/main/java/com/nepxion/discovery/guide/service/feign/BFeign.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.discovery.guide.service.feign; 2 | 3 | /** 4 | *

Title: Nepxion Discovery

5 | *

Description: Nepxion Discovery

6 | *

Copyright: Copyright (c) 2017-2050

7 | *

Company: Nepxion

8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.springframework.cloud.openfeign.FeignClient; 13 | import org.springframework.web.bind.annotation.GetMapping; 14 | import org.springframework.web.bind.annotation.PathVariable; 15 | 16 | @FeignClient(value = "discovery-guide-service-b") 17 | public interface BFeign { 18 | @GetMapping(path = "/invoke/{value}") 19 | String invoke(@PathVariable(value = "value") String value); 20 | } -------------------------------------------------------------------------------- /discovery-guide-service/src/main/java/com/nepxion/discovery/guide/service/feign/BFeignImpl.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.discovery.guide.service.feign; 2 | 3 | /** 4 | *

Title: Nepxion Discovery

5 | *

Description: Nepxion Discovery

6 | *

Copyright: Copyright (c) 2017-2050

7 | *

Company: Nepxion

8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.slf4j.Logger; 13 | import org.slf4j.LoggerFactory; 14 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 15 | import org.springframework.web.bind.annotation.PathVariable; 16 | import org.springframework.web.bind.annotation.RestController; 17 | 18 | import com.nepxion.discovery.common.constant.DiscoveryConstant; 19 | import com.nepxion.discovery.guide.service.core.CoreImpl; 20 | 21 | @RestController 22 | @ConditionalOnProperty(name = DiscoveryConstant.SPRING_APPLICATION_NAME, havingValue = "discovery-guide-service-b") 23 | public class BFeignImpl extends CoreImpl implements BFeign { 24 | private static final Logger LOG = LoggerFactory.getLogger(BFeignImpl.class); 25 | 26 | @Override 27 | public String invoke(@PathVariable(value = "value") String value) { 28 | value = getPluginInfo(value); 29 | 30 | LOG.info("调用路径:{}", value); 31 | 32 | return value; 33 | } 34 | } -------------------------------------------------------------------------------- /discovery-guide-service/src/main/java/com/nepxion/discovery/guide/service/rest/ARestImpl.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.discovery.guide.service.rest; 2 | 3 | /** 4 | *

Title: Nepxion Discovery

5 | *

Description: Nepxion Discovery

6 | *

Copyright: Copyright (c) 2017-2050

7 | *

Company: Nepxion

8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.slf4j.Logger; 13 | import org.slf4j.LoggerFactory; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 16 | import org.springframework.web.bind.annotation.GetMapping; 17 | import org.springframework.web.bind.annotation.PathVariable; 18 | import org.springframework.web.bind.annotation.RestController; 19 | import org.springframework.web.client.RestTemplate; 20 | 21 | import com.nepxion.discovery.common.constant.DiscoveryConstant; 22 | import com.nepxion.discovery.guide.service.core.CoreImpl; 23 | 24 | @RestController 25 | @ConditionalOnProperty(name = DiscoveryConstant.SPRING_APPLICATION_NAME, havingValue = "discovery-guide-service-a") 26 | public class ARestImpl extends CoreImpl { 27 | private static final Logger LOG = LoggerFactory.getLogger(ARestImpl.class); 28 | 29 | @Autowired 30 | private RestTemplate restTemplate; 31 | 32 | @GetMapping(path = "/rest/{value}") 33 | public String rest(@PathVariable(value = "value") String value) { 34 | value = getPluginInfo(value); 35 | value = restTemplate.getForEntity("http://discovery-guide-service-b/rest/" + value, String.class).getBody(); 36 | 37 | LOG.info("调用路径:{}", value); 38 | 39 | return value; 40 | } 41 | } -------------------------------------------------------------------------------- /discovery-guide-service/src/main/java/com/nepxion/discovery/guide/service/rest/BRestImpl.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.discovery.guide.service.rest; 2 | 3 | /** 4 | *

Title: Nepxion Discovery

5 | *

Description: Nepxion Discovery

6 | *

Copyright: Copyright (c) 2017-2050

7 | *

Company: Nepxion

8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.slf4j.Logger; 13 | import org.slf4j.LoggerFactory; 14 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 15 | import org.springframework.web.bind.annotation.GetMapping; 16 | import org.springframework.web.bind.annotation.PathVariable; 17 | import org.springframework.web.bind.annotation.RestController; 18 | 19 | import com.nepxion.discovery.common.constant.DiscoveryConstant; 20 | import com.nepxion.discovery.guide.service.core.CoreImpl; 21 | 22 | @RestController 23 | @ConditionalOnProperty(name = DiscoveryConstant.SPRING_APPLICATION_NAME, havingValue = "discovery-guide-service-b") 24 | public class BRestImpl extends CoreImpl { 25 | private static final Logger LOG = LoggerFactory.getLogger(BRestImpl.class); 26 | 27 | @GetMapping(path = "/rest/{value}") 28 | public String rest(@PathVariable(value = "value") String value) { 29 | value = getPluginInfo(value); 30 | 31 | LOG.info("调用路径:{}", value); 32 | 33 | return value; 34 | } 35 | } -------------------------------------------------------------------------------- /discovery-guide-service/src/main/resources/application-a1.properties: -------------------------------------------------------------------------------- 1 | # Spring cloud config 2 | spring.application.name=discovery-guide-service-a 3 | server.port=3001 4 | 5 | # Spring cloud discovery metadata config 6 | spring.cloud.discovery.metadata.group=discovery-guide-group 7 | spring.cloud.discovery.metadata.version=1.0 8 | spring.cloud.discovery.metadata.region=dev 9 | spring.cloud.discovery.metadata.env=env1 10 | spring.cloud.discovery.metadata.zone=zone1 -------------------------------------------------------------------------------- /discovery-guide-service/src/main/resources/application-a2.properties: -------------------------------------------------------------------------------- 1 | # Spring cloud config 2 | spring.application.name=discovery-guide-service-a 3 | server.port=3002 4 | 5 | # Spring cloud discovery metadata config 6 | spring.cloud.discovery.metadata.group=discovery-guide-group 7 | spring.cloud.discovery.metadata.version=1.1 8 | spring.cloud.discovery.metadata.region=qa 9 | spring.cloud.discovery.metadata.env=common 10 | spring.cloud.discovery.metadata.zone=zone2 -------------------------------------------------------------------------------- /discovery-guide-service/src/main/resources/application-b1.properties: -------------------------------------------------------------------------------- 1 | # Spring cloud config 2 | spring.application.name=discovery-guide-service-b 3 | server.port=4001 4 | 5 | # Spring cloud discovery metadata config 6 | spring.cloud.discovery.metadata.group=discovery-guide-group 7 | spring.cloud.discovery.metadata.version=1.0 8 | spring.cloud.discovery.metadata.region=qa 9 | spring.cloud.discovery.metadata.env=env1 10 | spring.cloud.discovery.metadata.zone=zone1 -------------------------------------------------------------------------------- /discovery-guide-service/src/main/resources/application-b2.properties: -------------------------------------------------------------------------------- 1 | # Spring cloud config 2 | spring.application.name=discovery-guide-service-b 3 | server.port=4002 4 | 5 | # Spring cloud discovery metadata config 6 | spring.cloud.discovery.metadata.group=discovery-guide-group 7 | spring.cloud.discovery.metadata.version=1.1 8 | spring.cloud.discovery.metadata.region=dev 9 | spring.cloud.discovery.metadata.env=common 10 | spring.cloud.discovery.metadata.zone=zone2 -------------------------------------------------------------------------------- /discovery-guide-service/src/main/resources/bootstrap.properties: -------------------------------------------------------------------------------- 1 | # Nacos config for discovery 2 | spring.cloud.nacos.discovery.server-addr=localhost:8848 3 | 4 | # Nacos config for rule 5 | spring.cloud.nacos.config.server-addr=localhost:8848 6 | 7 | # Feign config 8 | spring.main.allow-bean-definition-overriding=true 9 | 10 | # Nepxion discovery config 11 | # 当外界传值Header的时候,服务也设置并传递同名的Header,需要决定哪个Header传递到后边的服务去。如果下面开关为true,以服务设置为优先,否则以外界传值为优先。缺失则默认为true 12 | # spring.application.strategy.service.header.priority=true 13 | 14 | # Ribbon config 15 | ribbon.ServerListRefreshInterval=5000 16 | ribbon.ConnectTimeout=60000 17 | ribbon.ReadTimeout=60000 18 | ribbon.maxAutoRetries=3 19 | ribbon.maxAutoRetriesNextServer=3 20 | ribbon.okToRetryOnAllOperations=true 21 | 22 | # 精简教程,请访问 23 | # https://github.com/Nepxion/Discovery/wiki 24 | # https://gitee.com/nepxion/Discovery/wikis 25 | # 详细教程,请访问 26 | # http://nepxion.com/discovery/ 27 | -------------------------------------------------------------------------------- /discovery-guide-service/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | %d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${PID:- } --- [%15.15t] %X{n-d-service-version} %X{n-d-service-region} %X{n-d-service-env} %X{n-d-service-zone} %-40.40logger{39} : %msg%n 8 | 9 | UTF-8 10 | 11 | 12 | log/discovery-%d{yyyy-MM-dd}.%i.log 13 | 50MB 14 | 15 | 16 | INFO 17 | 18 | 19 | true 20 | 21 | 22 | 23 | 0 24 | 512 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | %d{yyyy-MM-dd HH:mm:ss.SSS} %levelColor(%5p) %magenta(${PID:- }) --- [%15.15t] %levelColor(%X{n-d-service-version}) %levelColor(%X{n-d-service-region}) %levelColor(%X{n-d-service-env}) %levelColor(%X{n-d-service-zone}) %cyan(%-40.40logger{39}) : %msg%n 34 | 35 | 36 | 37 | INFO 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /discovery-guide-zuul/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | discovery-guide-zuul 5 | Nepxion Discovery Guide Zuul 6 | jar 7 | 4.0.0 8 | 9 | 10 | com.nepxion 11 | discovery-guide 12 | 1.0.0 13 | 14 | 15 | 16 | 17 | 18 | com.nepxion 19 | discovery-plugin-register-center-starter-nacos 20 | 21 | 22 | 23 | 24 | com.nepxion 25 | discovery-plugin-config-center-starter-nacos 26 | 27 | 28 | 29 | 30 | com.nepxion 31 | discovery-plugin-admin-center-starter 32 | 33 | 34 | 35 | 36 | com.nepxion 37 | discovery-plugin-strategy-starter-zuul 38 | 39 | 40 | -------------------------------------------------------------------------------- /discovery-guide-zuul/src/main/java/com/nepxion/discovery/guide/zuul/DiscoveryGuideZuul.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.discovery.guide.zuul; 2 | 3 | /** 4 | *

Title: Nepxion Discovery

5 | *

Description: Nepxion Discovery

6 | *

Copyright: Copyright (c) 2017-2050

7 | *

Company: Nepxion

8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.springframework.boot.autoconfigure.SpringBootApplication; 13 | import org.springframework.boot.builder.SpringApplicationBuilder; 14 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 15 | import org.springframework.cloud.netflix.zuul.EnableZuulProxy; 16 | 17 | @SpringBootApplication 18 | @EnableDiscoveryClient 19 | @EnableZuulProxy 20 | public class DiscoveryGuideZuul { 21 | public static void main(String[] args) { 22 | new SpringApplicationBuilder(DiscoveryGuideZuul.class).run(args); 23 | } 24 | } -------------------------------------------------------------------------------- /discovery-guide-zuul/src/main/resources/bootstrap.properties: -------------------------------------------------------------------------------- 1 | # Spring cloud config 2 | spring.application.name=discovery-guide-zuul 3 | server.port=5002 4 | 5 | # Nacos config for discovery 6 | spring.cloud.nacos.discovery.server-addr=localhost:8848 7 | 8 | # Nacos config for rule 9 | spring.cloud.nacos.config.server-addr=localhost:8848 10 | 11 | # Spring cloud discovery metadata config 12 | spring.cloud.discovery.metadata.group=discovery-guide-group 13 | 14 | # Nepxion discovery config 15 | # 当外界传值Header的时候,网关也设置并传递同名的Header,需要决定哪个Header传递到后边的服务去。如果下面开关为true,以网关设置为优先,否则以外界传值为优先。缺失则默认为true 16 | spring.application.strategy.zuul.header.priority=false 17 | # 当以网关设置为优先的时候,网关未配置Header,而外界配置了Header,仍旧忽略外界的Header。缺失则默认为true 18 | # spring.application.strategy.zuul.original.header.ignored=true 19 | # 开启和关闭网关订阅配置中心的动态路由策略。缺失则默认为false 20 | spring.application.strategy.zuul.dynamic.route.enabled=true 21 | 22 | # Ribbon config 23 | ribbon.ServerListRefreshInterval=5000 24 | ribbon.ConnectTimeout=60000 25 | ribbon.ReadTimeout=60000 26 | ribbon.maxAutoRetries=3 27 | ribbon.maxAutoRetriesNextServer=3 28 | ribbon.okToRetryOnAllOperations=true 29 | 30 | # Zuul config 31 | zuul.host.max-per-route-connections=1000 32 | zuul.host.max-total-connections=1000 33 | zuul.semaphore.max-semaphores=5000 34 | 35 | # 手工配置路由 36 | zuul.routes.route0.path=/discovery-guide-service-a/** 37 | zuul.routes.route0.serviceId=discovery-guide-service-a 38 | 39 | # 注册发现自动路由 40 | # 开启和关闭自动路由。缺失则默认开启自动路由 41 | zuul.ignoredServices=* 42 | 43 | # 精简教程,请访问 44 | # https://github.com/Nepxion/Discovery/wiki 45 | # https://gitee.com/nepxion/Discovery/wikis 46 | # 详细教程,请访问 47 | # http://nepxion.com/discovery/ 48 | -------------------------------------------------------------------------------- /discovery-guide-zuul/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | %d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${PID:- } --- [%15.15t] %X{n-d-service-version} %X{n-d-service-region} %X{n-d-service-env} %X{n-d-service-zone} %-40.40logger{39} : %msg%n 8 | 9 | UTF-8 10 | 11 | 12 | log/discovery-%d{yyyy-MM-dd}.%i.log 13 | 50MB 14 | 15 | 16 | INFO 17 | 18 | 19 | true 20 | 21 | 22 | 23 | 0 24 | 512 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | %d{yyyy-MM-dd HH:mm:ss.SSS} %levelColor(%5p) %magenta(${PID:- }) --- [%15.15t] %levelColor(%X{n-d-service-version}) %levelColor(%X{n-d-service-region}) %levelColor(%X{n-d-service-env}) %levelColor(%X{n-d-service-zone}) %cyan(%-40.40logger{39}) : %msg%n 34 | 35 | 36 | 37 | INFO 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /pmd.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | Exclude noisy rules. 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | com.nepxion 5 | discovery-guide 6 | Nepxion Discovery Guide 7 | pom 8 | 4.0.0 9 | 1.0.0 10 | 11 | 12 | discovery-guide-gateway 13 | discovery-guide-zuul 14 | discovery-guide-service 15 | discovery-guide-console 16 | 17 | 18 | 19 | 6.23.0 20 | 21 | 22 | Hoxton.SR12 23 | 2.2.10 24 | 2.3.12.RELEASE 25 | 26 | 1.8 27 | UTF-8 28 | 29 | 30 | 31 | 32 | 33 | org.springframework.cloud 34 | spring-cloud-dependencies 35 | ${spring.cloud.version} 36 | pom 37 | import 38 | 39 | 40 | 41 | com.alibaba.cloud 42 | spring-cloud-alibaba-dependencies 43 | ${spring.cloud.alibaba.version} 44 | pom 45 | import 46 | 47 | 48 | 49 | org.springframework.boot 50 | spring-boot-dependencies 51 | ${spring.boot.version} 52 | pom 53 | import 54 | 55 | 56 | 57 | com.nepxion 58 | discovery 59 | ${discovery.version} 60 | pom 61 | import 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | org.apache.maven.plugins 70 | maven-compiler-plugin 71 | 72 | 73 | -parameters 74 | 75 | ${project.build.sourceEncoding} 76 | ${java.version} 77 | ${java.version} 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /postman.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "cf16d585-798d-4643-84ef-518c335fba14", 4 | "name": "Nepxion", 5 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 6 | }, 7 | "item": [ 8 | { 9 | "name": "Discovery指南网关接口", 10 | "item": [ 11 | { 12 | "name": "Gateway网关调用示例", 13 | "request": { 14 | "method": "GET", 15 | "header": [ 16 | { 17 | "key": "n-d-version", 18 | "value": "{\"discovery-guide-service-a\":\"1.0\", \"discovery-guide-service-b\":\"1.0\"}", 19 | "type": "text", 20 | "disabled": true 21 | }, 22 | { 23 | "key": "n-d-version-weight", 24 | "value": "{\"discovery-guide-service-a\":\"1.0=90;1.1=10\", \"discovery-guide-service-b\":\"1.0=20;1.1=80\"}", 25 | "type": "text", 26 | "disabled": true 27 | }, 28 | { 29 | "key": "n-d-region", 30 | "value": "dev", 31 | "type": "text", 32 | "disabled": true 33 | }, 34 | { 35 | "key": "n-d-region-weight", 36 | "value": "dev=99;qa=1", 37 | "type": "text", 38 | "disabled": true 39 | }, 40 | { 41 | "key": "n-d-address", 42 | "value": "{\"discovery-guide-service-a\":\"3001\", \"discovery-guide-service-b\":\"4002\"}", 43 | "type": "text", 44 | "disabled": true 45 | }, 46 | { 47 | "key": "n-d-env", 48 | "value": "env1", 49 | "type": "text", 50 | "disabled": true 51 | }, 52 | { 53 | "key": "n-d-id-blacklist", 54 | "value": "{\"discovery-guide-service-a\":\"20210601-222830-466-1840-750-979\", \"discovery-guide-service-b\":\"20210601-222830-501-4332-921-141\"}", 55 | "type": "text", 56 | "disabled": true 57 | }, 58 | { 59 | "key": "n-d-address-blacklist", 60 | "value": "3*2;4001", 61 | "type": "text", 62 | "disabled": true 63 | }, 64 | { 65 | "key": "app-version", 66 | "value": "1.0", 67 | "type": "text", 68 | "disabled": true 69 | }, 70 | { 71 | "key": "mobile", 72 | "value": "13312345678", 73 | "type": "text", 74 | "disabled": true 75 | }, 76 | { 77 | "key": "user", 78 | "value": "zhangsan", 79 | "type": "text", 80 | "disabled": true 81 | }, 82 | { 83 | "key": "location", 84 | "value": "shanghai", 85 | "type": "text", 86 | "disabled": true 87 | }, 88 | { 89 | "key": "Cookie", 90 | "value": "user=zhangsan; Path=/; Domain=nepxion; Expires=Fri, 07 Oct 2050 15:00:00 GMT;", 91 | "type": "text", 92 | "disabled": true 93 | }, 94 | { 95 | "key": "trace-id", 96 | "value": "c0zs78kcze5z", 97 | "type": "text", 98 | "disabled": true 99 | }, 100 | { 101 | "key": "span-id", 102 | "value": "1589", 103 | "type": "text", 104 | "disabled": true 105 | }, 106 | { 107 | "key": "a", 108 | "value": "1", 109 | "type": "text", 110 | "disabled": true 111 | }, 112 | { 113 | "key": "b", 114 | "value": "2", 115 | "type": "text", 116 | "disabled": true 117 | } 118 | ], 119 | "url": { 120 | "raw": "http://localhost:5001/discovery-guide-service-a/invoke/gateway", 121 | "protocol": "http", 122 | "host": [ 123 | "localhost" 124 | ], 125 | "port": "5001", 126 | "path": [ 127 | "discovery-guide-service-a", 128 | "invoke", 129 | "gateway" 130 | ] 131 | } 132 | }, 133 | "response": [] 134 | }, 135 | { 136 | "name": "Zuul网关调用示例", 137 | "request": { 138 | "method": "GET", 139 | "header": [ 140 | { 141 | "key": "n-d-version", 142 | "value": "{\"discovery-guide-service-a\":\"1.0\", \"discovery-guide-service-b\":\"1.0\"}", 143 | "type": "text", 144 | "disabled": true 145 | }, 146 | { 147 | "key": "n-d-version-weight", 148 | "value": "{\"discovery-guide-service-a\":\"1.0=90;1.1=10\", \"discovery-guide-service-b\":\"1.0=20;1.1=80\"}", 149 | "type": "text", 150 | "disabled": true 151 | }, 152 | { 153 | "key": "n-d-region", 154 | "value": "dev", 155 | "type": "text", 156 | "disabled": true 157 | }, 158 | { 159 | "key": "n-d-region-weight", 160 | "value": "dev=99;qa=1", 161 | "type": "text", 162 | "disabled": true 163 | }, 164 | { 165 | "key": "n-d-address", 166 | "value": "{\"discovery-guide-service-a\":\"3001\", \"discovery-guide-service-b\":\"4002\"}", 167 | "type": "text", 168 | "disabled": true 169 | }, 170 | { 171 | "key": "n-d-env", 172 | "value": "env1", 173 | "type": "text", 174 | "disabled": true 175 | }, 176 | { 177 | "key": "n-d-id-blacklist", 178 | "value": "{\"discovery-guide-service-a\":\"20210601-222830-466-1840-750-979\", \"discovery-guide-service-b\":\"20210601-222830-501-4332-921-141\"}", 179 | "type": "text", 180 | "disabled": true 181 | }, 182 | { 183 | "key": "n-d-address-blacklist", 184 | "value": "3*2;4001", 185 | "type": "text", 186 | "disabled": true 187 | }, 188 | { 189 | "key": "app-version", 190 | "value": "1.0", 191 | "type": "text", 192 | "disabled": true 193 | }, 194 | { 195 | "key": "mobile", 196 | "value": "13312345678", 197 | "type": "text", 198 | "disabled": true 199 | }, 200 | { 201 | "key": "user", 202 | "value": "zhangsan", 203 | "type": "text", 204 | "disabled": true 205 | }, 206 | { 207 | "key": "location", 208 | "value": "shanghai", 209 | "type": "text", 210 | "disabled": true 211 | }, 212 | { 213 | "key": "Cookie", 214 | "value": "user=zhangsan; Path=/; Domain=nepxion; Expires=Fri, 07 Oct 2050 15:00:00 GMT;", 215 | "type": "text", 216 | "disabled": true 217 | }, 218 | { 219 | "key": "trace-id", 220 | "value": "c0zs78kcze5z", 221 | "type": "text", 222 | "disabled": true 223 | }, 224 | { 225 | "key": "span-id", 226 | "value": "1589", 227 | "type": "text", 228 | "disabled": true 229 | }, 230 | { 231 | "key": "a", 232 | "value": "1", 233 | "type": "text", 234 | "disabled": true 235 | }, 236 | { 237 | "key": "b", 238 | "value": "2", 239 | "type": "text", 240 | "disabled": true 241 | } 242 | ], 243 | "url": { 244 | "raw": "http://localhost:5002/discovery-guide-service-a/invoke/zuul", 245 | "protocol": "http", 246 | "host": [ 247 | "localhost" 248 | ], 249 | "port": "5002", 250 | "path": [ 251 | "discovery-guide-service-a", 252 | "invoke", 253 | "zuul" 254 | ] 255 | } 256 | }, 257 | "response": [] 258 | }, 259 | { 260 | "name": "Gateway网关全链路侦测示例", 261 | "request": { 262 | "method": "POST", 263 | "header": [ 264 | { 265 | "key": "n-d-version", 266 | "type": "text", 267 | "value": "{\"discovery-guide-service-a\":\"1.0\", \"discovery-guide-service-b\":\"1.0\"}", 268 | "disabled": true 269 | }, 270 | { 271 | "key": "n-d-version-weight", 272 | "type": "text", 273 | "value": "{\"discovery-guide-service-a\":\"1.0=90;1.1=10\", \"discovery-guide-service-b\":\"1.0=20;1.1=80\"}", 274 | "disabled": true 275 | }, 276 | { 277 | "key": "n-d-region", 278 | "type": "text", 279 | "value": "dev", 280 | "disabled": true 281 | }, 282 | { 283 | "key": "n-d-region-weight", 284 | "type": "text", 285 | "value": "dev=99;qa=1", 286 | "disabled": true 287 | }, 288 | { 289 | "key": "n-d-address", 290 | "type": "text", 291 | "value": "{\"discovery-guide-service-a\":\"3001\", \"discovery-guide-service-b\":\"4002\"}", 292 | "disabled": true 293 | }, 294 | { 295 | "key": "n-d-env", 296 | "type": "text", 297 | "value": "env1", 298 | "disabled": true 299 | }, 300 | { 301 | "key": "n-d-id-blacklist", 302 | "value": "{\"discovery-guide-service-a\":\"20210601-222830-466-1840-750-979\", \"discovery-guide-service-b\":\"20210601-222830-501-4332-921-141\"}", 303 | "type": "text", 304 | "disabled": true 305 | }, 306 | { 307 | "key": "n-d-address-blacklist", 308 | "value": "3*2;4001", 309 | "type": "text", 310 | "disabled": true 311 | }, 312 | { 313 | "key": "app-version", 314 | "type": "text", 315 | "value": "1.0", 316 | "disabled": true 317 | }, 318 | { 319 | "key": "mobile", 320 | "type": "text", 321 | "value": "13312345678", 322 | "disabled": true 323 | }, 324 | { 325 | "key": "user", 326 | "type": "text", 327 | "value": "zhangsan", 328 | "disabled": true 329 | }, 330 | { 331 | "key": "location", 332 | "value": "shanghai", 333 | "type": "text", 334 | "disabled": true 335 | }, 336 | { 337 | "key": "Cookie", 338 | "value": "user=zhangsan; Path=/; Domain=nepxion; Expires=Fri, 07 Oct 2050 15:00:00 GMT;", 339 | "type": "text", 340 | "disabled": true 341 | }, 342 | { 343 | "key": "trace-id", 344 | "type": "text", 345 | "value": "c0zs78kcze5z", 346 | "disabled": true 347 | }, 348 | { 349 | "key": "span-id", 350 | "type": "text", 351 | "value": "1589", 352 | "disabled": true 353 | }, 354 | { 355 | "key": "a", 356 | "type": "text", 357 | "value": "1", 358 | "disabled": true 359 | }, 360 | { 361 | "key": "b", 362 | "type": "text", 363 | "value": "2", 364 | "disabled": true 365 | } 366 | ], 367 | "body": { 368 | "mode": "raw", 369 | "raw": "{\"serviceIdList\":[\"discovery-guide-service-b\"]}", 370 | "options": { 371 | "raw": { 372 | "language": "json" 373 | } 374 | } 375 | }, 376 | "url": { 377 | "raw": "http://localhost:5001/discovery-guide-service-a/inspector/inspect", 378 | "protocol": "http", 379 | "host": [ 380 | "localhost" 381 | ], 382 | "port": "5001", 383 | "path": [ 384 | "discovery-guide-service-a", 385 | "inspector", 386 | "inspect" 387 | ] 388 | } 389 | }, 390 | "response": [] 391 | }, 392 | { 393 | "name": "Zuul网关全链路侦测示例", 394 | "request": { 395 | "method": "POST", 396 | "header": [ 397 | { 398 | "key": "n-d-version", 399 | "type": "text", 400 | "value": "{\"discovery-guide-service-a\":\"1.0\", \"discovery-guide-service-b\":\"1.0\"}", 401 | "disabled": true 402 | }, 403 | { 404 | "key": "n-d-version-weight", 405 | "type": "text", 406 | "value": "{\"discovery-guide-service-a\":\"1.0=90;1.1=10\", \"discovery-guide-service-b\":\"1.0=20;1.1=80\"}", 407 | "disabled": true 408 | }, 409 | { 410 | "key": "n-d-region", 411 | "type": "text", 412 | "value": "dev", 413 | "disabled": true 414 | }, 415 | { 416 | "key": "n-d-region-weight", 417 | "type": "text", 418 | "value": "dev=99;qa=1", 419 | "disabled": true 420 | }, 421 | { 422 | "key": "n-d-address", 423 | "type": "text", 424 | "value": "{\"discovery-guide-service-a\":\"3001\", \"discovery-guide-service-b\":\"4002\"}", 425 | "disabled": true 426 | }, 427 | { 428 | "key": "n-d-env", 429 | "type": "text", 430 | "value": "env1", 431 | "disabled": true 432 | }, 433 | { 434 | "key": "n-d-id-blacklist", 435 | "value": "{\"discovery-guide-service-a\":\"20210601-222830-466-1840-750-979\", \"discovery-guide-service-b\":\"20210601-222830-501-4332-921-141\"}", 436 | "type": "text", 437 | "disabled": true 438 | }, 439 | { 440 | "key": "n-d-address-blacklist", 441 | "value": "3*2;4001", 442 | "type": "text", 443 | "disabled": true 444 | }, 445 | { 446 | "key": "app-version", 447 | "type": "text", 448 | "value": "1.0", 449 | "disabled": true 450 | }, 451 | { 452 | "key": "mobile", 453 | "type": "text", 454 | "value": "13312345678", 455 | "disabled": true 456 | }, 457 | { 458 | "key": "user", 459 | "type": "text", 460 | "value": "zhangsan", 461 | "disabled": true 462 | }, 463 | { 464 | "key": "location", 465 | "value": "shanghai", 466 | "type": "text", 467 | "disabled": true 468 | }, 469 | { 470 | "key": "Cookie", 471 | "value": "user=zhangsan; Path=/; Domain=nepxion; Expires=Fri, 07 Oct 2050 15:00:00 GMT;", 472 | "type": "text", 473 | "disabled": true 474 | }, 475 | { 476 | "key": "trace-id", 477 | "type": "text", 478 | "value": "c0zs78kcze5z", 479 | "disabled": true 480 | }, 481 | { 482 | "key": "span-id", 483 | "type": "text", 484 | "value": "1589", 485 | "disabled": true 486 | }, 487 | { 488 | "key": "a", 489 | "type": "text", 490 | "value": "1", 491 | "disabled": true 492 | }, 493 | { 494 | "key": "b", 495 | "type": "text", 496 | "value": "2", 497 | "disabled": true 498 | } 499 | ], 500 | "body": { 501 | "mode": "raw", 502 | "raw": "{\"serviceIdList\":[\"discovery-guide-service-b\"]}", 503 | "options": { 504 | "raw": { 505 | "language": "json" 506 | } 507 | } 508 | }, 509 | "url": { 510 | "raw": "http://localhost:5002/discovery-guide-service-a/inspector/inspect", 511 | "protocol": "http", 512 | "host": [ 513 | "localhost" 514 | ], 515 | "port": "5002", 516 | "path": [ 517 | "discovery-guide-service-a", 518 | "inspector", 519 | "inspect" 520 | ] 521 | } 522 | }, 523 | "response": [] 524 | } 525 | ], 526 | "event": [ 527 | { 528 | "listen": "prerequest", 529 | "script": { 530 | "id": "4f8553f1-7d6f-4b5c-a8e4-2693dcc4340b", 531 | "type": "text/javascript", 532 | "exec": [ 533 | "" 534 | ] 535 | } 536 | }, 537 | { 538 | "listen": "test", 539 | "script": { 540 | "id": "ea52c4e3-7098-4b11-a19a-68b8da9aeffd", 541 | "type": "text/javascript", 542 | "exec": [ 543 | "" 544 | ] 545 | } 546 | } 547 | ], 548 | "protocolProfileBehavior": {} 549 | }, 550 | { 551 | "name": "Discovery原生网关接口", 552 | "item": [ 553 | { 554 | "name": "Gateway网关调用示例", 555 | "request": { 556 | "method": "POST", 557 | "header": [ 558 | { 559 | "key": "n-d-version", 560 | "value": "{\"discovery-springcloud-example-a\":\"1.0\", \"discovery-springcloud-example-b\":\"1.0\", \"discovery-springcloud-example-c\":\"1.0;1.2\"}", 561 | "disabled": true 562 | }, 563 | { 564 | "key": "n-d-region", 565 | "value": "{\"discovery-springcloud-example-a\":\"qa;dev\", \"discovery-springcloud-example-b\":\"dev\", \"discovery-springcloud-example-c\":\"qa\"}", 566 | "disabled": true 567 | }, 568 | { 569 | "key": "n-d-address", 570 | "value": "{\"discovery-springcloud-example-a\":\"192.168.43.101:1100\", \"discovery-springcloud-example-b\":\"192.168.43.101:1201\", \"discovery-springcloud-example-c\":\"192.168.43.101:1300\"}", 571 | "type": "text", 572 | "disabled": true 573 | }, 574 | { 575 | "key": "n-d-version-weight", 576 | "value": "{\"discovery-springcloud-example-a\":\"1.0=90;1.1=10\", \"discovery-springcloud-example-b\":\"1.0=90;1.1=10\", \"discovery-springcloud-example-c\":\"1.0=90;1.1=10\"}", 577 | "type": "text", 578 | "disabled": true 579 | }, 580 | { 581 | "key": "n-d-region-weight", 582 | "value": "dev=85;qa=15", 583 | "type": "text", 584 | "disabled": true 585 | }, 586 | { 587 | "key": "mobile", 588 | "value": "133", 589 | "type": "text", 590 | "disabled": true 591 | }, 592 | { 593 | "key": "user", 594 | "value": "zhangsan", 595 | "type": "text", 596 | "disabled": true 597 | }, 598 | { 599 | "key": "token", 600 | "value": "ab", 601 | "type": "text", 602 | "disabled": true 603 | } 604 | ], 605 | "body": { 606 | "mode": "raw", 607 | "raw": "ab" 608 | }, 609 | "url": { 610 | "raw": "http://localhost:1500/discovery-springcloud-example-a/invoke", 611 | "protocol": "http", 612 | "host": [ 613 | "localhost" 614 | ], 615 | "port": "1500", 616 | "path": [ 617 | "discovery-springcloud-example-a", 618 | "invoke" 619 | ] 620 | } 621 | }, 622 | "response": [] 623 | }, 624 | { 625 | "name": "Zuul网关调用示例", 626 | "request": { 627 | "method": "POST", 628 | "header": [ 629 | { 630 | "key": "n-d-version", 631 | "value": "{\"discovery-springcloud-example-a\":\"1.0\", \"discovery-springcloud-example-b\":\"1.0\", \"discovery-springcloud-example-c\":\"1.0;1.2\"}", 632 | "disabled": true 633 | }, 634 | { 635 | "key": "n-d-region", 636 | "value": "{\"discovery-springcloud-example-a\":\"qa;dev\", \"discovery-springcloud-example-b\":\"dev\", \"discovery-springcloud-example-c\":\"qa\"}", 637 | "disabled": true 638 | }, 639 | { 640 | "key": "n-d-address", 641 | "value": "{\"discovery-springcloud-example-a\":\"192.168.43.101:1100\", \"discovery-springcloud-example-b\":\"192.168.43.101:1201\", \"discovery-springcloud-example-c\":\"192.168.43.101:1300\"}", 642 | "type": "text", 643 | "disabled": true 644 | }, 645 | { 646 | "key": "n-d-version-weight", 647 | "value": "{\"discovery-springcloud-example-a\":\"1.0=90;1.1=10\", \"discovery-springcloud-example-b\":\"1.0=90;1.1=10\", \"discovery-springcloud-example-c\":\"1.0=90;1.1=10\"}", 648 | "type": "text", 649 | "disabled": true 650 | }, 651 | { 652 | "key": "n-d-region-weight", 653 | "value": "dev=85;qa=15", 654 | "type": "text", 655 | "disabled": true 656 | }, 657 | { 658 | "key": "mobile", 659 | "value": "138", 660 | "type": "text", 661 | "disabled": true 662 | }, 663 | { 664 | "key": "user", 665 | "value": "lisi", 666 | "type": "text", 667 | "disabled": true 668 | }, 669 | { 670 | "key": "token", 671 | "value": "ab", 672 | "type": "text", 673 | "disabled": true 674 | } 675 | ], 676 | "body": { 677 | "mode": "raw", 678 | "raw": "ab" 679 | }, 680 | "url": { 681 | "raw": "http://localhost:1400/discovery-springcloud-example-a/invoke", 682 | "protocol": "http", 683 | "host": [ 684 | "localhost" 685 | ], 686 | "port": "1400", 687 | "path": [ 688 | "discovery-springcloud-example-a", 689 | "invoke" 690 | ] 691 | } 692 | }, 693 | "response": [] 694 | }, 695 | { 696 | "name": "Gateway网关获取全路径的路由信息树", 697 | "request": { 698 | "method": "POST", 699 | "header": [], 700 | "body": { 701 | "mode": "raw", 702 | "raw": "discovery-springcloud-example-a;discovery-springcloud-example-b;discovery-springcloud-example-c" 703 | }, 704 | "url": { 705 | "raw": "http://localhost:1500/router/routes/", 706 | "protocol": "http", 707 | "host": [ 708 | "localhost" 709 | ], 710 | "port": "1500", 711 | "path": [ 712 | "router", 713 | "routes", 714 | "" 715 | ] 716 | } 717 | }, 718 | "response": [] 719 | }, 720 | { 721 | "name": "Zuul网关获取全路径的路由信息树", 722 | "request": { 723 | "method": "POST", 724 | "header": [], 725 | "body": { 726 | "mode": "raw", 727 | "raw": "discovery-springcloud-example-a;discovery-springcloud-example-b;discovery-springcloud-example-c" 728 | }, 729 | "url": { 730 | "raw": "http://localhost:1400/router/routes/", 731 | "protocol": "http", 732 | "host": [ 733 | "localhost" 734 | ], 735 | "port": "1400", 736 | "path": [ 737 | "router", 738 | "routes", 739 | "" 740 | ] 741 | } 742 | }, 743 | "response": [] 744 | } 745 | ], 746 | "event": [ 747 | { 748 | "listen": "prerequest", 749 | "script": { 750 | "id": "0745ce05-be91-4aca-9dfa-b2e3d4b903b5", 751 | "type": "text/javascript", 752 | "exec": [ 753 | "" 754 | ] 755 | } 756 | }, 757 | { 758 | "listen": "test", 759 | "script": { 760 | "id": "8cb32baa-41c5-4d08-8a99-e4e9d0f67f8a", 761 | "type": "text/javascript", 762 | "exec": [ 763 | "" 764 | ] 765 | } 766 | } 767 | ], 768 | "protocolProfileBehavior": {} 769 | }, 770 | { 771 | "name": "Discovery服务接口", 772 | "item": [ 773 | { 774 | "name": "查看本地和更新的规则配置信息", 775 | "request": { 776 | "method": "GET", 777 | "header": [], 778 | "url": { 779 | "raw": "http://localhost:1100/config/view", 780 | "protocol": "http", 781 | "host": [ 782 | "localhost" 783 | ], 784 | "port": "1100", 785 | "path": [ 786 | "config", 787 | "view" 788 | ] 789 | } 790 | }, 791 | "response": [] 792 | }, 793 | { 794 | "name": "查看服务的本地版本和动态版本", 795 | "request": { 796 | "method": "GET", 797 | "header": [], 798 | "url": { 799 | "raw": "http://localhost:1100/version/view", 800 | "protocol": "http", 801 | "host": [ 802 | "localhost" 803 | ], 804 | "port": "1100", 805 | "path": [ 806 | "version", 807 | "view" 808 | ] 809 | } 810 | }, 811 | "response": [] 812 | }, 813 | { 814 | "name": "获取全路径的路由信息树", 815 | "request": { 816 | "method": "POST", 817 | "header": [], 818 | "body": { 819 | "mode": "raw", 820 | "raw": "discovery-springcloud-example-b;discovery-springcloud-example-c" 821 | }, 822 | "url": { 823 | "raw": "http://localhost:1100/router/routes/", 824 | "protocol": "http", 825 | "host": [ 826 | "localhost" 827 | ], 828 | "port": "1100", 829 | "path": [ 830 | "router", 831 | "routes", 832 | "" 833 | ] 834 | } 835 | }, 836 | "response": [] 837 | }, 838 | { 839 | "name": "服务调用示例", 840 | "request": { 841 | "method": "POST", 842 | "header": [], 843 | "body": { 844 | "mode": "raw", 845 | "raw": "Start" 846 | }, 847 | "url": { 848 | "raw": "http://localhost:1100/invoke", 849 | "protocol": "http", 850 | "host": [ 851 | "localhost" 852 | ], 853 | "port": "1100", 854 | "path": [ 855 | "invoke" 856 | ] 857 | } 858 | }, 859 | "response": [] 860 | } 861 | ], 862 | "event": [ 863 | { 864 | "listen": "prerequest", 865 | "script": { 866 | "id": "9c473e26-3065-49ef-bb64-718d1f8917ec", 867 | "type": "text/javascript", 868 | "exec": [ 869 | "" 870 | ] 871 | } 872 | }, 873 | { 874 | "listen": "test", 875 | "script": { 876 | "id": "a7fbb188-ca44-423d-b345-85a27a88eaef", 877 | "type": "text/javascript", 878 | "exec": [ 879 | "" 880 | ] 881 | } 882 | } 883 | ], 884 | "protocolProfileBehavior": {} 885 | }, 886 | { 887 | "name": "Discovery控制台接口", 888 | "item": [ 889 | { 890 | "name": "批量同步推送更新规则配置信息", 891 | "request": { 892 | "method": "POST", 893 | "header": [], 894 | "body": { 895 | "mode": "raw", 896 | "raw": "\r\n\r\n \r\n \r\n \r\n \r\n \r\n" 897 | }, 898 | "url": { 899 | "raw": "http://localhost:2222/console/config/update-sync/discovery-springcloud-example-b", 900 | "protocol": "http", 901 | "host": [ 902 | "localhost" 903 | ], 904 | "port": "2222", 905 | "path": [ 906 | "console", 907 | "config", 908 | "update-sync", 909 | "discovery-springcloud-example-b" 910 | ] 911 | } 912 | }, 913 | "response": [] 914 | }, 915 | { 916 | "name": "批量同步清除更新的规则配置信息", 917 | "request": { 918 | "method": "POST", 919 | "header": [], 920 | "body": { 921 | "mode": "raw", 922 | "raw": "" 923 | }, 924 | "url": { 925 | "raw": "http://localhost:2222/console/config/clear-sync/discovery-springcloud-example-b", 926 | "protocol": "http", 927 | "host": [ 928 | "localhost" 929 | ], 930 | "port": "2222", 931 | "path": [ 932 | "console", 933 | "config", 934 | "clear-sync", 935 | "discovery-springcloud-example-b" 936 | ] 937 | } 938 | }, 939 | "response": [] 940 | }, 941 | { 942 | "name": "批量同步更新服务的动态版本", 943 | "request": { 944 | "method": "POST", 945 | "header": [], 946 | "body": { 947 | "mode": "raw", 948 | "raw": "1.1" 949 | }, 950 | "url": { 951 | "raw": "http://localhost:2222/console/version/update-sync/discovery-springcloud-example-zuul", 952 | "protocol": "http", 953 | "host": [ 954 | "localhost" 955 | ], 956 | "port": "2222", 957 | "path": [ 958 | "console", 959 | "version", 960 | "update-sync", 961 | "discovery-springcloud-example-zuul" 962 | ] 963 | } 964 | }, 965 | "response": [] 966 | }, 967 | { 968 | "name": "批量同步清除服务的动态版本", 969 | "request": { 970 | "method": "POST", 971 | "header": [], 972 | "body": { 973 | "mode": "raw", 974 | "raw": "" 975 | }, 976 | "url": { 977 | "raw": "http://localhost:2222/console/version/clear-sync/discovery-springcloud-example-zuul", 978 | "protocol": "http", 979 | "host": [ 980 | "localhost" 981 | ], 982 | "port": "2222", 983 | "path": [ 984 | "console", 985 | "version", 986 | "clear-sync", 987 | "discovery-springcloud-example-zuul" 988 | ] 989 | } 990 | }, 991 | "response": [] 992 | }, 993 | { 994 | "name": "推送更新规则配置信息到远程配置中心", 995 | "request": { 996 | "method": "POST", 997 | "header": [], 998 | "body": { 999 | "mode": "raw", 1000 | "raw": "\r\n\r\n \r\n \r\n \r\n \r\n \r\n" 1001 | }, 1002 | "url": { 1003 | "raw": "http://localhost:2222/console/remote-config/update/example-service-group/discovery-springcloud-example-b", 1004 | "protocol": "http", 1005 | "host": [ 1006 | "localhost" 1007 | ], 1008 | "port": "2222", 1009 | "path": [ 1010 | "console", 1011 | "remote-config", 1012 | "update", 1013 | "example-service-group", 1014 | "discovery-springcloud-example-b" 1015 | ] 1016 | } 1017 | }, 1018 | "response": [] 1019 | }, 1020 | { 1021 | "name": "清除规则配置信息到远程配置中心", 1022 | "request": { 1023 | "method": "POST", 1024 | "header": [], 1025 | "body": { 1026 | "mode": "raw", 1027 | "raw": "" 1028 | }, 1029 | "url": { 1030 | "raw": "http://localhost:2222/console/remote-config/clear/example-service-group/discovery-springcloud-example-b", 1031 | "protocol": "http", 1032 | "host": [ 1033 | "localhost" 1034 | ], 1035 | "port": "2222", 1036 | "path": [ 1037 | "console", 1038 | "remote-config", 1039 | "clear", 1040 | "example-service-group", 1041 | "discovery-springcloud-example-b" 1042 | ] 1043 | } 1044 | }, 1045 | "response": [] 1046 | }, 1047 | { 1048 | "name": "查看远程配置中心的规则配置信息", 1049 | "request": { 1050 | "method": "GET", 1051 | "header": [], 1052 | "url": { 1053 | "raw": "http://localhost:2222/console/remote-config/view/example-service-group/discovery-springcloud-example-b", 1054 | "protocol": "http", 1055 | "host": [ 1056 | "localhost" 1057 | ], 1058 | "port": "2222", 1059 | "path": [ 1060 | "console", 1061 | "remote-config", 1062 | "view", 1063 | "example-service-group", 1064 | "discovery-springcloud-example-b" 1065 | ] 1066 | } 1067 | }, 1068 | "response": [] 1069 | } 1070 | ], 1071 | "protocolProfileBehavior": {} 1072 | }, 1073 | { 1074 | "name": "Nacos服务接口", 1075 | "item": [ 1076 | { 1077 | "name": "获取服务实例", 1078 | "request": { 1079 | "method": "GET", 1080 | "header": [], 1081 | "url": { 1082 | "raw": "http://127.0.0.1:8848/nacos/v1/ns/instances?serviceName=discovery-springcloud-example-c", 1083 | "protocol": "http", 1084 | "host": [ 1085 | "127", 1086 | "0", 1087 | "0", 1088 | "1" 1089 | ], 1090 | "port": "8848", 1091 | "path": [ 1092 | "nacos", 1093 | "v1", 1094 | "ns", 1095 | "instances" 1096 | ], 1097 | "query": [ 1098 | { 1099 | "key": "serviceName", 1100 | "value": "discovery-springcloud-example-c" 1101 | } 1102 | ] 1103 | } 1104 | }, 1105 | "response": [] 1106 | } 1107 | ], 1108 | "protocolProfileBehavior": {} 1109 | }, 1110 | { 1111 | "name": "Permission服务接口", 1112 | "item": [ 1113 | { 1114 | "name": "权限验证调用", 1115 | "request": { 1116 | "method": "GET", 1117 | "header": [ 1118 | { 1119 | "key": "token", 1120 | "value": "abcd12345" 1121 | }, 1122 | { 1123 | "key": "user-id", 1124 | "value": "lisi" 1125 | }, 1126 | { 1127 | "key": "user-type", 1128 | "value": "LDAP" 1129 | } 1130 | ], 1131 | "url": { 1132 | "raw": "http://localhost:1212/doC/abc", 1133 | "protocol": "http", 1134 | "host": [ 1135 | "localhost" 1136 | ], 1137 | "port": "1212", 1138 | "path": [ 1139 | "doC", 1140 | "abc" 1141 | ] 1142 | } 1143 | }, 1144 | "response": [] 1145 | } 1146 | ], 1147 | "protocolProfileBehavior": {} 1148 | } 1149 | ], 1150 | "protocolProfileBehavior": {} 1151 | } --------------------------------------------------------------------------------