提交 366fc50b authored 作者: Administrator's avatar Administrator

skywalking

上级 457e40bc
# 一、参照loit-seata-order-example项目
```
http://39.100.254.140:12011/loit-Infrastructure/loit-seata-order-example
```
如何运行example项目参照文档:
```
http://39.100.254.140:12011/loit-Infrastructure-doc/loit-initproject-doc/blob/master/1%E3%80%81%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/%E8%BF%90%E8%A1%8Cloit-seata-order-example.md
```
# 二、流控
### dashboard 安装如下:
```
java -jar -Xms250m -Xmx250m -Dserver.port=8090 -Dcsp.sentinel.dashboard.server=localhost:8090 E:\2service\sentinel\sentinel-dashboard-1.6.3.jar
```
```
默认用户名和密码都是sentinel。对于用户登录的相关配置可以在启动命令中增加下面的参数来进行配置:
-Dsentinel.dashboard.auth.username=sentinel: 用于指定控制台的登录用户名为 sentinel;
-Dsentinel.dashboard.auth.password=123456: 用于指定控制台的登录密码为 123456;如果省略这两个参数,默认用户和密码均为 sentinel
-Dserver.servlet.session.timeout=7200: 用于指定 Spring Boot 服务端 session 的过期时间,如 7200 表示 7200 秒;60m 表示 60 分钟,默认为 30 分钟;
```
### 项目配置
```
<dependency>
<groupId>com.timeloit.cloud</groupId>
<artifactId>spring-cloud-starter-timeloit-sentinel</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-datasource-nacos</artifactId>
</dependency>
<dependency>
<groupId>com.timeloit.cloud</groupId>
<artifactId>spring-cloud-timeloit-sentinel-datasource</artifactId>
</dependency>
```
```
spring.application.name=alibaba-sentinel-datasource-nacos
server.port=8003
# sentinel dashboard
spring.cloud.sentinel.transport.dashboard=localhost:8080
# sentinel datasource nacos :http://blog.didispace.com/spring-cloud-alibaba-sentinel-2-1/
spring.cloud.sentinel.datasource.ds.nacos.server-addr=localhost:8848
spring.cloud.sentinel.datasource.ds.nacos.dataId=${spring.application.name}-sentinel
spring.cloud.sentinel.datasource.ds.nacos.groupId=DEFAULT_GROUP
spring.cloud.sentinel.datasource.ds.nacos.rule-type=flow
```
- `spring.cloud.sentinel.transport.dashboard`:sentinel dashboard的访问地址,根据上面准备工作中启动的实例配置
- `spring.cloud.sentinel.datasource.ds.nacos.server-addr`:nacos的访问地址,,根据上面准备工作中启动的实例配置
- `spring.cloud.sentinel.datasource.ds.nacos.groupId`:nacos中存储规则的groupId
- `spring.cloud.sentinel.datasource.ds.nacos.dataId`:nacos中存储规则的dataId
- `spring.cloud.sentinel.datasource.ds.nacos.rule-type`:该参数是spring cloud alibaba升级到0.2.2之后增加的配置,用来定义存储的规则类型。所有的规则类型可查看枚举类:`org.springframework.cloud.alibaba.sentinel.datasource.RuleType`,每种规则的定义格式可以通过各枚举值中定义的规则对象来查看,比如限流规则可查看:`com.alibaba.csp.sentinel.slots.block.flow.FlowRule`
这里对于dataId使用了`${spring.application.name}`变量,这样可以根据应用名来区分不同的规则配置。
**注意**:由于版本迭代关系,Github Wiki中的文档信息不一定适用所有版本。比如:在这里适用的0.2.1版本中,并没有`spring.cloud.sentinel.datasource.ds2.nacos.rule-type`这个参数。所以,读者在使用的时候,可以通过查看`org.springframework.cloud.alibaba.sentinel.datasource.config.DataSourcePropertiesConfiguration``org.springframework.cloud.alibaba.sentinel.datasource.config.NacosDataSourceProperties`两个类来分析具体的配置内容,会更为准确。
```
[
{
"resource": "/order/placeOrder/commit",
"limitApp": "default",
"grade": 1,
"count": 5,
"strategy": 0,
"controlBehavior": 0,
"clusterMode": false
}
]
```
可以看到上面配置规则是一个数组类型,数组中的每个对象是针对每一个保护资源的配置对象,每个对象中的属性解释如下:
- resource:资源名,即限流规则的作用对象
- limitApp:流控针对的调用来源,若为 default 则不区分调用来源
- grade:限流阈值类型(QPS 或并发线程数);`0`代表根据并发数量来限流,`1`代表根据QPS来进行流量控制
- count:限流阈值
- strategy:调用关系限流策略
- controlBehavior:流量控制效果(直接拒绝、Warm Up、匀速排队)
- clusterMode:是否为集群模式
### 注意
在完成了上面的整合之后,对于接口流控规则的修改就存在两个地方了:Sentinel控制台、Nacos控制台。
这个时候,需要注意当前版本的Sentinel控制台不具备同步修改Nacos配置的能力,而Nacos由于可以通过在客户端中使用Listener来实现自动更新。所以,在整合了Nacos做规则存储之后,需要知道在下面两个地方修改存在不同的效果:
- Sentinel控制台中修改规则:仅存在于服务的内存中,不会修改Nacos中的配置值,重启后恢复原来的值。
- Nacos控制台中修改规则:服务的内存中规则会更新,Nacos中持久化规则也会更新,重启后依然保持。
# 技术文档地址
```
http://39.100.254.140:12011/loit-Infrastructure-doc/loit-initproject-doc/tree/master/4%E3%80%81%E6%8A%80%E6%9C%AF%E6%96%87%E6%A1%A3
```
软件安装地址
```
http://39.100.254.140:12011/loit-Infrastructure-doc/loit-initproject-doc/tree/master/1%E3%80%81%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE
```
# server端
# client端
```
-javaagent:E:\2service\apache-skywalking-apm-bin\agent\skywalking-agent.jar -Dskywalking.agent.service_name=loit-project-name -Dskywalking.collector.backend_service=localhost:11800
```
skywalking-agent.jar 指定对应的jar路径
service_name: 具体项目名称
localhost:11800 skywalking server端
差异被折叠。
差异被折叠。
Welcome to Apache SkyWalking
===============================================================================
SkyWalking: APM (application performance monitor) tool for distributed systems,
especially designed for microservices, cloud native and container-based (Docker, Kubernetes, Mesos) architectures.
Underlying technology is a distributed tracing system.
SkyWalking provides a high performance Java agent, lets the users don't need to change any source codes for instrumentation
and distributed tracing.
At the same time, SkyWalking provides backend, including collector and UI, to aggregate, analysis metrics and traces.
In order to visualize the performance data, distributed traces, application topology and alarms.
SkyWalking "Trace Data Protocol" and "Cross Process Propagation Headers Protocol" open for any other agent implementors, e.g. other language agent or SDK. You can use
You can use our backend to analysis and visualize your data, even can interop your agent/SDK with SkyWalking Java agent.
SkyWalking backend can be used for other language agent/SDKs, it doesn't design just for Java.
Getting Started
===============================================================================
To help you get started, try the following links:
Getting Started
https://github.com/apache/skywalking/blob/master/docs/en/setup/README.md
Building
https://github.com/apache/skywalking/blob/master/docs/en/guides/How-to-build.md
We welcome contributions of all kinds, for details of how you can help
https://github.com/apache/skywalking/blob/master/CONTRIBUTING.md
Find the issue tracker from here
https://github.com/apache/skywalking/issues
Please help us make Apache SkyWalking better - we appreciate any feedback
you may have.
Enjoy!
-----------------
Licensing
===============================================================================
This software is licensed under the terms you may find in the file
named "LICENSE" in this directory.
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# The agent namespace
# agent.namespace=${SW_AGENT_NAMESPACE:default-namespace}
# The service name in UI
agent.service_name=${SW_AGENT_NAME:Your_ApplicationName}
# The number of sampled traces per 3 seconds
# Negative number means sample traces as many as possible, most likely 100%
# agent.sample_n_per_3_secs=${SW_AGENT_SAMPLE:-1}
# Authentication active is based on backend setting, see application.yml for more details.
# agent.authentication = ${SW_AGENT_AUTHENTICATION:xxxx}
# The max amount of spans in a single segment.
# Through this config item, SkyWalking keep your application memory cost estimated.
# agent.span_limit_per_segment=${SW_AGENT_SPAN_LIMIT:300}
# Ignore the segments if their operation names end with these suffix.
# agent.ignore_suffix=${SW_AGENT_IGNORE_SUFFIX:.jpg,.jpeg,.js,.css,.png,.bmp,.gif,.ico,.mp3,.mp4,.html,.svg}
# If true, SkyWalking agent will save all instrumented classes files in `/debugging` folder.
# SkyWalking team may ask for these files in order to resolve compatible problem.
# agent.is_open_debugging_class = ${SW_AGENT_OPEN_DEBUG:true}
# The operationName max length
# agent.operation_name_threshold=${SW_AGENT_OPERATION_NAME_THRESHOLD:500}
# Backend service addresses.
collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES:127.0.0.1:11800}
# Logging file_name
logging.file_name=${SW_LOGGING_FILE_NAME:skywalking-api.log}
# Logging level
logging.level=${SW_LOGGING_LEVEL:DEBUG}
# Logging dir
# logging.dir=${SW_LOGGING_DIR:""}
# Logging max_file_size, default: 300 * 1024 * 1024 = 314572800
# logging.max_file_size=${SW_LOGGING_MAX_FILE_SIZE:314572800}
# The max history log files. When rollover happened, if log files exceed this number,
# then the oldest file will be delete. Negative or zero means off, by default.
# logging.max_history_files=${SW_LOGGING_MAX_HISTORY_FILES:-1}
# mysql plugin configuration
# plugin.mysql.trace_sql_parameters=${SW_MYSQL_TRACE_SQL_PARAMETERS:false}
No preview for this file type
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论