1. 程式人生 > >解決elasticsearch:Exception BindTransportException[Failed to bind to [9300-9400]]

解決elasticsearch:Exception BindTransportException[Failed to bind to [9300-9400]]

Linux7.4使用elasticsearch2.2.1啟動報錯:

[2018-09-20 23:24:17,887][INFO ][node                     ] [Paibo] starting ...
Exception in thread "main" BindTransportException[Failed to bind to [9300-9400]]; nested: ChannelException[Failed to bind to: /192.168.0.1:9400]; nested: BindException[Cannot assign requested address];
Likely root cause: java.net.BindException: Cannot assign requested address
        at sun.nio.ch.Net.bind0(Native Method)
        at sun.nio.ch.Net.bind(Net.java:444)
        at sun.nio.ch.Net.bind(Net.java:436)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
        at org.jboss.netty.channel.socket.nio.NioServerBoss$RegisterTask.run(NioServerBoss.java:193)
        at org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:391)
        at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:315)
        at org.jboss.netty.channel.socket.nio.NioServerBoss.run(NioServerBoss.java:42)
        at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
        at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Refer to the log for complete error details.

原因:

配置檔案/.../elasticsearch-2.2.1/config/elasticsearch.yml中
network.host不對

度娘部落格有的說用:0.0.0.0,有的說用127.0.0.1,實操發現:都是騙子。

解法:

改為當前伺服器內網ip即可(實操使用阿里雲伺服器)

另:改為127.0.0.1,報錯解決,但http無法訪問。