1 Download and unzip Elasticsearch
Elasticsearch can also be installed from our package repositories using apt or yum, or installed on Windows using an MSI installer package. See Repositories in the Guide.
2 Run bin/elasticsearch
(or bin\elasticsearch.bat
on Windows)
3 Run curl http://localhost:9200/
or Invoke-RestMethod http://localhost:9200
with PowerShell
4 Dive into the getting started guide and video.
在 root 用户下启动 elasticsearch,报如下错误:
[root@localhost elasticsearch-5.2.2]# ./bin/elasticsearch
//部分错误如下
[2017-03-15T22:16:22,913][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
报错明确指出,不能以root用户启动
这种情况下,需要先改变目录的用户权限,然后再以普通用户启动
[root@localhost local]# adduser es
[root@localhost local]# passwd es
[root@localhost local]# chown -R es elasticsearch-5.2.2
[root@localhost local]# su - es
[hncl@localhost elasticsearch-5.2.2]$ ./bin/elasticsearch
这样就可以正常启动了。