本文介绍MSHA数据面的常见问题以及解决方案。
MSHA-agent日志在哪里?
MSHA-agent日志打印目录(每个进程一个日志目录):~/logs/msha/agent.$processId.$localIdentity/。
MSHA-agent日志目录如下图所示:
您需要主要关注的日志文件:
- agent.log:启动日志。
- agent_plugin.log:Agent插件AOP切面日志。
- agent_error.log:Agent异常日志。
同城多活单元格流量切零后,企业版RocketMQ的ons.log中为什么会出现日志brokerName=msha_mock_queueBrokerName
?
日志如下:
2021-03-31 23:59:34,034 INFO RocketmqClient
- topicRouteTable.put.Topic = MQ_INST_1815555058395900_BbCHFzvM%xiniao_pra_callback,
TopicRouteData
[TopicRouteData
[orderTopicConf=null, queueDatas=
[QueueData
[brokerName=msha_mock_queueBrokerName, readQueueNums=8, writeQueueNums=8, perm=6, topicSynFlag=0]
],
brokerDatas=
[BrokerData
[brokerName=msha_mock_brokerName, brokerAddrs={0=1.2.3.4:80}]
],
filterServerTable={}
]
]
这只是RocketMQ更新地址池信息topicRouteTable.put的日志,里面打印的brokerName=msha_mock_brokerName
(已经是MSHA-agent地址池过滤后放入的一个虚拟brokerName了)。这个日志说明流量切零是生效的,这台机器已经不会再消费消息了。
异地多活如何查看MSHA-agent是否从HTTP流量中提取出了路由标?
查看agent_plugin.log日志,会打印出Servlet切面before和after的2行日志,从下面示例中routeId:JoeHeader
可以看出提取出的路由标为JoeHeader
。
2021-05-13 15:12:39,750 INFO http-nio-7004-exec-1
com.alibaba.msha.agent.plugin.servlet.trace.ServletEnhancerHandler
- beforeAdvice invoked, url:http://localhost:7004/echo/xx, httpRouteIdConfigs:{5bec72a6-8e0c-4ad1-9846-87e2442bd034=HttpRouteIdConfig{routeType='default', routeIdSources=[arg, header, cookie], routeIdKey='key123yyybbbb'}}, httpHeader:{host=localhost:7004, user-agent=curl/7.54.0, accept=*/*, key123yyybbbb=JoeHeader}, httpCookie:{}
2021-05-13 15:12:39,751 INFO http-nio-7004-exec-1
com.alibaba.msha.agent.plugin.servlet.trace.ServletEnhancerHandler
- routeId found in HTTP flow, routeId:JoeHeader, routeIdSource:header, routeIdKey:key123yyybbbb