环境:
vmware
centos7
1、下载适合自己的es版本(集群安装只需要改一个cluster.name参数就可以)
https://www.elastic.co/cn/downloads/past-releases/elasticsearch-7-10-1
2、由于我下载的是二进制包,因为从es7开始自带了jdk,所以不需要单独去安装jdk了,直接解压就可以使用
tar -xf elasticsearch-7.10.1-linux-x86_64.tar.gz
把解压后的es移动到相应路径就可以使用了
安装es的head插件,因为es7的安装方式不一样,我安装的是elasticsearch-head-master
https://github.com/mobz/elasticsearch-head
下载后进入elasticseach-head-master
下面我都在本文件夹里面执行
新版的head插件需要nodejs支持,所以安装nodejs
curl --silent --location https:
查看nodejs是否安装成功
node -v
npm -v
安装grunt
npm install -g grunt-cli
npm install
修改Gruntfile.js,添加hostname: '0.0.0.0'
- server: {
- options: {
- hostname: '0.0.0.0',
- port: 9100,
- base: '.',
- keepalive: true
- }
- }
修改_site/app.js,将this.prefs.get("app-base_uri") || "localhost:9200"
- this._super();
- this.prefs = services.Preferences.instance();
- this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.25.180:9200";
将目录移动到你的es安装目录里面,方便以后启动,最后启动head
- npm run start
- nohup npm run start(后台启动)
es启动
编辑/usr/lib/systemd/system/elasticsearch.service ,设置开机自启动
- [Unit]
- Description=The elasticsearch Application Platform
- After=syslog.target network-online.target remote-fs.target nss-lookup.target
- Wants=network-online.target
- [Service]
- Type=forking
- PIDFile=/usr/local/elasticsearch/es.pid
- ExecStart=/usr/local/elasticsearch/bin/elasticsearch -d -p /usr/local/elasticsearch/es.pid
- ExecReload=/bin/kill -s HUP $MAINPID
- ExecStop=/bin/kill -s QUIT $MAINPID
- PrivateTmp=true
- User=es
- Group=es
- LimitNOFILE=65535
- LimitNPROC=65535
- LimitAS=infinity
- LimitFSIZE=infinity
- TimeoutStopSec=0
- KillSignal=SIGTERM
- KillMode=process
- SendSIGKILL=no
- SuccessExitStatus=143
- TimeoutStartSec=75
- [Install]
- WantedBy=multi-user.target
注意:es启动不能用root用户,所以需要先创建es用户
- groupadd es
- useradd es -g es
启动es并设置开机自启动
- systemctl start elasticseach.service
- systemctl enable elasticseach.service
最后在浏览器访问:
- http://194.168.50.80:9200
head插件访问地址
- http://194.168.50.80:9100
至此es7以及head插件安装完毕!切记优化jvm哦。。。。。
还有优化/etc/sysctl.conf
vm.max_map_count=524288
执行sysctl -p生效
安装监控插件cerebro
- https://github.com/lmenezes/cerebro/releases
- unzip cerebro-0.8.4.zip
- cd cerebro-0.8.4/
- nohup bin/cerebro >/dev/null &