1、通过curl下载
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.1.0-linux-x86_64.tar.gz
1.1解压
tar -xvf elasticsearch-7.1.0-linux-x86_64.tar.gz
1.2启动节点
cd elasticsearch-7.1.0/bin
./elasticsearch
2、启动时各种报错排查:
2.1、ElasticSearch为了安全起见,不允许以root用户登录,切换其他系统用户即可
2.2、如果切换了其他用户还报错
2.3、那就在切回root赋予权限
2.4、如果启动时报这两个错误
2.5、首先修改第一个
vim /etc/security/limits.d/test-limits.conf
然后加入以下代码
* soft nofile 65536
* hard nofile 131072
* soft nproc 4096
* hard nproc 4096
然后重启服务器(从新编译)
查看是否修改成功
2.6、 在修改第二个
在配置文件elasticsearch.yml中添加
cluster.initial_master_nodes: ["node-1"]
启动成功!
3、安装head插件
3.1、由于head插件是nodejs的工程,所以要先安装nodejs环境
wget https://nodejs.org/dist/v10.9.0/node-v10.9.0-linux-x64.tar.xz
下载完之后解压放在服务器上的任意目录,我的放在:/www/server/elastic 目录中
tar xf node-v10.9.0-linux-x64.tar.xz #解压
3.2、解压文件的 bin 目录底下包含了 node、npm 等命令,我们可以使用 ln 命令来设置软连接:
ln -s /www/server/elastic/node-v10.9.0-linux-x64/bin/npm /usr/local/bin/ ln -s /www/server/elastic/node-v10.9.0-linux-x64/bin/node /usr/local/bin/
3.3、下载 head 完之后将zip文件上传到服务器上任意目录
将zip安装包解压到elasticsearch中
3.4、修改head配置文件 elasticsearch-head-master/Gruntfile.js
3.5、在head目录中执行npm install
npm install
安装过程中报错,查看日志中的内容
解决办法:
npm -g install phantomjs-prebuilt@2.1.16 --ignore-script
安装完之后启动
npm run start
成功!