BlueXIII's Blog

热爱技术,持续学习

0%

ES集群部署

参考文档

服务器

  • 10.194.98.4
  • 10.194.98.5
  • 10.194.98.6

Elasticsearch部署

RPM方式

1
2
rpm -ivh jdk-8u311-linux-x64.rpm
rpm -ivh elasticsearch-6.8.20.rpm

配置

vi /etc/elasticsearch/elasticsearch.yml

1
2
3
4
5
6
7
8
9
10
11
cluster.name: elan-cluster
node.name: node-04
path.data: /data/elasticsearch/data
path.logs: /data/elasticsearch/logs
network.host: 10.194.98.4
http.port: 9200
discovery.zen.ping.unicast.hosts: ["10.194.98.4", "10.194.98.5", "10.194.98.6"]
discovery.zen.minimum_master_nodes: 2
bootstrap.memory_lock: true
http.cors.enabled: true
http.cors.allow-origin: "*"

启动

1
2
3
4
5
systemctl enable elasticsearch
systemctl start elasticsearch

systemctl daemon-reload
systemctl restart elasticsearch

IK分词插件

https://github.com/medcl/elasticsearch-analysis-ik

1
2
3
4
cd /usr/share/elasticsearch/plugins
mkdir ik && cd ik
cp ~/pkg/elasticsearch-analysis-ik-6.8.20.zip /usr/share/elasticsearch/plugins/ik
unzip elasticsearch-analysis-ik-6.8.20.zip

评分插件

自研插件,无下载地址
mkdir elasticSearch-plugin-score

测试

http://10.194.98.4:9200
http://10.194.98.4:9200/_cat/nodes?pretty
http://10.194.98.4:9200/_cat/plugins

Kibana部署

RPM方式

1
rpm -ivh kibana-6.8.20-x86_64.rpm

配置

vi /etc/kibana/kibana.yml

启动

1
2
3
systemctl enable kibana
systemctl start kibana
systemctl restart kibana

测试

http://10.194.98.4:5601

优化

memory_lock

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
vi /etc/elasticsearch/elasticsearch.yml
bootstrap.memory_lock: true

ulimit -l unlimited

vi /etc/security/limits.conf
elasticsearch - nofile 65535

vi /etc/systemd/system/elasticsearch.service.d/elasticsearch.conf
[Service]
LimitMEMLOCK=infinity
LimitNPROC=4096
LimitNOFILE=65536

vi /etc/sysconfig/elasticsearch
MAX_OPEN_FILES=65535
MAX_LOCKED_MEMORY=unlimited

禁用自平衡

1
2
3
4
5
6
gateway.expected_nodes: 3
gateway.recover_after_nodes: 3
#禁用集群新创建索引分配
cluster.routing.allocation.enable: false
#禁用集群自动平衡
cluster.routing.rebalance.enable: false

监控

1
2
3
4
5
6
GET /_cat
GET /_cat/indices?v
GET /_cat/health?v
GET /_cluster/health?level=indices&pretty
GET /_cat/nodes?v&h=id,port,v,m,fdp,mc,mcs,sc,sm,qcm,fm,im,siwm,svmm&pretty=true
GET /_cat/allocation?v&h=shards,disk.indices,disk.used,disk.avail