环境: elasticsearch 6.5.2, java


连接失败

启动后当你 使用 curl http://localhost:9200 测试时,得到如下结果

Curl: (7) Failed connect to localhost:9200; Connection refused

这个问题一般是其他问题导致的,请看你启动日志,如果用的管理服务工具来启动的,则看它的日志,我这里是 systemctl ,然后命令以及输出结果是

root@localhost ~]# systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2018-12-10 15:26:08 EST; 11min ago
     Docs: http://www.elastic.co
  Process: 22651 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAILURE)
 Main PID: 22651 (code=exited, status=1/FAILURE)

Dec 10 15:26:08 localhost.localdomain systemd[1]: Started Elasticsearch.
Dec 10 15:26:08 localhost.localdomain systemd[1]: Starting Elasticsearch...
Dec 10 15:26:08 localhost.localdomain elasticsearch[22651]: which: no java in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin)
Dec 10 15:26:08 localhost.localdomain elasticsearch[22651]: could not find java; set JAVA_HOME or ensure java is in PATH
Dec 10 15:26:08 localhost.localdomain systemd[1]: elasticsearch.service: main process exited, code=exited, status=1/FAILURE
Dec 10 15:26:08 localhost.localdomain systemd[1]: Unit elasticsearch.service entered failed state.
Dec 10 15:26:08 localhost.localdomain systemd[1]: elasticsearch.service failed.

没有发现 java 环境

如上图错误细节,告诉我们没有java 相关环境,首先确认下 是否能 运行 java,不过不能,请配置Java环境然后source,具体请百度。

解决了java 环境问题,还需要将 java 可执行命令 放到 /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin 下的任意一个中, 这里放到 /usr/bin

命令: ln -s /usr/local/jdk1.8.0_XXX/bin/java /usr/bin/java

开始远程访问后,bootstrap checks failed

本地访问完全问题,然后开启远程后gg了, 直接上错误

[2018-12-10T17:34:23,136][DEBUG][o.e.a.ActionModule       ] [xRWzOmS] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2018-12-10T17:34:23,319][INFO ][o.e.d.DiscoveryModule    ] [xRWzOmS] using discovery type [zen] and host providers [settings]
[2018-12-10T17:34:24,059][INFO ][o.e.n.Node               ] [xRWzOmS] initialized
[2018-12-10T17:34:24,059][INFO ][o.e.n.Node               ] [xRWzOmS] starting ...
[2018-12-10T17:34:24,201][INFO ][o.e.t.TransportService   ] [xRWzOmS] publish_address {192.168.5.232:9300}, bound_addresses {192.168.5.232:9300}
[2018-12-10T17:34:24,219][INFO ][o.e.b.BootstrapChecks    ] [xRWzOmS] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [1] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2018-12-10T17:34:24,262][INFO ][o.e.n.Node               ] [xRWzOmS] stopping ...
[2018-12-10T17:34:24,326][INFO ][o.e.n.Node               ] [xRWzOmS] stopped
[2018-12-10T17:34:24,326][INFO ][o.e.n.Node               ] [xRWzOmS] closing ...
[2018-12-10T17:34:24,335][INFO ][o.e.n.Node               ] [xRWzOmS] closed
[2018-12-10T17:34:24,337][INFO ][o.e.x.m.j.p.NativeController] [xRWzOmS] Native controller process has stopped - no new native processes can be started

我参考了基本问题,知道这是怎么回事,至于解决方式,就

security 问题

es 从6.3 以后就没有单独x-pack 组件了,全是是api, 可以参考官网:xpack-api

而没有付费是不能享受用户名密码登录了,没有付费 去看是这样的

GET _xpack/security/_authenticate


{
  "error": {
    "root_cause": [
      {
        "type": "security_exception",
        "reason": "current license is non-compliant for [security]",
        "license.expired.feature": "security"
      }
    ],
    "type": "security_exception",
    "reason": "current license is non-compliant for [security]",
    "license.expired.feature": "security"
  },
  "status": 403
}

具体哪些功能开放,哪些功能收费请看: Subscriptions that Go to Work for You


mugbya
1.2k 声望41 粉丝

时间永远分岔,通往无数未来