Elastic 安装篇(1)

时间:2021-04-26 16:41:32

1、Elasticsearch下载安装

https://www.elastic.co/cn/downloads/elasticsearch

Elastic 安装篇(1)

解压:

2、安装head

https://github.com/mobz/elasticsearch-head

This package has installed:

  • Node.js v10.13.0 to /usr/local/bin/node
  • npm v6.4.1 to /usr/local/bin/npm

Make sure that /usr/local/bin is in your $PATH.

Elastic 安装篇(1)

Elastic 安装篇(1)

houzhibindeMacBook-Pro:bin houzhibin$ npm install -g grunt -cli
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.

没权限,解决:sudo chown -R $(whoami) /usr/local/lib/node_modules

然后再

npm install -g grunt  -cli

成功

----------装head-----------

npm install

Elastic 安装篇(1)

-----------运行head------------

grunt server,启动head服务,如下所示则为启动成功。(可以到head根目录下修改Gruntfile.js文件的启动端口,默认是9100)

http://localhost:9100

然后去修改elasticsearch的配置文件,elasticsearch安装目录/config/elasticsearch.yml,打开文件后在末端另起一行分别顶格添加如下两行红色字体文本,保存后重启elasticsearch.bat。图片是我的elasticsearch配置,提供给你参考下。

1 http.cors.enabled: true
2 http.cors.allow-origin: "*"

Elastic 安装篇(1)

重启elastic

houzhibindeMacBook-Pro:self houzhibin$ cd elasticsearch-6.5.1/bin
houzhibindeMacBook-Pro:bin houzhibin$ ./elasticsearch

Elastic 安装篇(1)

连接,试试:
再次启动head的命令:

houzhibindeMacBook-Pro:local houzhibin$ cd ~/self/elasticsearch-head-master
houzhibindeMacBook-Pro:elasticsearch-head-master houzhibin$ grunt server