实验室配置 ElasticSearch + Kibana 说明
四台机器搭建的集群 ElasticSearch + Kibana
ElasticSearch配置文件配置
- cluster.name: ubuntu
- node.name: ubuntu2
- path.data: /home/ubuntu/applications/elasticsearch/data
- path.logs: /home/ubuntu/applications/elasticsearch/logs
- network.host: ubuntu2
- discovery.zen.ping.unicast.hosts: [ ubuntu1 , ubuntu2 , ubuntu3 , ubuntu4 ]
注意:
:后需要加空格 elasticsearch放到后台执行: ./elasticsearch -d
之后四台机器都需要启动ElasticSearch
Kibana配置文件配置
- server.host: ubuntu1
- elasticsearch.url: “http://ubuntu1:9200"
Kibana放到后台执行: nohup ./kibana $
根据进程号找到进程对应的路径 ll -proc/进程号
在kibana中查看所有节点情况
GET /_cat/nodes?v
在kibana中查看集群健康状况
GET /_cat/health?v
在使用kibana查询时,ES需要建表
ElasticSearch启动异常
1. max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
解决: 切换到root用户 sudo su
,编辑limits.conf 添加类似如下内容.
vim /etc/security/limits.conf
添加如下内容:
* soft nofile 65536
* hard nofile 131072
然后使用ubuntu用户重新启动elasticsearch,即可启动成功。
2. max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
解决: 切换到root用户 sudo su
, 修改配置sysctl.conf
vim /etc/sysctl.conf
添加如下配置:
vm.max_map_count=655360
并执行命令:
sysctl -p
然后使用ubuntu用户重新启动elasticsearch,即可启动成功。
为什么使用ElasticSearch+HBase的方案,而不直接使用ElasticSearch
首先主要原因就是EL的弱一致性,EL的弱一致性会导致数据的丢失,所以只使用EL为搜索引擎,底层还是使用强一致性的HBase,即使浪费一定的存储空间