Перейти к содержанию
Если в домене присутствует Gamers, это не значит что сайт игровой! Так что пошел ты Касперский!

Устанавливаем Elasticsearch в Centos 7


Ryancoolround

Используете ли вы Elasticsearch на своем форуме?  

1 пользователь проголосовал

  1. 1. Используете ли вы Elasticsearch на своем форуме?

    • Да
      0
    • Нет
      1


Рекомендуемые сообщения

  • Администратор

Я хотел установить Elasticsearch на наш форум. И у меня даже получилось. Просто позже я подумал, что Elasticsearch это слишком мощная штука для нашего маленького, локального форума... Но как я это делал, я вам расскажу.

Знайте что, Elasticsearch работает благодаря Java, так что, не забудьте ее установить.

------------------------------------------

Дальше начинается самое веселое... Я думаю, вы, как и я, решили следовать официальной документации на сайте Elasticsearch, и столкнулись с тем, что при установке вы получили 403 ошибку:

host.site:~$ wget https://artifacts.elastic.co/packages/7.x/apt/dists/stable/InRelease

https://artifacts.elastic.co/packages/7.x/apt/dists/stable/InRelease
Resolving artifacts.elastic.co (artifacts.elastic.co)... 34.120.127.130, 2600:1901:0:1d7::
Connecting to artifacts.elastic.co (artifacts.elastic.co)|34.120.127.130|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2022-03-31 00:01:02 ERROR 403: Forbidden.

Поэтому, скачиваем пакет прикрепленный к этому посту, и кидаем его в удобную для вас директорию на сервере. elasticsearch-7.2.0-x86_64.rpm

Далее, переходим в эту директорию, пример:

cd /home

И запускаем следующую команду:

sudo rpm -ivh elasticsearch-7.2.0-x86_64.rpm

Эта команда установит пакет и разрешит зависимости.

Затем настраиваем Elasticsearch редактируя файл /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: invisionforum
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: ips4forum
#
# 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 -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: localhost
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
#discovery.zen.minimum_master_nodes:
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

После не забудьте открыть порт 9200....

Запустите Elasticsearch и настройте его для автозапуска при загрузке системы:

sudo systemctl start elasticsearch 
sudo systemctl enable elasticsearch

После чего проверьте состояние Elasticsearch, выполнив:

curl -X GET "localhost:9200/"

Вы должны получить ответ с информацией о версии и состоянии Elasticsearch

 

Изменено пользователем Ryancoolround (смотреть историю редактирования)

Больше сосредоточьтесь на контенте, чем на цифрах! 🤣

Ссылка на комментарий
Поделиться на другие сайты

Для публикации сообщений создайте учётную запись или авторизуйтесь

Вы должны быть пользователем, чтобы оставить комментарий

Создать учетную запись

Зарегистрируйте новую учётную запись в нашем сообществе. Это очень просто!

Регистрация нового пользователя

Войти

Уже есть аккаунт? Войти в систему.

Войти


×
×
  • Создать...