Commit eb72ee58 authored by duanledexianxianxian's avatar duanledexianxianxian 😁

update config file

parent d0ab1805
Pipeline #110 failed
......@@ -26,6 +26,26 @@ springboot与spring cloud兼容版本
9300-9399:统一配置中心
### 分布式服务跟踪
分布式服务跟踪标准**Open Tracing**,与实现平台无关、厂商无关的分布式服务跟踪;
国内的分布式服务跟踪实现:
1. 淘宝的 “鹰眼”
2. 京东的 “Hydra”
3. 大众点评的 “CAT”
4. 新浪的 “Watchman”
5. 唯品会的 “Microscope”
6. 窝窝网的 “Tracing”
### 启动内网穿透
1.下载工具,地址https://github.com/open-dingtalk/pierced
2. 进入windows_64目录
3. 运行 ding.exe -config=./ding.cfg -subdomain=duanledexian 9300
### 问题
......@@ -49,4 +69,7 @@ springboot与spring cloud兼容版本
### 参考
1. https://windmt.com/2018/04/14/spring-cloud-1-services-governance/
2. https://blog.csdn.net/libertine1993/article/details/80765886
3. https://www.jianshu.com/p/e148afe66367
4. https://natapp.cn/article/natapp_newbie
5. https://my.oschina.net/u/3266761/blog/2245498
package com.duanledexian.spring.cloud.config.filter;
import org.springframework.core.annotation.Order;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
/**
* @author duanledexianxianxian
* @date 2019/8/31 1:32
* @since 1.0.0
*/
@WebFilter(filterName = "bodyFilter", urlPatterns = "/*")
@Order(1)
public class BodyFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String url = new String(httpServletRequest.getRequestURI());
//只过滤/actuator/bus-refresh请求
if (!url.endsWith("/bus-refresh")) {
filterChain.doFilter(servletRequest, servletResponse);
return;
}
//使用HttpServletRequest包装原始请求达到修改post请求中body内容的目的
CustometRequestWrapper requestWrapper = new CustometRequestWrapper(httpServletRequest);
filterChain.doFilter(requestWrapper, servletResponse);
}
@Override
public void destroy() {
}
}
package com.duanledexian.spring.cloud.config.filter;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.io.ByteArrayInputStream;
import java.io.IOException;
/**
* @author duanledexianxianxian
* @date 2019/8/31 1:31
* @since 1.0.0
*/
public class CustometRequestWrapper extends HttpServletRequestWrapper {
/**
* Constructs a request object wrapping the given request.
*
* @param request The request to wrap
* @throws IllegalArgumentException if the request is null
*/
public CustometRequestWrapper(HttpServletRequest request) {
super(request);
}
@Override
public ServletInputStream getInputStream() throws IOException {
byte[] bytes = new byte[0];
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
return new ServletInputStream() {
@Override
public boolean isFinished() {
return byteArrayInputStream.read() == -1 ? true : false;
}
@Override
public boolean isReady() {
return false;
}
@Override
public void setReadListener(ReadListener readListener) {
}
@Override
public int read() throws IOException {
return byteArrayInputStream.read();
}
};
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>spring-cloud-hello-world</artifactId>
<groupId>com.duanledexian.spring.cloud</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hello-config-server</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
</project>
package com.duanledexian.spring.cloud.config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
/**
* 配置服务中心
* <p>@EnableConfigServer 激活对配置中心的支持</p>
*
* @author Administrator
* @version 1.0.0
*/
@SpringBootApplication
@EnableConfigServer
public class SpringConfigServiceApplication {
/**
* The entry point of application.
*
* @param args the input arguments
*/
public static void main(String[] args) {
SpringApplication.run(SpringConfigServiceApplication.class, args);
}
}
server:
# 服务器端口
port: 9300
eureka:
client:
service-url:
defaultZone: http://localhost:9000/eureka/
spring:
application:
name: config-server
cloud:
config:
server:
git:
# 配置git仓库的地址
uri: http://platform.kuopu.net:9999/gitlab/duanledexianxianxian/spring-cloud-learn.git
# git仓库地址下的相对地址,可以配置多个,用,分割。
search-paths: spring-cloud-hello-world/config-repo
skip-ssl-validation: false
......@@ -32,5 +32,9 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
</dependencies>
</project>
......@@ -3,7 +3,7 @@ server:
port: 9204
hello:
name: "order application default name"
name: "order application default name version 2"
spring:
application:
......@@ -12,4 +12,4 @@ management:
endpoints:
web:
exposure:
include: refresh,info
include: refresh,bus-refresh,info,health
......@@ -12,6 +12,11 @@ spring:
discovery:
enabled: true
service-id: config-server
rabbitmq:
port: 9005
username: admin
password: "!admin!"
host: 113.105.144.9
eureka:
client:
......
......@@ -32,6 +32,10 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
</dependencies>
</project>
......@@ -12,4 +12,4 @@ management:
endpoints:
web:
exposure:
include: refresh
include: refresh,bus-refresh,info,health
......@@ -12,6 +12,11 @@ spring:
discovery:
enabled: true
service-id: config-server
rabbitmq:
port: 9005
username: admin
password: "!admin!"
host: 113.105.144.9
eureka:
client:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment