您的位置:首页 > 其它

Windows环境下安装Elasticsearch

2016-04-07 15:23 459 查看

一、下载

官网 https://www.elastic.co/products/elasticsearch/ 下载最近版本

选择ZIP格式 链接如下:https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/zip/elasticsearch/2.3.1/elasticsearch-2.3.1.zip

二、配置

1、将下载好的ZIP压缩包解压到指定目录下

2、进入 elasticsearch-2.3.1\bin 中打开命令提示符,输入 : elasticsearch

或者 直接运行 elasticsearch.bat文件皆可启动elasticsearch

但这时会报这个错误

D:\elasticsearch-2.3.1\bin>elasticsearch
Exception in thread "main" java.lang.RuntimeException: Java version: Oracle Corporation 1.7.0_45 [Java HotSpot(TM) 64-Bit Server VM 24.
45-b08] suffers from critical bug https://bugs.openjdk.java.net/browse/JDK-8024830 which can cause data corruption.
Please upgrade the JVM, see http://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html for current recommendatio
ns.
If you absolutely cannot upgrade, please add -XX:-UseSuperWord to the JAVA_OPTS environment variable.
Upgrading is preferred, this workaround will result in degraded performance.
at org.elasticsearch.bootstrap.JVMCheck.check(JVMCheck.java:123)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:268)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
请按任意键继续. . .


提示很明显,要不升级jdk到1.8版本,要不在环境变量中添加 JAVA_OPTS属性,这里选后者;

在系统环境变量中添加JAVA_OPTS属性,值为 : -XX:-UseSuperWord

保存退出。

重新打开命令提示符,启动elasticsearch成功。

浏览器地址输入 : http://localhost:9200/ 即可看到如下json字符串

{
"name" : "Roulette",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "2.3.1",
"build_hash" : "bd980929010aef404e7cb0843e61d0665269fc39",
"build_timestamp" : "2016-04-04T12:25:05Z",
"build_snapshot" : false,
"lucene_version" : "5.5.0"
},
"tagline" : "You Know, for Search"
}


三、安装插件

1、安装elasticsearch-head

在elasticsearch-2.3.1\bin打开命令提示符,输入:

plugin install mobz/elasticsearch-head


安装成功后,在浏览器中输入:http://localhost:9200/_plugin/head/,可以看到页面。

2、如果不用安装命令,也可以直接下载安装。

https://github.com/mobz/elasticsearch-head 下载安装包。

1).在安装目录elasticsearch-2.3.1中,看是否有plugins目录,如果没有,则创建(第一次时,没有,需要创建)。

2).进入plugins目录,创建head目录

3).进入head目录,创建_site目录

4).解压下载的elasticsearch-head-master.zip,将其elasticsearch-head-master目录下的所有文件放入_site目录中。

5).再次重新启动elasticsearch。在浏览器中输入:http://localhost:9200/_plugin/head/ 查看页面。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: