您的位置:首页 > Web前端 > HTML5

ElasticSearch5.0.0安装(Windows)

2017-04-14 13:44 597 查看
前提:JDK的安装配置

安装elasticsearch5.0需要java1.8以上

一、安装Elasticsearch5.0.0

下载压缩包并解压

https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.0.0.zip

启动:bin >elasticsearch

访问 http://localhost:9200/

安装成服务:

配置线程栈大小,如果操作系统是64位,则在jvm.options中添加这一行

-Xss1m

如果操作系统是32位,则在jvm.options中添加这一行

-Xss320k

在cmd中执行:

bin>elasticsearch-service install

二、安装Elasticsearch5.0.0 Head插件

环境

ElasticSearch-5.0.0

node-v4.5.0-x64.msi 下载

git客户端 下载

步骤

1.安装node到D盘。如D:\nodejs

把NODE_HOME设置到环境变量里(安装包也可以自动加入PATH环境变量)。测试一下node是否生效:



2.安装grunt

说明:grunt是一个很方便的构建工具,可以进行打包压缩、测试、执行等等的工作,5.0里的head插件就是通过grunt启动的。因此需要安装grunt。

注意:路径切到D:\nodejs下。

D:\nodejs>npm install -g grunt-cli

-g代表全局安装。

安装路径为C:\Users\Administrator\AppData\Roaming\npm,并且自动加入PATH变量。安装完成后检查一下:



3.把head插件的源码git clone下来

(D:\elasticsearch-5.0.0\elasticsearch-head>目录下):

git clone git://github.com/mobz/elasticsearch-head.git


4.修改head源码

4.1修改目录:head/Gruntfile.js:

connect: {
server: {
options: {
port: 9100,
hostname: '*',
base: '.',
keepalive: true
}
}
}


4.2修改连接地址(本地使用不需要修改):

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";


5.修改elasticsearch的参数

编辑config/elasticsearch.yml:

# 换个集群的名字,免得跟别人的集群混在一起
cluster.name: es-5.0-test

# 换个节点名字
node.name: node-101

# 修改一下ES的监听地址,这样别的机器也可以访问
network.host: 0.0.0.0

# 默认的就好
http.port: 9200

# 增加新的参数,这样head插件可以访问es
http.cors.enabled: true
http.cors.allow-origin: "*"


6.开启ES-5.0.0:

D:\ElasticSearch-5.0.0\bin\elasticsearch.bat




然后在head源码目录中,执行npm install 下载的包:

D:\elasticsearch-5.0.0\elasticsearch-head>npm install


初次运行安装可能会报警告或错误。可以重新运行一次npm install。

最后,在head源代码目录下启动nodejs:

D:\elasticsearch-5.0.0\elasticsearch-head>grunt server




这个时候,访问http://localhost:9100就可以访问head插件了。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  elasticsearch