1.docker拉取安装包
docker pull elasticsearch:8.12.2
docker pull kibana:8.12.2
2.安装es8
单点部署
# 创建网络
docker network create es-net
# 运行容器
docker run -it \
--name es \
--net es-net \
--restart=always \
-p 8000:9200 \
-p 8001:9300 \
-e "discovery.type=single-node" \
elasticsearch:8.12.2
注意会出现指令和密码
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ Elasticsearch security features have been automatically configured!
✅ Authentication is enabled and cluster connections are encrypted.
ℹ️ Password for the elastic user (reset with `bin/elasticsearch-reset-password -u elastic`):
Esip1jxWlRPBHXMujGxK
ℹ️ HTTP CA certificate SHA-256 fingerprint:
c68d0f58b4523c51dd1cdc927b56f4a52f8929e9cde086a316bfd60c24798255
ℹ️ Configure Kibana to use this cluster:
• Run Kibana and click the configuration link in the terminal when Kibana starts.
• Copy the following enrollment token and paste it into Kibana in your browser (valid for the next 30 minutes):
eyJ2ZXIiOiI4LjEyLjIiLCJhZHIiOlsiMTcyLjE4LjAuMjo5MjAwIl0sImZnciI6ImM2OGQwZjU4YjQ1MjNjNTFkZDFjZGM5MjdiNTZmNGE1MmY4OTI5ZTljZGUwODZhMzE2YmZkNjBjMjQ3OTgyNTUiLCJrZXkiOiJwOGluSG84QkI0SG1LUDNxY2ZrUzpQdlBNbVB1SVFteXlDeS1EQnlwZmxBIn0=
ℹ️ Configure other nodes to join this cluster:
• Copy the following enrollment token and start new Elasticsearch nodes with `bin/elasticsearch --enrollment-token <token>` (valid for the next 30 minutes):
eyJ2ZXIiOiI4LjEyLjIiLCJhZHIiOlsiMTcyLjE4LjAuMjo5MjAwIl0sImZnciI6ImM2OGQwZjU4YjQ1MjNjNTFkZDFjZGM5MjdiNTZmNGE1MmY4OTI5ZTljZGUwODZhMzE2YmZkNjBjMjQ3OTgyNTUiLCJrZXkiOiJwc2luSG84QkI0SG1LUDNxY2ZrUzpOU1hJbU5iRFJCeXJybjhuOE9tdUV3In0=
If you're running in Docker, copy the enrollment token and run:
`docker run -e "ENROLLMENT_TOKEN=<token>" docker.elastic.co/elasticsearch/elasticsearch:8.12.2`
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
修改配置文件
# 把配置文件copy出来
docker cp es:/usr/share/elasticsearch/config/elasticsearch.yml ./
# =====添加如下配置=====
# 开启跨域
http.cors.enabled: true
# 所有人访问
http.cors.allow-origin: "*"
# ======================
# =====修改如下配置为false=====
xpack.security.enabled: false
xpack.security.http.ssl:
enabled: false
# ======================
# 把配置文件copy回去
docker cp elasticsearch.yml es:/usr/share/elasticsearch/config/
# 重启服务
docker restart es
3.安装kibana
docker run -d \
--name kib \
--network=es-net \
-p 8002:5601 \
kibana:8.13.0
修改配置文件
docker cp kib:/usr/share/kibana/config/kibana.yml ./
# ========添加配置
#设置中文
i18n.locale: "zh-CN"
#关闭csp
csp.strict: false
# ========
docker cp kibana.yml kib:/usr/share/kibana/config/
docker restart kib
启动后遇到一个kib后台错误,无法验证令牌连接到es
es write EPROTO C02754C0847F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:
# 查看es的ip地址
docker network inspect es-net
"e64dc922a7cdb9528bdf2f724f9846f99349234cc2a467a3f3e838de246dde41": {
"Name": "es",
"EndpointID": "91a8a618a1eb01eac18fd53c5a6a76beecd9ca44e8678f632908a530b6f73ac0",
"MacAddress": "02:42:ac:12:00:02",
"IPv4Address": "172.18.0.2/16",
"IPv6Address": ""
}
# 将kib的配置文件进行修改
elasticsearch.hosts: [ "http://172.18.0.2:9200" ]
docker cp kibana.yml kib:/usr/share/kibana/config/


937

被折叠的 条评论
为什么被折叠?



