tmerclub-doc/常见问题及配置/发布的商品不显示、修改的商品信息没有更新.md
2025-03-19 15:04:57 +08:00

131 lines
2.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 常见问题
##### 1.成功发布商品后商品列表没有看到新发布的商品
##### 2.成功修改了商品的信息,但列表中显示的数据还是旧的
## 排查步骤
注意: 配置成功后丢失的数据不会自动补全的需要到mysql中更新对应表来触发数据同步
`场景`:新增的商品没有显示
`处理方案`
1. 按下面的步骤将canal相关配置更正
2. (这一步也很重要)配置成功后,更新表中的字段,触发数据同步, 比如:更新商品表的时间字段`update set set update_time = now()`
### 1.canal没有读取到mysql的binlog
mysql查询binglog位置
```mysql
SHOW MASTER STATUS
```
编辑`./canal/conf/example/instance.properties`
修改以下四个参数
```properties
# 填写数据库地址
canal.instance.master.address=192.168.193.128:3306
# 填写执行命令`SHOW MASTER STATUS`后的File内容
canal.instance.master.journal.name=mysql-binlog.000001
# username/password
# 填写数据库账号
canal.instance.dbUsername=canal
# 填写数据库密码
canal.instance.dbPassword=hn02le.34lkdLKD
```
![image-20210621131013166](../img/中间件安装/canal配置-01.png)
重启`canal`
```shell
docker restart mall4cloud-canal
```
### 2.canal没有连接上RocketMQ
查看 `./canal/logs/example` 中的 `example.log`
日志:
![image-20210621131013166](../img/中间件安装/canal配置-02.png)
编辑`./canal/conf/canal.properties`
```properties
# 填写RocketMQ地址
rocketmq.namesrv.addr = 192.168.193.128:9876
```
![image-20210621131013166](../img/中间件安装/canal配置-03.png)
重启`canal`
```shell
docker restart mall4cloud-canal
```
### 3. RocketMQ消息超出长度限制
查看 `./canal/logs/example` 中的 `example.log` 如果是以下报错信息,就是消息长度超过限制了
```
the message is illegal, maybe msg body or properties length not matched. msg body length limit 128k
```
编辑 `./rocketmq/broker/conf` 中的 `broker.conf`
```
#限制的消息大小
maxMessageSize=4194304
```
![image-20210621131013166](../img/中间件安装/canal配置-04.png)
重启`rocketmq`
```shell
docker restart mall4cloud-rocketmq-broker
```
### 4. 更改过mq或者数据库名称
如果有更改过数据库名称且canal已配置成可以发送mq后数据还是没有更新
先去mq的控制台, 查看队列`canal-topic`的消费情况,
mq没有被消费按以下情况进行排查
- `mall4cloud-search`服务没启动
- `mall4cloud-search`服务执行异常,看日志处理下
- canal中配置的队列名称和`mall4cloud-search`服务中监听的不一致如果没有更改过mq队列名称则忽略此步骤
更改了数据库、表名称mq消费成功但数据还是不正确解决方法
![canal配置-001.png](../img/常见问题/canal配置-001.png)
`@CanalModel`中配置的数据库和表名与mysql中的对应上