我刚刚从https://www.elastic.co/downloads/elasticsearch通过 DEB(我使用 Debian 9)包使用以下命令:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.4.deb
dpkg -i elasticsearch-5.6.4.deb
apt-get install openjdk-8-jre-headless
update-rc.d elasticsearch defaults 95 10
service elasticsearch start
但是 ElasticSearch 无法启动,这是日志:
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2017-11-13 16:59:24 UTC; 13min ago
Docs: http://www.elastic.co
Process: 16503 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet -Edefault.path.logs=${LOG_DIR} -Edefault.path.data=${DATA_DIR} -Edefault.path.conf=${CONF_DIR} (code=exited, statu
Process: 16500 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS)
Main PID: 16503 (code=exited, status=1/FAILURE)
Nov 13 16:59:12 Mysite systemd[1]: Starting Elasticsearch...
Nov 13 16:59:12 Mysite systemd[1]: Started Elasticsearch.
Nov 13 16:59:24 Mysite systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Nov 13 16:59:24 Mysite systemd[1]: elasticsearch.service: Unit entered failed state.
Nov 13 16:59:24 Mysite systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
但它没有说出任何有用的东西。
在配置文件中我仅更改了这一点:
network.host: 51.15.212.76
http.port: 9200
cluster.name: elasticsearch
node.name: "db-master"
node.master: true
node.data: true
更新:
我只是使用了默认设置并且它可以工作,问题出在这里:
Caused by: java.net.BindException: Cannot assign requested address
为什么?我正在使用我的 IP 地址(我复制了它)。我不想将它绑定到本地主机,因为我希望能够从不同的机器连接它。
ifconfig -a 的结果
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.5.85.149 netmask 255.255.255.254 broadcast 10.5.85.149
inet6 fe80::207:cbff:fe0b:4d8c prefixlen 64 scopeid 0x20<link>
ether 00:07:cb:0b:4d:8c txqueuelen 1000 (Ethernet)
RX packets 18975397 bytes 14313412446 (13.3 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 61630671 bytes 85441277828 (79.5 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0x80000000-8001ffff
ip6_vti0: flags=128<NOARP> mtu 1500
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 1 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ip6tnl0: flags=128<NOARP> mtu 1452
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 1 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 26883466 bytes 4169327225 (3.8 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 26883466 bytes 4169327225 (3.8 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
sit0: flags=128<NOARP> mtu 1480
sit txqueuelen 1 (IPv6-in-IPv4)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
答案1
51.15.212.76
问题是你的服务器上没有。你的提供商可能会映射51.15.212.76
->10.5.85.149
所以尝试一下
network.host: 10.5.85.149
或者最好绑定到所有接口
network.host: 0.0.0.0
答案2
我看到了您的更新。您不能使用此配置:
network.host: 51.15.212.76
因为您没有具有此 IP 地址的网络接口。
例如,您可以从 eth0 使用这个 10.5.85.149。
答案3
您需要从
network.host: 51.15.212.76
到
network.host: 0.0.0.0
并在elasticsearch.yml文件中添加以下配置
transport.host: localhost
transport.tcp.port: 9300