construcción de clúster elk7.5.1

Construcción del grupo ELK

Prepare dos máquinas y defina nodo1 y nodo2

Pre-etapa de recursos

kibana, es dirección de descarga:

curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.5.1-linux-x86_64.tar.gz
curl -L -O  https://artifacts.elastic.co/downloads/kibana/kibana-7.5.1-linux-x86_64.tar.gz

Usuarios nuevos

# 创建elastic用户
useradd elastic
# 设置用户密码
passwd elastic
# 切换到elastic用户
su elastic

construcción del clúster de búsqueda elástica

Después de descargar, descomprima y edite conf/elasticsearch.ymlel archivo .

1. Modificar el archivo de configuración

# ======================== 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: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# 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: /home/elastic/elasticsearch/data
#
# Path to log files:
#
path.logs: /home/elastic/elasticsearch/logs
#
# ----------------------------------- 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: 192.168.28.129
#
# 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 this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.seed_hosts: ["192.168.28.129", "192.168.28.130", "192.168.28.131"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["node-1", "node-2", "node-3"]
#
# For more information, consult the discovery and cluster formation 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
#
# ---------------------------------- xpack -------------------------------------
#
xpack.monitoring.collection.enabled: true
xpack.security.enabled: true
xpack.monitoring.collection.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: elastic-certificates.p12

Modifique principalmente las siguientes configuraciones:

cluster.name: El nombre del clúster. Los valores de todos los nodos del clúster cluster.namedeben ser los mismos.
node.name: El nombre de cada nodo de Elasticsearch en el clúster, que no se puede repetir.
path.data: establece la ruta para almacenar los datos del archivo de índice de Elasticsearch.
path.logs:Establezca la ruta para almacenar los archivos de registro.
network.host: La IP vinculada a Elasticsearch. El mundo exterior puede acceder al nodo actual de Elasticsearch a través de esta IP. Generalmente, se configura con la IP del sistema actual, o 0.0.0.0 (se puede acceder a cualquier dirección).
http.port: El número de puerto actual para iniciar Elasticsearch. Generalmente, el valor predeterminado es 9200. Por supuesto, también puede modificarlo
discovery.seed_hosts: Configure las direcciones IP vinculadas a todos los nodos de Elasticsearch.
cluster.initial_master_nodes: configure qué nodos son elegibles para ser seleccionados como nodos maestros.
xpack.monitoring.collection.enabled: Recopila datos de monitoreo. El valor predeterminado es falso y no se recopilan datos de monitoreo.

configuración de seguridad del clúster elasticsearch

1. Cree una autoridad de certificación para el clúster.

Ejecute en el directorio raíz del archivo, bin/elasticsearch-certutil ca
ingrese Enter (el archivo usa el nombre predeterminado) y contraseña.

2.Emitir un certificado para el nodo

Copie el elastic-stack-ca.p12archivo generado en cada nodo y ejecute bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12el certificado generado.Ingrese
la contraseña del paso anterior en secuencia. Ingrese (el archivo usa el nombre predeterminado), contraseña (se recomienda usar la misma contraseña que en el paso anterior)

Si ha establecido una contraseña, ejecute el siguiente comando para guardar la contraseña

bin/elasticsearch-keystore add xpack.security.transport.ssl.keystore.secure_password 第一步输入的密码 
bin/elasticsearch-keystore add xpack.security.transport.ssl.truststore.secure_password 第一步输入的密码 
4. Modificar la configuración

Agregue /config/elasticsearch.ymlalguna configuración, habilite el componente de seguridad x-pack, habilite la comunicación cifrada SSL y configure el certificado de autenticación:

#---------------------security------------------
#
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: elastic-certificates.p12

Una vez completada la modificación de la configuración, reinicie el servicio es. Después de que el reinicio sea exitoso,
http://192.168.1.100:9200/ debe ingresar el nombre de usuario y la contraseña para acceder al servicio es.

5. Configuración de contraseña

Configurando la contraseña de acceso, que es la contraseña para el usuario elástico y algunos otros usuarios integrados del sistema.

bin/elasticsearch-setup-passwords interactive

Preguntas más frecuentes

error:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

solución:

echo "vm.max_map_count=262144" > /etc/sysctl.conf
sysctl -p

Supongo que te gusta

Origin blog.csdn.net/quuqu/article/details/123860136
Recomendado
Clasificación