报错:
λ elasticsearch.bat
warning: ignoring JAVA_HOME="L:\elasticsearch-8.7.1\jdk\"; using bundled JDK
[2023-05-16T13:11:24,738][ERROR][o.e.b.Elasticsearch ] [WHOIS] fatal exception while booting Elasticsearchjava.nio.file.NoSuchFileException: L:\elasticsearch-8.7.1\ .
at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
at java.base/sun.nio.fs.WindowsDirectoryStream.<init>(WindowsDirectoryStream.java:86)
at java.base/sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:541)
See logs for more details.
ERROR: Elasticsearch did not exit normally - check the logs at L:\elasticsearch-8.7.1\logs\elasticsearch.log
ERROR: Elasticsearch exited unexpectedly
处理:
删除环境变量中的CLASSPATH:
另外,elasticsearch8.7.1自带了openjdk 20:
可配置elasticsearch.bat :
set JAVA_HOME="L:\elasticsearch-8.7.1\jdk\"
重新运行elasticsearch.bat :
高版本ES 需要https方式访问,如果你需要使用http,修改如下文件:
/config/elasticsearch.yml,将enabled:true 修改为enabled:false
访问:
下一步修改ES密码:
elasticsearch-reset-password.bat -u elastic
默认会生成一个高强度密码:
需自定义elastic密码:
POST /_security/user/elastic/_password HTTP/1.1
Host: 127.0.0.1:9200
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0; Waterfox) Gecko/20100101 Firefox/56.2.5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: close
Upgrade-Insecure-Requests: 1
Content-Type: application/json
Authorization: Basic ZWxhc3RpYzpMalB5dmtYV2ZIbkZmcVR4c082Tg==
Content-Length: 24
{"password" : "*****"}