一、elasticsearch安装
1、官网下载安装包并上传并解压
2、es下建立data和logs目录
3、编辑conf/elasticsearch.yml文件
cluster:cluster.name:hlh-app
node:node.name:node-248
paths: path.data:
path.logs:
memory:bootstrap.memory_lock:false
bootstrap.system_call_filter:false
network: network.host:192.168.102.248
discovery:discovery.zen.ping.unicast.hosts:["hlh001"]
4、编辑/etc/security/limits.conf添加内容
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
5、切换root用户,编辑/etc/security/limits:d/90-nproc.conf
修改*soft nproc 1024
为*soft nproc 2048
6、root用户,编辑/etc/sysctl.conf添加
vm.max_map_count=655360
并执行命令:sysctl -p
7、启动,root不可以启动,./bin/elasticsearch
浏览器访问:hlh001:9200
二、elasticsearch插件安装
1、下载插件 ---> https://github.com/mobz/elasticsearch-head
下载node.js ---> https://nodejs.org/dist/ ---> node-v6.9.2.tar.xz
上传并解压uzip elasticsearch-head-master.zip -d /opt/module
2、配置nodejs环境变量/etc/profile source一下
node -v
npm -v
3、查看head目录下有无node_modules/grunt目录
没有则执行创建
npm install grunt --save
4、安装head插件npm install -g cnpm --registry=registry.npm.taobao.org
5、安装grunt
npm install -g grunt-cli
6、编辑Gruntfile.js 文件93行options里面添加
hostname:'0.0.0.0',
7、检查head目录下是否存在base文件夹
没有就将_site下的base文件夹及其内容复制到head根目录下
head]$ mkdir base
_site]$ cp base/* ../base/
8、启动grunt server -d提示有些模块没有安装,执行
npm install grunt-contrib-clean -registry=https://registry.npm.taobao.org
npm install grunt-contrib-concat -registry=https://registry.npm.taobao.org
npm install grunt-contrib-watch -registry=https://registry.npm.taobao.org
npm install grunt-contrib-connect -registry=https://registry.npm.taobao.org
npm install grunt-contrib-copy -registry=https://registry.npm.taobao.org
npm install grunt-contrib-jasmine -registry=https://registry.npm.taobao.org
最后一个可能安装不成功,但是不影响使用
启动grunt server -d
访问浏览器hlh001:9100发现集群未连接
9、在elasticsearch/conf路径下编辑elasticsearch.yml添加跨域访问
http.cors.enabled:true
http.cors.allow-origin:"*"
启动elasticsearch
10、重启head插件访问浏览器就可以了