現象
服務器連不上,kafka報connection refused
測試發現kafka某台node(xx)的問題,登錄上去也各種錯誤,zkServer.sh restart可以完成,但status報連不上。報錯比較迷惑人,打開java log看到其他錯誤:
——————————
kafka complains connection refused. check it's a node's problem, even restart cannot fix. see java log below:
[myid:3] - INFO [ListenerThread:QuorumCnxManager$Listener@534] - My election bind port: /yy:3888 java.net.BindException: Cannot assign requested address ... [myid:3] - WARN [WorkerSender[myid=3]:QuorumCnxManager@400] - Cannot open channel to 1 at election address /xx:3888 java.net.ConnectException: Connection refused
其實這個錯誤可以看出來,出現了xx和yy2個地址,說明它認錯了自己
——————————
the cause is setting config wrong
解決方案
從zoo.cfg看下datadir,將下面的myid改成和zoo.cfg里的自己一樣的。比如xx是
server.1=xx:2888:3888 server.2=yy:2888:3888 server.3=zz:2888:3888
那么它的myid必須是1
————————————
the right way is to make myid's id same with zoo.cfg's