Pārlūkot izejas kodu

Update documents

- Update document for Dubbo demo
- Update document for extensions

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
master
Eric Zhao pirms 6 gadiem
vecāks
revīzija
0438d530d4
5 mainītis faili ar 79 papildinājumiem un 8 dzēšanām
  1. +2
    -0
      README.md
  2. +21
    -3
      sentinel-demo/sentinel-demo-dubbo/README.md
  3. +2
    -5
      sentinel-extension/README.md
  4. +27
    -0
      sentinel-extension/sentinel-datasource-nacos/README.md
  5. +27
    -0
      sentinel-extension/sentinel-datasource-zookeeper/README.md

+ 2
- 0
README.md Parādīt failu

@@ -1,3 +1,5 @@
<img src="https://user-images.githubusercontent.com/9434884/43697219-3cb4ef3a-9975-11e8-9a9c-73f4f537442d.png" alt="Sentinel Logo" height="50%" width="50%">

# Sentinel: Sentinel of Your Application

[![Travis Build Status](https://travis-ci.org/alibaba/Sentinel.svg?branch=master)](https://travis-ci.org/alibaba/Sentinel)


+ 21
- 3
sentinel-demo/sentinel-demo-dubbo/README.md Parādīt failu

@@ -11,6 +11,7 @@ Sentinel 提供了与 Dubbo 整合的模块 - Sentinel Dubbo Adapter,主要包
```

引入此依赖后,Dubbo 的服务接口和方法(包括调用端和服务端)就会成为 Sentinel 中的资源,在配置了规则后就可以自动享受到 Sentinel 的防护能力。

若不希望开启 Sentinel Dubbo Adapter 中的某个 Filter,可以手动关闭对应的 Filter,比如:

```java
@@ -63,16 +64,33 @@ Demo 2 演示了此限流场景,我们看一下这种模式的效果。假设

## Sentinel Dashboard

Sentinel 还提供 API 用于获取实时的监控信息,对应文档见[此处](https://github.com/alibaba/Sentinel/wiki/%E5%AE%9E%E6%97%B6%E7%9B%91%E6%8E%A7)。为了便于使用,Sentinel 还提供了一个控制台(Dashboard)用于配置规则、查看监控、机器发现等功能。我们只需要按照 [Sentinel 控制台文档](https://github.com/alibaba/Sentinel/wiki/%E6%8E%A7%E5%88%B6%E5%8F%B0) 启动控制台,然后给对应的应用程序添加相应参数并启动即可。比如本文中 Service Provider 示例的启动参数:
Sentinel 还提供 API 用于获取实时的监控信息,对应文档见[此处](https://github.com/alibaba/Sentinel/wiki/%E5%AE%9E%E6%97%B6%E7%9B%91%E6%8E%A7)。为了便于使用,Sentinel 还提供了一个控制台(Dashboard)用于配置规则、查看监控、机器发现等功能。

接入 Dashboard 的步骤(**缺一不可**):

1. 按照 [Sentinel 控制台文档](https://github.com/alibaba/Sentinel/wiki/%E6%8E%A7%E5%88%B6%E5%8F%B0) 启动控制台
2. 应用引入 `sentinel-transport-simple-http` 依赖,以便控制台可以拉取对应应用的相关信息
3. 给应用添加相关的启动参数,启动应用。需要配置的参数有:
- `-Dcsp.sentinel.api.port`:客户端的 port,用于上报相关信息
- `-Dcsp.sentinel.dashboard.server`:控制台的地址
- `-Dproject.name`:应用名称,会在控制台中显示

注意某些环境下本地运行 Dubbo 服务还需要加上 `-Djava.net.preferIPv4Stack=true` 参数。比如 Service Provider 示例的启动参数:

```bash
-Djava.net.preferIPv4Stack=true -Dcsp.sentinel.api.port=8720 -Dcsp.sentinel.dashboard.server=localhost:8080 -Dproject.name=dubbo-provider-demo
```

这样在启动 Service Provider 示例以后,就可以在 Sentinel 控制台中找到我们的服务了。可以很方便地在控制台中配置限流规则:
Service Consumer 示例的启动参数:

```bash
-Djava.net.preferIPv4Stack=true -Dcsp.sentinel.api.port=8721 -Dcsp.sentinel.dashboard.server=localhost:8080 -Dproject.name=dubbo-consumer-demo
```

这样在启动 Service Provider 和 Service Consumer 示例以后,就可以在 Sentinel 控制台中找到我们的服务了。可以很方便地在控制台中配置限流规则:

![规则配置](http://dubbo.incubator.apache.org/img/blog/sentinel-dashboard-view-rules.png)

或者查看实时监控数据:

![秒级实时监控](http://dubbo.incubator.apache.org/img/blog/sentinel-dashboard-metrics.png)
![秒级实时监控](http://dubbo.incubator.apache.org/img/blog/sentinel-dashboard-metrics.png)

+ 2
- 5
sentinel-extension/README.md Parādīt failu

@@ -1,9 +1,6 @@
# Sentinel Extension

This is the parent of all extension points to Sentinel.

Examples of what makes sense as a extension submodule are:

* alternate implementations rules config
Sentinel extension modules provide additional extension points
and functions.



+ 27
- 0
sentinel-extension/sentinel-datasource-nacos/README.md Parādīt failu

@@ -0,0 +1,27 @@
# Sentinel DataSource Nacos

Sentinel DataSource Nacos provides integration with [Nacos](http://nacos.io) so that Nacos
can be the dynamic rule data source of Sentinel.

To use Sentinel DataSource Nacos, you should add the following dependency:

```xml
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-datasource-nacos</artifactId>
<version>x.y.z</version>
</dependency>
```

Then you can create an `NacosDataSource` and register to rule managers.
For instance:

```java
// remoteAddress is the address of Nacos
// groupId and dataId are concepts of Nacos
DataSource<String, List<FlowRule>> flowRuleDataSource = new NacosDataSource<>(remoteAddress, groupId, dataId,
source -> JSON.parseObject(source, new TypeReference<List<FlowRule>>() {}));
FlowRuleManager.register2Property(flowRuleDataSource.getProperty());
```

We've also provided an example: [sentinel-demo-nacos-datasource](https://github.com/alibaba/Sentinel/tree/master/sentinel-demo/sentinel-demo-nacos-datasource).

+ 27
- 0
sentinel-extension/sentinel-datasource-zookeeper/README.md Parādīt failu

@@ -0,0 +1,27 @@
# Sentinel DataSource ZooKeeper

Sentinel DataSource ZooKeeper provides integration with ZooKeeper so that ZooKeeper
can be the dynamic rule data source of Sentinel. The data source uses push model (listener).

To use Sentinel DataSource ZooKeeper, you should add the following dependency:

```xml
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-datasource-zookeeper</artifactId>
<version>x.y.z</version>
</dependency>
```

Then you can create an `ZookeeperDataSource` and register to rule managers.
For instance:

```java
// `path` is the data path in ZooKeeper
DataSource<String, List<FlowRule>> flowRuleDataSource = new ZookeeperDataSource<>(remoteAddress, path, source -> JSON.parseObject(source, new TypeReference<List<FlowRule>>() {}));
FlowRuleManager.register2Property(flowRuleDataSource.getProperty());
```

> Note: It's not recommended to add a large amount of rules to a single path (has limitation, also leads to bad performance).

We've also provided an example: [sentinel-demo-zookeeper-datasource](https://github.com/alibaba/Sentinel/tree/master/sentinel-demo/sentinel-demo-zookeeper-datasource).

Notiek ielāde…
Atcelt
Saglabāt