环境
操作系统: window
步骤
步骤一、解压缩包
下载路径:https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.2.2.zip
对压缩包elasticsearch-5.2.2.zip
进行解压
使用命令行启动
步骤二、启动
先进入elasticsearch-5.2.2
的目录。
然后在命令行中执行:
>.\bin\elasticsearch
步骤二、配置相应参数 启动
./bin/elasticsearch -Ecluster.name=yutao -Enode.name=yutao_node_1
安装elasticsearch作为window服务
我们在cmd
中先进入安装目录中的bin
目录,可以执行如下命令:
D:\Program Files\elasticsearch-5.2.2\bin>elasticsearch-service install
备注:elasticsearch-service.bat install|remove|start|stop|manager [SERVICE_ID]
即可安装作为window
的服务,安装成功后,我们再执行elasticsearch-service start
。
注意:
命令参数 | 描述 |
---|---|
install | Install Elasticsearch as a service |
remove | Remove the installed Elasticsearch service (and stop the service if started) |
start | Start the Elasticsearch service (if installed) |
stop | Stop the Elasticsearch service (if started) |
manager | Start a GUI for managing the installed service |
安装成功后,会打印如下信息:
c:\elasticsearch-5.2.2\bin>elasticsearch-service install
Installing service : "elasticsearch-service-x64"
Using JAVA_HOME (64-bit): "c:\jvm\jdk1.8"
The service 'elasticsearch-service-x64' has been installed.
启动
elasticsearch-service start
访问:localhost:9200
显示如下,表示成功:
{
"name" : "Bw9NPyK",
"cluster_name" : "yutao",
"cluster_uuid" : "t3wwHTxdTzC2X-AnyQgSkQ",
"version" : {
"number" : "5.2.2",
"build_hash" : "f9d9b74",
"build_date" : "2017-02-24T17:26:45.835Z",
"build_snapshot" : false,
"lucene_version" : "6.4.1"
},
"tagline" : "You Know, for Search"
}
停止
elasticsearch-service stop
官网地址:https://www.elastic.co/guide/en/elasticsearch/reference/current/windows.html