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

View File

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

View File

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

View File

@ -41,7 +41,7 @@
spring:
# 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
username: root # 请修改成你本地的 MySQL username
password: ${MALL_MYSQL_PASSWORD} # 请修改成你本地的 MySQL password

View File

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

View File

@ -1,7 +1,7 @@
spring:
# 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
username: root
password: ${MALL_MYSQL_PASSWORD}

View File

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

View File

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

View File

@ -1,7 +1,7 @@
spring:
# 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
username: root
password: ${MALL_MYSQL_PASSWORD}
@ -44,7 +44,7 @@ dubbo:
# rocketmq
rocketmq:
name-server: 127.0.0.1:9876
name-server: s1.iocoder.cn:9876
producer:
group: pay-producer-group

View File

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

View File

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

View File

@ -1,7 +1,7 @@
spring:
# 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
username: root
password: ${MALL_MYSQL_PASSWORD}

View File

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

View File

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

View File

@ -2,7 +2,7 @@ spring:
# datasource
datasource:
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
username: root
password: ${MALL_MYSQL_PASSWORD}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
spring:
# 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
username: root
password: ${MALL_MYSQL_PASSWORD}