凡事都在事上磨,这样才能精进,成长进步提高! ------ 博客园首页

rocketmq启动broker报错解决

nameserv启动成功

Java HotSpot(TM) 64-Bit Server VM warning: Using the DefNew young collector with the CMS collector is deprecated and wil

l likely be removed in a future release
Java HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a f
uture release.
Java HotSpot(TM) 64-Bit Server VM warning: MaxNewSize (262144k) is equal to or greater than the entire heap (262144k).
A new max generation size of 262080k will be used.
The Name Server boot success. serializeType=JSON

但是在启动broker的时候却报如下错误

09:52:26.079 [main] ERROR RocketmqCommon - Failed to obtain the host name

java.net.UnknownHostException: iZ2zeimcfkiefeubgwx3whZ: iZ2zeimcfkiefeubgwx3whZ: unknown error
        at java.net.InetAddress.getLocalHost(InetAddress.java:1505) ~[na:1.8.0_65]
        at org.apache.rocketmq.common.BrokerConfig.localHostName(BrokerConfig.java:202) [rocketmq
        at org.apache.rocketmq.common.BrokerConfig.<init>(BrokerConfig.java:39) [rocketmq-common-4.2.0.jar:4.2.0]
        at org.apache.rocketmq.broker.BrokerStartup.createBrokerController(BrokerStartup.java:101) [rocketmq-broker-4.2.
0.jar:4.2.0]
        at org.apache.rocketmq.broker.BrokerStartup.main(BrokerStartup.java:56) [rocketmq-broker-4.2.0.jar:4.2.0]
Caused by: java.net.UnknownHostException: iZ2zeimcfkiefeubgwx3whZ: unknown error
        at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) ~[na:1.8.0_65]
        at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928) ~[na:1.8.0_65]
        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323) ~[na:1.8.0_65]
        at java.net.InetAddress.getLocalHost(InetAddress.java:1500) ~[na:1.8.0_65]
        ... 4 common frames omitted

解决办法如下:

 

这是由于启动的时候找不到自己的主机名对应的ip地址而造成的,只需要让在/etc/hosts中添加如上配置,就可以了。
————————————————
版权声明:本文为CSDN博主「zhx_5359」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/zhx_5359/article/details/80748025

posted @ 2021-04-14 01:02  zeenzhou  阅读(35)  评论(0编辑  收藏