```{index} dnf, repo ``` # Установка и настройка кластера Elastic Устанавливаем репозиторий: ```bash rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch ``` Правим файл: ```bash vim /etc/yum.repos.d/elasticsearch.repo ``` ```text [elasticsearch] name=Elasticsearch repository for 7.x packages baseurl=https://artifacts.elastic.co/packages/7.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-md ``` Устанавливаем Эластик: ```bash dnf -y install elasticsearch ``` В инструкции запуск здесь, но кажется логичным сделать это **после** изменения настроек: ```bash systemctl enable --now elasticsearch ``` Создадим папку для хранения данных: ```bash mkdir -p /data/elasticsearch/data chown -R elasticsearch /data/elasticsearch/data ``` Внесём изменения в конфигурационный файл: ```bash mv /etc/elasticsearch/elasticsearch.yml \ /etc/elasticsearch/elasticsearch.yml.dist vim /etc/elasticsearch/elasticsearch.yml ``` ```yaml # Single cluster name for all cluster nodes cluster.name: appindex-es-cluster # Indexed name of current node with master & data role node.name: es-mixed-<0|1|2> # Enable master mode on this node node.master: true # Enable data mode on this node too node.data: true # DB files path directory created in advance path.data: /data/elasticsearch/data # Path to write logs path.logs: /var/log/elasticsearch # Address of current host network.host: 192.168.10.147 # Provides a list of the addresses of the master-eligible nodes # in the cluster. discovery.seed_hosts : [ "192.168.10.147:9300", "192.168.122.172:9300", "192.168.122.78:9300" ] # Sets the initial set of master-eligible nodes in a brand-new cluster cluster.initial_master_nodes: [ "192.168.10.147:9300", "192.168.122.172:9300", "192.168.122.78:9300" ] # The port to bind for HTTP client communication http.port: 9200 ``` Перезапускаем сервис: ```bash systemctl restart elasticsearch ``` ## Плейбук Ansible по данной инструкции ```bash playbook/maintenance/install_elastic_cluster.yml ``` ```{admonition} Вложения {download}`Инструкция по настройке кластера ElasticSearch от студии Чулакова ` ```