Centos7安装ElasticSearch6.4

发布时间:2025-12-10 11:27:09 浏览次数:22

本文主要是记录在Centos7下安装ElasticSearch集群及管理工具Cerebro的流程。

节点准备

节点IP角色ES节点名称
192.168.1.10masternode1
192.168.1.11datanode2

1.下载ES安装包

cd /optwget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.0.tar.gztar -zxvf elasticsearch-6.4.0.tar.gz

2. 添加普通用户

groupadd elsearchuseradd elsearch -g elsearch -p elasticsearchchown -R elsearch.elsearch /opt/elasticsearch-6.4.0/

3. 修改ES配置(两个节点分别配置)

# vim config/elasticsearch.ymlcluster.name: es## 节点node1node.name: node1node.master: truenetwork.host: 192.168.1.10## 节点node2#node.name: node2#node.master: false#network.host: 192.168.1.11node.data: truepath.data: /opt/elasticsearch-6.4.0/datapath.logs: /opt/elasticsearch-6.4.0/logstransport.tcp.port: 9300http.port: 9200discovery.zen.ping.unicast.hosts: ["192.168.1.10:9300","192.168.1.11:9300"]

4.修改系统参数

# vim /etc/security/limits.conf elsearch hard nofile 655360elsearch soft nofile 655360# vim /etc/sysctl.confvm.max_map_count=655360# sysctl -p

5.添加ES到Supervisor

# vim /etc/supervisor.d/es.ini[supervisord]minfds=65536minprocs=32768[program:es-node]command = /opt/elasticsearch-6.4.0/bin/elasticsearchdirectory = /opt/elasticsearch-6.4.0user = elsearchstartsecs = 3redirect_stderr = truestdout_logfile_maxbytes = 50MBstdout_logfile_backups = 10stdout_logfile = /opt/elasticsearch-6.4.0/logs/supervisor.log

6.通过Supervisor启动ES服务

# 两个节点分别启动supervisorctl rereadsupervisorctl add es-node# supervisorctl start es-nodesupervisorctl status

7.浏览器访问ES

8.下载cerebro管理资源包(假设安装在192.168.1.10)

cd /optwget https://github.com/lmenezes/cerebro/releases/download/v0.8.1/cerebro-0.8.1.tgztar -zxf cerebro-0.8.1.tgzchown -R elsearch.elsearch /opt/cerebro-0.8.1

9.配置cerebro

# vim conf/application.confhosts = [{host = "http://192.168.1.10:9200"name = "Default ES Cluster"# auth = {# username = "xx_admin"# password = "xx_pwd"# }},}

10.添加cerebro配置到Supervisor

[program:cerebro-node]command = /opt/cerebro-0.8.1/bin/cerebro -Dhttp.port=12345 -Dhttp.address=192.168.1.10directory = /opt/cerebro-0.8.1/user = elsearchstartsecs = 3redirect_stderr = truestdout_logfile_maxbytes = 100MBstdout_logfile_backups = 10stdout_logfile = /opt/cerebro-0.8.1/logs/supervisor.log

11.通过Supervisor启动cerebro

supervisorctl rereadsupervisorctl add cerebro-node# supervisorctl start cerebro-nodesupervisorctl status

12.浏览器访问cerebro

进入其首页后,直接选择Default ES Cluster选项即可进入控制台。

需要做网站?需要网络推广?欢迎咨询客户经理 13272073477