RPM包方式部署
节点信息
| 节点 | 节点IP |
|---|---|
| elastic-01 | 10.0.0.51 |
| elastic-02 | 10.0.0.52 |
| elastic-03 | 10.0.0.53 |
准备工作
配置好三个节点的名称解析,修改/etc/hosts字段,增加解析记录
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain610.0.0.51 elastic-0110.0.0.52 elastic-0210.0.0.53 elastic-03
安装
将elasticsearch安装包上传至三台服务器,并通过yum方式安装
[root@elastic-01 ~]# yum install -y elasticsearch-7.13.4-x86_64.rpm
配置
下面是elastic-01节点的配置,将此配置文件复制到另外两个节点,并修改node-name字段即可
[root@elastic-01 ~]# cat /etc/elasticsearch/elasticsearch.yml# ======================== Elasticsearch Configuration =========================## NOTE: Elasticsearch comes with reasonable defaults for most settings.# Before you set out to tweak and tune the configuration, make sure you# understand what are you trying to accomplish and the consequences.## The primary way of configuring a node is via this file. This template lists# the most important settings you may want to configure for a production cluster.## Please consult the documentation for further information on configuration options:# https://www.elastic.co/guide/en/elasticsearch/reference/index.html## ---------------------------------- Cluster -----------------------------------## Use a descriptive name for your cluster:#cluster.name: xsc-ela## ------------------------------------ Node ------------------------------------## Use a descriptive name for the node:#node.name: elastic-01node.data: true## Add custom attributes to the node:##node.attr.rack: r1## ----------------------------------- Paths ------------------------------------## Path to directory where to store the data (separate multiple locations by comma):#path.data: /var/lib/elasticsearch## Path to log files:#path.logs: /var/log/elasticsearch## ----------------------------------- Memory -----------------------------------## Lock the memory on startup:##bootstrap.memory_lock: true## Make sure that the heap size is set to about half the memory available# on the system and that the owner of the process is allowed to use this# limit.## Elasticsearch performs poorly when the system is swapping the memory.## ---------------------------------- Network -----------------------------------## By default Elasticsearch is only accessible on localhost. Set a different# address here to expose this node on the network:#network.host: 0.0.0.0## By default Elasticsearch listens for HTTP traffic on the first free port it# finds starting at 9200. Set a specific HTTP port here:#http.port: 9200## For more information, consult the network module documentation.## --------------------------------- Discovery ----------------------------------## Pass an initial list of hosts to perform discovery when this node is started:# The default list of hosts is ["127.0.0.1", "[::1]"]#discovery.seed_hosts:- elastic-01- 10.0.0.52:9300- 10.0.0.53## Bootstrap the cluster using an initial set of master-eligible nodes:#cluster.initial_master_nodes: ["elastic-01", "elastic-02", "elastic-03"]## For more information, consult the discovery and cluster formation module documentation.## ---------------------------------- Various -----------------------------------## Require explicit names when deleting indices:##action.destructive_requires_name: true
启动
三个节点依次启动Elasticsearch
[root@elastic-01 ~]# systemctl start elasticsearch.service[root@elastic-02 ~]# systemctl start elasticsearch.service[root@elastic-03 ~]# systemctl start elasticsearch.service
安装状态检测
检查节点信息是否健康
[root@elastic-01 ~]# curl -X GET "localhost:9200/_cat/health?v"epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent1627523688 01:54:48 xsc-ela green 3 3 18 9 0 0 0 0 - 100.0%
查看节点
[root@elastic-01 ~]# curl -X GET "localhost:9200/_cat/nodes?v"ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name10.0.0.51 24 97 1 0.01 0.04 0.05 cdfhilmrstw * elastic-0110.0.0.53 15 96 0 0.10 0.05 0.05 cdfhilmrstw - elastic-0310.0.0.52 19 96 0 0.00 0.01 0.05 cdfhilmrstw - elastic-02
查看索引
[root@elastic-01 ~]# curl -X GET "localhost:9200/_cat/indices?v"health status index uuid pri rep docs.count docs.deleted store.size pri.store.sizegreen open nginx_test_2021.07.29 OMtP9e4ESRiRiB8MBWbsCQ 1 1 15 0 94.3kb 47.1kbgreen open .apm-custom-link 0qFbAAiLQeC3ldT3vbDUQQ 1 1 0 0 416b 208bgreen open .apm-agent-configuration UV-OTgILQYSDq-licT99Gg 1 1 0 0 416b 208bgreen open .kibana-event-log-7.13.4-000001 pAsKggWmTgWBgYi2zUK5dg 1 1 1 0 11.2kb 5.6kbgreen open filebeat-7.13.4-2021.07.28-000001 iAbgjsdZR8unGL9aT_q-rg 1 1 6 0 64.6kb 32.3kbgreen open .async-search R3z9OSc0T1S3OGiHiFhBeA 1 1 0 0 53.4kb 231bgreen open .kibana_7.13.4_001 gwkkud28Td-A2ys5tD-3MQ 1 1 50 1 8.5mb 4.2mbgreen open .kibana_task_manager_7.13.4_001 vYIF80d0S_SSu9Ayu3dVKg 1 1 10 1757 718.4kb 413.3kb
