1.安装步骤
ealsticsearch只是后端提供各种api,那么怎么直观的使用它呢?elasticsearch-head将是一款专门针 对于elasticsearch的客户端工具 elasticsearch-head配置包,下载地址:https://github.com/mobz/el asticsearch-head elasticsearch-head是一个基于node.js的前端工程。
- nodejs安装
wget https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x64.tar.xz // 下载
tar xf node-v10.15.3-linux-x64.tar.xz
cd node-v10.15.3-linux-x64/
./bin/node -v
v10.15.3
解压文件的 bin 目录底下包含了 node、npm 等命令,我们可以使用 ln 命令来设置软连接:
ln -s /root/node-v10.15.3-linux-x64/bin/npm /usr/local/bin/
ln -s /root/node-v10.15.3-linux-x64/bin/node /usr/local/bin/
- phantomjs安装配置
cd /usr/local
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs- 2.1.1-linux-x86_64.tar.bz2
#注意安装
yum install -y bzip2
tar -jxvf phantomjs-2.1.1-linux-x86_64.tar.bz2
vim /etc/profile
export PATH=$PATH:/usr/local/phantomjs-2.1.1-linux-x86_64/bin #注意环境变量$Path移动在最前面
source /etc/profile
- elasticsearch-head安装
npm install -g grunt-cli
npm install grunt
npm install grunt-contrib-clean
npm install grunt-contrib-concat
npm install grunt-contrib-watch
npm install grunt-contrib-connect
yum -y install git
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install -g cnpm --registry=https://registry.npm.taobao.org
- elasticsearch-head发现主机 并连接 elasticsearch.yml配置文件修改:
如果之前设置过 可以忽略这一步
http.cors.enabled: true
http.cors.allow-origin: “*”
- 启动
在 elasticsearch-head 中执行命令
npm run start
如果启动出错 则把第三步中的依赖再安装一遍
- 启动完成后,我们用Elasticsearch head查看,主从环境配置正常。