目录
- 前言
- 安装elasticsearch:7.17.21
- 安装对应版本的kibana
前言
本文主要参考:https://blog.csdn.net/qq_23859799/article/details/138521052,内容基本一致,改动了部分错误
安装elasticsearch:7.17.21
- 拉取镜像:
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.17.21
,我的网速比较慢,等了一两个小时 - 启动容器:
docker run -dt --name elasticsearch-test -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -t docker.elastic.co/elasticsearch/elasticsearch:7.17.21
,这里让其后台运行并分配了伪终端 - 检查elasticsearch是否启动正常,我这里是同一台机器,因此用localhost
[root@localhost ~]# curl 'http://localhost:9200' # 请求响应结果如下:
{
"name" : "f8a41f8d81bf",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "4wbWMMTRSfWyV1JDjjz17Q",
"version" : {
"number" : "7.17.21",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "d38e4b028f4a9784bb74de339ac1b877e2dbea6f",
"build_date" : "2024-04-26T04:36:26.745220156Z",
"build_snapshot" : false,
"lucene_version" : "8.11.3",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
[root@localhost ~]#
安装对应版本的kibana
- 拉取镜像:
docker pull docker.elastic.co/kibana/kibana:7.17.21
- 启动容器:
docker run -dt --name kibana-test -p 5601:5601 docker.elastic.co/kibana/kibana:7.17.21
,同样是后台运行 - 进入容器:
docker exec -it kibana-test bash
- 进入指定目录:
cd config
- 替换elasticsearch.hosts配置中elasticsearch地址,这里不能写localhost了,要写ip:
sed -i 's/elasticsearch:9200/your-ip:9200/g' ./kibana.yml
- 换行:
echo -e "\n" >> kibana.yml
- 添加中文配置:
echo 'i18n.locale: "zh-CN"' >> kibana.yml
- 退出容器后重启:
docker restart kibana-test
- 默认端口5601,浏览器访问即可
从8开始默认开启密码,7还没有,如果需要密码,参考我在文首给出的链接