前言
大家好,我是小郭,之前在Docker下安装了RocketMQ以及他的管理平台,但是管理平台在运维的时候只能满足我们部分的需求,所以为了在集群运维时能够的得心应手,研究了下mqadmin的使用,没想到一开始就遇到了报错,在这里和大家分享下解决的方法。
使用mqadmin的异常信息
[rocketmq@9721b06bb988 bin]$ mqadmin topicList -n 127.0.0.1:9876 RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0). RocketMQLog:WARN Please initialize the logger system properly. org.apache.rocketmq.tools.command.SubCommandException: TopicListSubCommand command failed at org.apache.rocketmq.tools.command.topic.TopicListSubCommand.execute(TopicListSubCommand.java:113) at org.apache.rocketmq.tools.command.MQAdminStartup.main0(MQAdminStartup.java:139) at org.apache.rocketmq.tools.command.MQAdminStartup.main(MQAdminStartup.java:90) Caused by: org.apache.rocketmq.acl.common.AclException: [10015:signature-failed] unable to calculate a request signature. error=[10015:signature-failed] unable to calculate a request signature. error=Algorithm HmacSHA1 not available at org.apache.rocketmq.acl.common.AclSigner.signAndBase64Encode(AclSigner.java:84) at org.apache.rocketmq.acl.common.AclSigner.calSignature(AclSigner.java:73) at org.apache.rocketmq.acl.common.AclSigner.calSignature(AclSigner.java:68) at org.apache.rocketmq.acl.common.AclUtils.calSignature(AclUtils.java:69) at org.apache.rocketmq.acl.common.AclClientRPCHook.doBeforeRequest(AclClientRPCHook.java:44) at org.apache.rocketmq.remoting.netty.NettyRemotingAbstract.doBeforeRpcHooks(NettyRemotingAbstract.java:172) at org.apache.rocketmq.remoting.netty.NettyRemotingClient.invokeSync(NettyRemotingClient.java:368) at org.apache.rocketmq.client.impl.MQClientAPIImpl.getTopicListFromNameServer(MQClientAPIImpl.java:1398) at org.apache.rocketmq.tools.admin.DefaultMQAdminExtImpl.fetchAllTopicList(DefaultMQAdminExtImpl.java:253) at org.apache.rocketmq.tools.admin.DefaultMQAdminExt.fetchAllTopicList(DefaultMQAdminExt.java:218) at org.apache.rocketmq.tools.command.topic.TopicListSubCommand.execute(TopicListSubCommand.java:107) ... 2 more Caused by: org.apache.rocketmq.acl.common.AclException: [10015:signature-failed] unable to calculate a request signature. error=Algorithm HmacSHA1 not available at org.apache.rocketmq.acl.common.AclSigner.sign(AclSigner.java:63) at org.apache.rocketmq.acl.common.AclSigner.signAndBase64Encode(AclSigner.java:79) ... 12 more Caused by: java.security.NoSuchAlgorithmException: Algorithm HmacSHA1 not available at javax.crypto.Mac.getInstance(Mac.java:181)
根据错误的信息我们主要看一下错误编码10015,主要说的是signature-failed,不能够计算请求的签名
解决方案
方案一:上网搜索的方案都是修改Broker下的tools.sh文件,在文件中添加jre/lib/ext目录,我也跟着配置了一下,但是发现好像依然没有办法解决报错的问题。
方案二:在部署RocketMQ集群的虚拟机上执行export NAMESRV_ADDR=ip:9876
,我试了下也没有小郭
方案三:进入jdk目录中找到sunjec_provider.jar,将jar包复制到Broker的lib下,在输入命令完成运行
网络异常,图片无法展示
|
再次运行 就可以看到正确的输出了
[rocketmq@d4f9b634b4b2 bin]$ mqadmin topicList RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0). RocketMQLog:WARN Please initialize the logger system properly. %RETRY%please_rename_unique_group_name RMQ_SYS_TRANS_HALF_TOPIC %RETRY%scGroup %RETRY%please_rename_unique_group_name_4 TRANS_CHECK_MAX_TIME_TOPIC