Linux服务器部署 Elasticsearch 成功,本机却访问不了
Elasticsearch版本: elasticsearch-5.5.2 服务器版本: 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.140...无法打开到主机的连接。 在端口 9200: 连接失败
Linux服务器终端输入 netstat -anp | grep 9200 显示如下:
tcp 0 0 127.0.0.1:9200 0.0.0.0:* LISTEN 2182/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 [4096] for elasticsearch process is too low, increase to at least [65536] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
更改limits.conf,添加配置 : vim /etc/security/limits.conf (elk是启动 elasticsearch 的linux用户)
elk soft nofile 65536 elk hard nofile 65536
更改sysctl.conf,添加配置 : vi /etc/sysctl.conf
vm.max_map_count=262144
更新完后执行命令: 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前台启动与后台启动】
参考:
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
相关文章
- linux下vim命令具体解释
- linux句柄泄露问题查看
- Linux 常用Shell脚本,后端开发必备
- 第三十八章 在 UNIX®、Linux 和 macOS 上使用 IRIS(三)
- Linux内核sysrq调试调优
- Linux中显示系统中USB信息的lsusb命令
- Linux集群和自动化维3.1 Python语言的应用领域
- golang编译程序在linux上的部署
- linux禁ping和允许ping的方法
- linux常用命令二
- 如何生成指定架构的Linux内核默认配置文件
- 常用Linux命令选项
- Linux使用 RPM 安装 Elasticsearch
- 《高性能Linux服务器构建实战:系统安全、故障排查、自动化运维与集群架构》——2.3 网络性能评估工具iperf
- 转 Linux进程状态分析
- elasticsearch linux安装及集成源码
- 【嵌入式Linux驱动开发】八、LED驱动尽善尽美 - 设备树点亮一盏假的LED
- 在U盘上安装Linux系统解决方案
- 《Linux命令行与shell脚本编程大全 第3版》Linux命令行---57