1、对应版本kibana8.4.3的安装
2、IK分词器8.4.3的安装
3、Logstash-8.4.3的安装
sudo mkdir -p /usr/local/docker/elasticsearch/config
# 指定该挂载目录用于持久化es保存的数据
sudo mkdir -p /usr/local/docker/elasticsearch/data
sudo mkdir -p /usr/local/docker/elasticsearch/plugins
sudo mkdir -p /usr/local/docker/elasticsearch/logs
chmod -R 777 /usr/local/docker/elasticsearch
启动出现以下错误,再执行该操作
出现max virtual memory areas vm.max_map_count [65530] is too low,increase to at least [262144]
# 查看配置大小
cat /proc/sys/vm/max_map_count
# 如果是65535则执行该命令
sysctl -w vm.max_map_count=262144
#1、 在centos虚拟机中,修改配置sysctl.conf
#vim /etc/sysctl.conf
#2、加入如下配置
#vm.max_map_count=262144
#3、启用配置
sysctl -p
#1、下载es
docker pull elasticsearch:8.4.3
docker run -d --name es -p 9200:9200 -p 9300:9300 -e ES_JAVA_OPTS="-Xms1024m -Xmx1024m" -e "discovery.type=single-node" elasticsearch:8.4.3
#es是容器名称
docker cp es:/usr/share/elasticsearch/config/elasticsearch.yml /usr/local/docker/elasticsearch/config/elasticsearch.yml
#编辑配置文件
vim /usr/local/docker/elasticsearch/config/elasticsearch.yml
#根据自己的配置内容进行修改
cluster.name: "docker-cluster"
network.host: 0.0.0.0
#跨域设置
http.cors.enabled: true
http.cors.allow-origin: "*"
#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
#
# The following settings, TLS certificates, and keys have been automatically
# generated to configure Elasticsearch security features on 16-12-2022 08:21:56
#
# --------------------------------------------------------------------------------
#****此处是否开启密码校验模式 true是开启密码校验模式,否则不用密码校验
xpack.security.enabled: false
#****启动会报错not all primary shards of [.geoip_databases] index are active at 则将该配置改为false
ingest.geoip.downloader.enabled: false
#添加这个配置以后在kibana中才会显示联机状态,否则会显示脱机状态
xpack.monitoring.collection.enabled: true
#xpack.security.enrollment.enabled: true
# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
#xpack.security.http.ssl:
# enabled: true
# keystore.path: certs/http.p12
# Enable encryption and mutual authentication between cluster nodes
#xpack.security.transport.ssl:
# enabled: true
# verification_mode: certificate
# keystore.path: certs/transport.p12
# truststore.path: certs/transport.p12
#----------------------- END SECURITY AUTO CONFIGURATION -------------------------
docker stop es
docker rm -f es
# 启动方式1
#elasticsearch:8.4.3
# 启动方式2(指定数据卷目录和配置文件等信息)
sudo docker run --name es -p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms256m -Xmx512m" \
-v /usr/local/docker/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /usr/local/docker/elasticsearch/data:/usr/share/elasticsearch/data \
-v /usr/local/docker/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-v /usr/local/docker/elasticsearch/logs:/usr/share/elasticsearch/logs \
-d elasticsearch:8.4.3
firewall-cmd --zone=public --add-port=9200/tcp --permanent && firewall-cmd --reload
http://192.168.11.143:9200
开启密码模式设置elasticsearch.yml的xpack.security.enabled: true该属性为true
当开启此配置的时候,地址栏访问http://ip:9200的时候会弹出密码校验框。此时需要执行以下操作
docker exec -it es容器Id bash
cd /usr/share/elasticsearch/bin
./elasticsearch-setup-passwords interactvie
然后进入容器内部,设置密码