1. 引入 Spring Cloud Sentinel,后续做进一步集成

2. 重新搭建 Elasticsearch 服务,并接入 search 服务
This commit is contained in:
YunaiV 2020-04-14 20:10:40 +08:00
parent 90391664cc
commit 059dbc6c79
24 changed files with 74 additions and 57 deletions

View File

@ -67,9 +67,11 @@
**SkyWalking UI** **SkyWalking UI**
* 地址http://skywalking-ui.shop.iocoder.cn:18099 * 地址http://skywalking.shop.iocoder.cn
* 管理员账号admin / admin * 管理员账号admin / admin
> 教程:[《芋道 SkyWalking 安装部署》](http://www.iocoder.cn/SkyWalking/install/?onemall)
**Grafana UI** **Grafana UI**
* 地址http://grafana.shop.iocoder.cn:18099 * 地址http://grafana.shop.iocoder.cn:18099
@ -83,19 +85,22 @@
**RocketMQ Console** **RocketMQ Console**
* 地址http://rocketmq-console.shop.iocoder.cn:18099 * 地址http://rocketmq.shop.iocoder.cn
* 管理员账号admin / RPsa2GHjTNs8pxEU
> 教程:[《芋道 RocketMQ 安装部署》](http://www.iocoder.cn/RocketMQ/install/?onemall)
**XXL-Job Console**
* 地址http://job.shop.iocoder.cn
* 管理员账号admin / 233666
> 教程:[《芋道 RocketMQ 安装部署》](http://www.iocoder.cn/XXL-JOB/install/?onemall)
**Sentinel Console** **Sentinel Console**
* 地址http://sentinel.shop.iocoder.cn:18099 * 地址http://sentinel.shop.iocoder.cn:18099
* 账号sentinel / sentinel * 账号sentinel / sentinel
**XXL-Job Console**
* 地址http://job-console.shop.iocoder.cn:18099
* 管理员账号admin / 233666
# 技术 # 技术
## 搭建环境 ## 搭建环境

View File

@ -2,32 +2,32 @@
module.exports = { module.exports = {
'/admin-api/': { '/admin-api/': {
target: 'http://api.shop.iocoder.cn:18099', target: 'http://api.shop.iocoder.cn',
changeOrigin: true, changeOrigin: true,
pathRewrite: {}, pathRewrite: {},
}, },
'/product-api/': { '/product-api/': {
target: 'http://api.shop.iocoder.cn:18099', target: 'http://api.shop.iocoder.cn',
changeOrigin: true, changeOrigin: true,
pathRewrite: {}, pathRewrite: {},
}, },
'/order-api/': { '/order-api/': {
target: 'http://api.shop.iocoder.cn:18099', target: 'http://api.shop.iocoder.cn',
changeOrigin: true, changeOrigin: true,
pathRewrite: {}, pathRewrite: {},
}, },
'/promotion-api/': { '/promotion-api/': {
target: 'http://api.shop.iocoder.cn:18099', target: 'http://api.shop.iocoder.cn',
changeOrigin: true, changeOrigin: true,
pathRewrite: {}, pathRewrite: {},
}, },
'/pay-api/': { '/pay-api/': {
target: 'http://api.shop.iocoder.cn:18099', target: 'http://api.shop.iocoder.cn',
changeOrigin: true, changeOrigin: true,
pathRewrite: {}, pathRewrite: {},
}, },
'/user-api/': { '/user-api/': {
target: 'http://api.shop.iocoder.cn:18099', target: 'http://api.shop.iocoder.cn',
changeOrigin: true, changeOrigin: true,
pathRewrite: {}, pathRewrite: {},
}, },

View File

@ -24,6 +24,8 @@
<dubbo.version>2.7.1</dubbo.version> <dubbo.version>2.7.1</dubbo.version>
<!-- Transaction 相关 --> <!-- Transaction 相关 -->
<seata.version>1.1.0</seata.version> <seata.version>1.1.0</seata.version>
<!-- 监控相关 -->
<skywalking.version>7.0.0</skywalking.version>
</properties> </properties>
<!-- 依赖管理 --> <!-- 依赖管理 -->
@ -66,6 +68,12 @@
<version>${seata.version}</version> <version>${seata.version}</version>
</dependency> </dependency>
<!-- 监控相关 -->
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-trace</artifactId>
<version>${skywalking.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>

View File

@ -41,7 +41,7 @@
spring: spring:
# datasource # datasource
datasource: datasource:
url: jdbc:mysql://180.167.213.26:13306/mall_product?useSSL=false&useUnicode=true&characterEncoding=UTF-8 # 请修改成你本地的 MySQL url url: jdbc:mysql://s1.iocoder.cn:3306/mall_product?useSSL=false&useUnicode=true&characterEncoding=UTF-8 # 请修改成你本地的 MySQL url
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
username: root # 请修改成你本地的 MySQL username username: root # 请修改成你本地的 MySQL username
password: ${MALL_MYSQL_PASSWORD} # 请修改成你本地的 MySQL password password: ${MALL_MYSQL_PASSWORD} # 请修改成你本地的 MySQL password

View File

@ -7,8 +7,8 @@ spring:
# Spring Cloud Sentinel 配置项 # Spring Cloud Sentinel 配置项
sentinel: sentinel:
transport: transport:
dashboard: localhost:12088 dashboard: s1.iocoder.cn:12088 # Sentinel Dashboard 服务地址
eager: false eager: true # 项目启动时,直接连接到 Sentinel
# server # server
server: server:

View File

@ -1,7 +1,7 @@
spring: spring:
# datasource # datasource
datasource: datasource:
url: jdbc:mysql://180.167.213.26:13306/mall_order?useSSL=false&useUnicode=true&characterEncoding=UTF-8 url: jdbc:mysql://s1.iocoder.cn:3306/mall_order?useSSL=false&useUnicode=true&characterEncoding=UTF-8
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
username: root username: root
password: ${MALL_MYSQL_PASSWORD} password: ${MALL_MYSQL_PASSWORD}

View File

@ -7,8 +7,8 @@ spring:
# Spring Cloud Sentinel 配置项 # Spring Cloud Sentinel 配置项
sentinel: sentinel:
transport: transport:
dashboard: localhost:12088 dashboard: s1.iocoder.cn:12088 # Sentinel Dashboard 服务地址
eager: false eager: true # 项目启动时,直接连接到 Sentinel
# server # server
server: server:

View File

@ -2,7 +2,7 @@
xxl: xxl:
job: job:
admin: admin:
addresses: http://127.0.0.1:18079/ addresses: http://s1.iocoder.cn:18079/
executor: executor:
appname: pay-job-executor appname: pay-job-executor
ip: ip:

View File

@ -1,7 +1,7 @@
spring: spring:
# datasource # datasource
datasource: datasource:
url: jdbc:mysql://180.167.213.26:13306/mall_pay?useSSL=false&useUnicode=true&characterEncoding=UTF-8 url: jdbc:mysql://s1.iocoder.cn:3306/mall_pay?useSSL=false&useUnicode=true&characterEncoding=UTF-8
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
username: root username: root
password: ${MALL_MYSQL_PASSWORD} password: ${MALL_MYSQL_PASSWORD}
@ -44,7 +44,7 @@ dubbo:
# rocketmq # rocketmq
rocketmq: rocketmq:
name-server: 127.0.0.1:9876 name-server: s1.iocoder.cn:9876
producer: producer:
group: pay-producer-group group: pay-producer-group

View File

@ -52,7 +52,6 @@
<org.projectlombok.version>1.16.14</org.projectlombok.version> <org.projectlombok.version>1.16.14</org.projectlombok.version>
<qiniu.version>7.2.18</qiniu.version> <qiniu.version>7.2.18</qiniu.version>
<skywalking.version>6.1.0</skywalking.version>
<servlet.version>2.5</servlet.version> <servlet.version>2.5</servlet.version>
@ -177,12 +176,7 @@
<version>${qiniu.version}</version> <version>${qiniu.version}</version>
</dependency> </dependency>
<!-- 监控相关 -->
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-trace</artifactId>
<version>${skywalking.version}</version>
</dependency>
<dependency> <dependency>
<groupId>de.codecentric</groupId> <groupId>de.codecentric</groupId>

View File

@ -7,8 +7,8 @@ spring:
# Spring Cloud Sentinel 配置项 # Spring Cloud Sentinel 配置项
sentinel: sentinel:
transport: transport:
dashboard: localhost:12088 dashboard: s1.iocoder.cn:12088 # Sentinel Dashboard 服务地址
eager: false eager: true # 项目启动时,直接连接到 Sentinel
# server # server
server: server:

View File

@ -1,7 +1,7 @@
spring: spring:
# datasource # datasource
datasource: datasource:
url: jdbc:mysql://180.167.213.26:13306/mall_product?useSSL=false&useUnicode=true&characterEncoding=UTF-8 url: jdbc:mysql://s1.iocoder.cn:3306/mall_product?useSSL=false&useUnicode=true&characterEncoding=UTF-8
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
username: root username: root
password: ${MALL_MYSQL_PASSWORD} password: ${MALL_MYSQL_PASSWORD}

View File

@ -7,8 +7,8 @@ spring:
# Spring Cloud Sentinel 配置项 # Spring Cloud Sentinel 配置项
sentinel: sentinel:
transport: transport:
dashboard: localhost:12088 dashboard: s1.iocoder.cn:12088 # Sentinel Dashboard 服务地址
eager: false eager: true # 项目启动时,直接连接到 Sentinel
# server # server
server: server:

View File

@ -72,12 +72,6 @@
<artifactId>spring-cloud-alibaba-seata</artifactId> <artifactId>spring-cloud-alibaba-seata</artifactId>
</dependency> </dependency>
<!-- MQ 相关 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rocketmq</artifactId>
</dependency>
<!-- Job 相关 --> <!-- Job 相关 -->
<dependency> <dependency>
<groupId>com.xuxueli</groupId> <groupId>com.xuxueli</groupId>

View File

@ -2,7 +2,7 @@ spring:
# datasource # datasource
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://180.167.213.26:13306/mall_promotion?useSSL=false&useUnicode=true&characterEncoding=UTF-8 url: jdbc:mysql://s1.iocoder.cn:3306/mall_promotion?useSSL=false&useUnicode=true&characterEncoding=UTF-8
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
username: root username: root
password: ${MALL_MYSQL_PASSWORD} password: ${MALL_MYSQL_PASSWORD}

View File

@ -7,8 +7,8 @@ spring:
# Spring Cloud Sentinel 配置项 # Spring Cloud Sentinel 配置项
sentinel: sentinel:
transport: transport:
dashboard: localhost:12088 dashboard: s1.iocoder.cn:12088 # Sentinel Dashboard 服务地址
eager: false eager: true # 项目启动时,直接连接到 Sentinel
# server # server
server: server:

View File

@ -15,12 +15,12 @@
<!-- Mall 相关 --> <!-- Mall 相关 -->
<dependency> <dependency>
<groupId>cn.iocoder.mall</groupId> <groupId>cn.iocoder.mall</groupId>
<artifactId>search-service-api</artifactId> <artifactId>mall-spring-boot</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.iocoder.mall</groupId> <groupId>cn.iocoder.mall</groupId>
<artifactId>mall-spring-boot</artifactId> <artifactId>search-service-api</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -1,11 +1,16 @@
# es # es
spring: spring:
application:
name: search-application
data: data:
elasticsearch: elasticsearch:
cluster-name: elasticsearch cluster-name: elasticsearch
cluster-nodes: 180.167.213.26:9300 cluster-nodes: s1.iocoder.cn:9300
repositories: repositories:
enable: true enable: true
elasticsearch:
rest:
uris: s1.iocoder.cn:9200
# Spring Cloud 配置项 # Spring Cloud 配置项
cloud: cloud:
@ -44,6 +49,6 @@ dubbo:
# rocketmq # rocketmq
rocketmq: rocketmq:
name-server: 127.0.0.1:9876 name-server: s1.iocoder.cn:9876
producer: producer:
group: search-producer-group group: search-producer-group

View File

@ -16,6 +16,10 @@ public class ProductSearchServiceImplTest {
@Autowired @Autowired
private ProductRepository productRepository; private ProductRepository productRepository;
static {
System.setProperty("es.set.netty.runtime.available.processors", "false");
}
@Test @Test
public void testRebuild() { public void testRebuild() {
int counts = productSearchService.rebuild(); int counts = productSearchService.rebuild();

View File

@ -84,12 +84,6 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-devtools</artifactId>-->
<!-- <optional>true</optional>-->
<!-- </dependency>-->
</dependencies> </dependencies>
<build> <build>

View File

@ -2,6 +2,13 @@ spring:
application: application:
name: admin-application name: admin-application
# Spring Cloud 配置项
cloud:
# Spring Cloud Sentinel 配置项
sentinel:
transport:
dashboard: s1.iocoder.cn:12088 # Sentinel Dashboard 服务地址
eager: true # 项目启动时,直接连接到 Sentinel
# server # server
server: server:

View File

@ -62,6 +62,12 @@
<artifactId>swagger-bootstrap-ui</artifactId> <artifactId>swagger-bootstrap-ui</artifactId>
</dependency> </dependency>
<!-- 服务保障相关 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- 监控相关 --> <!-- 监控相关 -->
<dependency> <dependency>

View File

@ -7,8 +7,8 @@ spring:
# Spring Cloud Sentinel 配置项 # Spring Cloud Sentinel 配置项
sentinel: sentinel:
transport: transport:
dashboard: localhost:12088 dashboard: s1.iocoder.cn:12088 # Sentinel Dashboard 服务地址
eager: false eager: true # 项目启动时,直接连接到 Sentinel
# server # server
server: server:

View File

@ -1,7 +1,7 @@
spring: spring:
# datasource # datasource
datasource: datasource:
url: jdbc:mysql://180.167.213.26:13306/mall_user?useSSL=false&useUnicode=true&characterEncoding=UTF-8 url: jdbc:mysql://s1.iocoder.cn:3306/mall_user?useSSL=false&useUnicode=true&characterEncoding=UTF-8
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
username: root username: root
password: ${MALL_MYSQL_PASSWORD} password: ${MALL_MYSQL_PASSWORD}