
正文
Linux服务器部署 Elasticsearch 成功,本机却访问不了
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
Elasticsearch版本: elasticsearch-5.5.
服务器版本: CentOS release 6.8 (Final)
问题:
Linux服务器上部署了 Elasticsearch 5.5.2,服务器上可以访问 curl -XGET 'localhost:9200/?pretty'。
在本机上访问http://59.110.169.140:9200/?pretty,报如下错误:
dial tcp 59.110.169.140:9200: connectex: No connection could be made because the target machine actively refused it.
分析:
本机 cmd 输入 telnet 59.110.169.140 9200,返回端口连接失败
正在连接59.110.169....无法打开到主机的连接。 在端口 : 连接失败
Linux服务器终端输入 netstat -anp | grep 9200 显示如下:
tcp 127.0.0.1: 0.0.0.0:* LISTEN /java
可以看出问题在于,9200端口被限制为本机访问,外网访问不了
更改 Elasticsearch 配置: vim elasticsearch-5.5.2/config/elasticsearch.yml
network.host: 0.0.0.0
重启 elasticsearch后,报错如下:
seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
更改 Elasticsearch 配置: vim elasticsearch-5.5.2/config/elasticsearch.yml
bootstrap.system_call_filter: false
重启 elasticsearch后,报错如下:
max file descriptors [] for elasticsearch process is too low, increase to at least []
max virtual memory areas vm.max_map_count [] is too low, increase to at least []
更改limits.conf,添加配置 : vim /etc/security/limits.conf (elk是启动 elasticsearch 的linux用户)
elk soft nofile
elk hard nofile
更改sysctl.conf,添加配置 : vi /etc/sysctl.conf
vm.max_map_count=
更新完后执行命令: sysctl -p
至此,本机访问 http://59.110.169.140:9200/?pretty 时返回成功:
{
"name": "xAQfKvG",
"cluster_name": "elasticsearch",
"cluster_uuid": "20UPyh0bQr-J8SGwtK_uTw",
"version": {
"number": "5.5.2",
"build_hash": "b2f0c09",
"build_date": "2017-08-14T12:33:14.154Z",
"build_snapshot": false,
"lucene_version": "6.6.0"
},
"tagline": "You Know, for Search"
}
Linux服务器终端输入 netstat -anp | grep 9200 显示如下:
tcp 0 0 0.0.0.0:9200 0.0.0.0:* LISTEN 5023/java
【elasticsearch前台启动与后台启动】
进入目录:cd /opt/elasticsearch/elasticsearch-5.2.1/bin
前台启动:./elasticsearch
后台启动:nohup ./elasticsearch &
./elasticsearch -d
@see : http://blog.csdn.net/llq_200/article/details/70314777
参考:
http://blog.csdn.net/zhu_xun/article/details/41115389
https://my.oschina.net/u/2510243/blog/810520
https://discuss.elastic.co/t/bindtransportexception-failed-to-bind-to-9300-9400/65443







