Skip to content

Commit 5138295

Browse files
authored
apollo doc (apache#909)
* client-config-apollo * client-config-apollo * register-access * apollo
1 parent 02e0a38 commit 5138295

12 files changed

+187
-26
lines changed

docs/user-guide/property-config/admin-property-config.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,17 @@ When the registerType is `consul`, the supported properties are as follows.
141141
|metadata-path | String | `shenyu/register` | No |Metadata path name, default is `shenyu/register`.|
142142

143143

144+
When the registerType is `apollo`, the supported properties are as follows.
145+
146+
| Name | Type | Default | Required | Description |
147+
|:--------------|:-------|:-------:|:--------:|:---------------------|
148+
| appId | String | null | Yes | Apollo appId |
149+
| namespace | String | null | Yes | Apollo namespace |
150+
| portalUrl | String | null | Yes | Apollo portalUrl |
151+
| env | String | null | Yes | Apollo env |
152+
| clusterName | String | null | Yes | Apollo clusterName |
153+
| token | String | null | Yes | Apollo token |
154+
144155

145156
##### shenyu.sync config
146157

docs/user-guide/property-config/client-property-config.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Set the `shenyu` property in your microservice, for example, in [shenyu-examples
1616
```yaml
1717
shenyu:
1818
client:
19-
registerType: http #zookeeper #etcd #nacos #consul
20-
serverLists: http://localhost:9095 #localhost:2181 #http://localhost:2379 #localhost:8848
19+
registerType: http #zookeeper #etcd #nacos #consul #apollo
20+
serverLists: http://localhost:9095 #localhost:2181 #http://localhost:2379 #localhost:8848 #localhost:8080
2121
props:
2222
contextPath: /http
2323
appName: http
@@ -34,11 +34,11 @@ This section describes configurations related to client access. For details abou
3434
3535
3636
37-
|Name | Type | Default | Required | Description |
38-
|:------------------------ |:----- |:-------: |:-------:|:----------------------------|
39-
|registerType |String | http | Yes | Which mode to use for registry. Currently, http, zookeeper, etcd, consul and nacos are supported.|
40-
|serverLists |String | null | No |Configure the address of the registry. In clustering, multiple addresses are separated by commas (,).|
41-
|props | | | | The value of the property varies according to the registerType.|
37+
| Name | Type | Default | Required | Description |
38+
|:-------------|:-------|:-------:|:--------:|:----------------------------------------------------------------------------------------------------------|
39+
| registerType | String | http | Yes | Which mode to use for registry. Currently, http, zookeeper, etcd, consul ,apollo and nacos are supported. |
40+
| serverLists | String | null | No | Configure the address of the registry. In clustering, multiple addresses are separated by commas (,). |
41+
| props | | | | The value of the property varies according to the registerType. |
4242
4343
4444
@@ -92,5 +92,15 @@ When the registerType is `nacos`, the supported properties are as follows.
9292
|accessKey | String | "" | No |accessKey|
9393
|secretKey | String | "" | No |secretKey|
9494

95+
When the registerType is `apollo`, the supported properties are as follows.
96+
97+
| Name | Type | Default | Required | Description |
98+
|:------------|:-------|:--------:|:--------:|:------------|
99+
| appId | String | "shenyu" | Yes | appId |
100+
| env | String | "" | Yes | env |
101+
| clusterName | String | "" | Yes | clusterName |
102+
| namespace | String | "" | Yes | namespace |
103+
| token | String | "" | Yes | token |
104+
| portalUrl | String | "" | Yes | portalUrl |
95105

96106
When the registerType is `consul`, no other property configuration is provided. please set `spring.cloud.consul` for the configuration.

docs/user-guide/property-config/gateway-property-config.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -492,19 +492,31 @@ The following properties are configured for data synchronization using `http lon
492492

493493
The following properties are configured for data synchronization using `nacos` :
494494

495-
|Name | | Type | Default | Required | Description |
496-
|:------------------------ |:----- |:-------: |:-------:|:----------------------------|:---------------------------:|
497-
|url | | String | null | 是 |nacos url|
498-
|namespace | | String | null | Yes |namespace|
499-
|username | | String | null | No |username|
500-
|password | | String | null | No |password|
501-
|acm | | Object | - | No |aliyun ACM service configuration.|
502-
| |enabled | boolean | false | No |whether to enable.|
503-
| |endpoint | String | null | No |ACM service address.|
504-
| |namespace | String | null | No |namespace.|
505-
| |accessKey | String | null | No |accessKey.|
506-
| |secretKey | String | null | No |secretKey.|
507-
495+
|Name | | Type | Default | Required | Description |
496+
|:------------------------ |:----- |:-------: |:-------:|:---------|:---------------------------:|
497+
|url | | String | null | Yes |nacos url|
498+
|namespace | | String | null | Yes |namespace|
499+
|username | | String | null | No |username|
500+
|password | | String | null | No |password|
501+
|acm | | Object | - | No |aliyun ACM service configuration.|
502+
| |enabled | boolean | false | No |whether to enable.|
503+
| |endpoint | String | null | No |ACM service address.|
504+
| |namespace | String | null | No |namespace.|
505+
| |accessKey | String | null | No |accessKey.|
506+
| |secretKey | String | null | No |secretKey.|
507+
508+
The following properties are configured for data synchronization using `apollo` :
509+
510+
| Name | | Type | Default | Required | Description |
511+
|:------------|:----|:------:|:-------:|:---------|:-----------:|
512+
| namespace | | String | null | Yes | namespace |
513+
| appId | | String | null | Yes | appId |
514+
| token | | String | null | Yes | token |
515+
| clusterName | | String | default | Yes | cluster |
516+
| portalUrl | | String | null | Yes | portalUrl |
517+
| meta | | String | null | Yes | meta |
518+
| env | | String | null | Yes | env |
519+
508520

509521

510522
The following properties are configured for data synchronization using `etcd` :

docs/user-guide/property-config/register-center-access.md

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,97 @@ shenyu:
444444
# nacosNameSpace: nacos namespace
445445
```
446446

447+
### Apollo Registry Config
448+
449+
#### shenyu-admin config
450+
451+
First add the related dependencies to the `pom` file (already added by default) :
452+
453+
```xml
454+
<dependency>
455+
<groupId>org.apache.shenyu</groupId>
456+
<artifactId>shenyu-register-server-apollo</artifactId>
457+
<version>${project.version}</version>
458+
</dependency>
459+
```
460+
461+
<img src="/img/shenyu/register/register-apollo-admin-pom.png" width="70%" height="60%" />
462+
463+
464+
* Then in the `yml` file, configure the registry as `apollo`, fill in the related `apollo` service address and parameters, and `apollo` namespace (need to be consistent with `shenyu-client`), the configuration information is as follows:
465+
466+
467+
```yaml
468+
shenyu:
469+
register:
470+
registerType: apollo #etcd #consul
471+
serverLists: http://localhost:8080 #http://localhost:2379 #localhost:8848
472+
props:
473+
env: dev
474+
appId: shenyu
475+
namespaceName: application
476+
clusterName: default
477+
token: 0fff5645fc74ee5e0d63a6389433c8c8afc0beea31eed0279ecc1c8961d12da9
478+
portalUrl: http://localhost:8070
479+
```
480+
481+
<img src="/img/shenyu/register/register-apollo-admin-yml.png" width="70%" height="60%" />
482+
483+
484+
#### shenyu-client config
485+
486+
The following shows the configuration information registered by `apollo` when the `Http` service accesses the `Apache ShenYu` gateway as a client. Other clients (such as `Dubbo` and `Spring Cloud`) can be configured in the same way.
487+
488+
489+
* First add dependencies to the `pom` file:
490+
491+
```xml
492+
<dependency>
493+
<groupId>org.apache.shenyu</groupId>
494+
<artifactId>shenyu-register-client-apollo</artifactId>
495+
<version>${shenyu.version}</version>
496+
</dependency>
497+
```
498+
499+
<img src="/img/shenyu/register/register-apollo-client-pom.png" width="70%" height="60%" />
500+
501+
502+
* Then in `yml` configure registration mode as `apollo`, and fill in `apollo` service address and related parameters, also need `apollo` namespace (need to be consistent with `shenyu-admin`), IP (optional, then automatically obtain the local IP address) and port, configuration information is as follows:
503+
504+
```yaml
505+
shenyu:
506+
register:
507+
registerType: apollo #etcd #consul
508+
serverLists: http://localhost:8080 #http://localhost:2379 #localhost:8848
509+
props:
510+
env: dev
511+
appId: shenyu
512+
namespace: application
513+
clusterName: default
514+
token: 0fff5645fc74ee5e0d63a6389433c8c8afc0beea31eed0279ecc1c8961d12da9
515+
portalUrl: http://localhost:8070
516+
client:
517+
http:
518+
props:
519+
contextPath: /http
520+
appName: http
521+
port: 8188
522+
isFull: false
523+
# registerType : register type, set apollo
524+
# serverList: when register type is apollo, add apollo address list
525+
# env: apollo namespace
526+
# appId: apollo appId
527+
# namespaceName: apollo namespaceName
528+
# clusterName: apollo clusterName
529+
# token: apollo opeanapi token
530+
# portalUrl: apollo opeanapi portalUrl like http://localhost:8070
531+
# port: your project port number; apply to springmvc/tars/grpc
532+
# contextPath: your project's route prefix through shenyu gateway, such as /order ,/product etc,gateway will route based on it.
533+
# appName:your project name,the default value is`spring.application.name`.
534+
# isFull: set true means providing proxy for your entire service, or only a few controller. apply to springmvc/springcloud
535+
536+
```
447537

448538

449-
In conclusion, this paper mainly describes how to connect your microservices (currently supporting `Http`, `Dubbo`, `Spring Cloud`, `gRPC`, `Motan`, `Sofa`, `Tars` and other protocols) to the `Apache ShenYu` gateway. the Apache ShenYu gateway support registry has `Http`, `Zookeeper`, `Etcd`, `Consul`, `Nacos` and so on. This paper introduces the different ways to register configuration information when `Http` service is used as the client to access `Apache ShenYu` gateway.
539+
In conclusion, this paper mainly describes how to connect your microservices (currently supporting `Http`, `Dubbo`, `Spring Cloud`, `gRPC`, `Motan`, `Sofa`, `Tars` and other protocols) to the `Apache ShenYu` gateway. the Apache ShenYu gateway support registry has `Http`, `Zookeeper`, `Etcd`, `Consul`, `Nacos`, `Apollo` and so on. This paper introduces the different ways to register configuration information when `Http` service is used as the client to access `Apache ShenYu` gateway.
450540

docs/user-guide/property-config/register-center-instance.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,23 @@ instance:
5050
etcdTTL: 5 #Optional, default 5
5151
```
5252

53-
### Use consul
53+
### Use apollo
5454

5555
Add the following configuration to the gateway's `yml` file:
5656

5757
```yaml
5858
instance:
5959
enabled: true
60-
registerType: consul
61-
serverLists: localhost:8848 #config with your consul address, used by the cluster environment, separated with (,).
60+
registerType: apollo
61+
serverLists: http://localhost:8080
6262
props:
63-
consulTimeout: 3000 #Optional, default 3000
64-
consulTTL: 3000 #Optional, default 3000
63+
env: dev
64+
appId: shenyu
65+
namespace: application
66+
clusterName: default
67+
token: 0fff5645fc74ee5e0d63a6389433c8c8afc0beea31eed0279ecc1c8961d12da9
68+
portalUrl: http://localhost:8070
6569
```
6670

71+
6772
> After the configuration is complete, start the gateway and it will successfully register to the corresponding registration center.

docs/user-guide/property-config/use-data-sync.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,39 @@ shenyu:
331331

332332
<img src="/img/shenyu/dataSync/shenyu_consul_admin_sync_config.jpg" width="80%" height="70%" />
333333

334+
### Apollo Synchronization Config
335+
336+
* `Apache ShenYu` gateway config
337+
338+
Add these dependencies in `pom.xml`:
339+
340+
```xml
341+
<!-- apache shenyu data sync start use consul-->
342+
<dependency>
343+
<groupId>org.apache.shenyu</groupId>
344+
<artifactId>shenyu-spring-boot-starter-sync-data-apollo</artifactId>
345+
<version>${project.version}</version>
346+
</dependency>
347+
```
348+
349+
<img src="/img/shenyu/dataSync/shenyu-data-sync-apollo-pom.png" width="80%" height="70%" />
350+
351+
Add these config values in yaml file:
352+
353+
```yaml
354+
shenyu:
355+
sync:
356+
apollo:
357+
meta: http://localhost:8080
358+
appId: shenyu
359+
portalUrl: http://localhost:8070
360+
env: dev
361+
clusterName: test
362+
namespace: application
363+
token: 0fff5645fc74ee5e0d63a6389433c8c8afc0beea31eed0279ecc1c8961d12da9
364+
```
365+
366+
<img src="/img/shenyu/dataSync/shenyu-data-sync-admin-apollo-yml.png" width="80%" height="70%" />
334367

335368

336369
> After the data synchronization strategy of Apache ShenYu gateway and shenyu-admin is reconfigured, the microservice needs to be restarted.
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)