下载并安装
1 2
| wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.2.rpm rpm -ivh elasticsearch-2.3.5.rpm
|
查找并修改配置文件
1 2 3 4
| whereis elasticsearch
network.host: 192.168.6.128 http.port: 9200
|
启动并查看安装状态
1 2 3
| systemctl daemon-reloa systemctl start elasticsearch systemctl status elasticsearch
|
安装Head
因为在ES5中Head不能通过插件方式安装,而需要创建为独立站点,或者使用Kibana
1 2 3 4 5 6 7 8 9 10 11
| curl -sL https://rpm.nodesource.com/setup bash - Then install, as root: yum install -y nodejs
git clone git://github.com/mobz/elasticsearch-head.git cd elasticsearch-head
npm install
npm install -g grunt-cli
|
修改并启动Head
找到elasticsearch-head/Gruntfile.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| connect: { server: { options: { hostname:'192.168.6.128', port: 9100, base: '.', keepalive: true } } }
grunt server
grunt server &
|
注意事项
如果用Head访问ES出现 “No ‘Access-Control-Allow-Origin’ header” 则需要在elasticsearch.yml增加如下节点,允许跨域访问
1 2
| http.cors.enabled: true http.cors.allow-origin: "\*"
|