基于Docker安装Elasticsearch + Kibana
- 前提是先安装好Docker的环境
Docker创建网络
- Docker创建一个网络专门连接Elasticsearch和Kibana
docker network create es-net
Docker安装Elasticsearch
- 拉取镜像(这里以8.6.0版本为例)
docker pull elasticsearch:8.6.0
- 创建es的挂载点(没有挂载config目录是因为映射了会报错)
mkdir -p /usr/local/es/data /usr/local/es/plugins
chmod 777 /usr/local/es/data
chmod 777 /usr/local/es/plugins
- 创建es容器
docker run -d \
--restart=always \
--name es \
--network es-net \
-p 9200:9200 \
-p 9300:9300 \
--privileged \
-v /usr/local/es/data:/usr/share/elasticsearch/data \
-v /usr/local/es/plugins:/usr/share/elasticsearch/plugins \
-e xpack.security.enabled=false \
-e "discovery.type=single-node" \
-e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \
elasticsearch:8.6.0
- 测试是否安装成功
浏览器访问ip地址+端口号: xxx.xxx.xxx.xxx:9200
浏览器出现如下响应则安装成功
{
"name": "fdf01574d3e2",
"cluster_name": "docker-cluster",
"cluster_uuid": "UU_yrddjSxqTapEkSrbrSw",
"version": {
"number": "8.6.0",
"build_flavor": "default",
"build_type": "docker",
"build_hash": "f67ef2df40237445caa70e2fef79471cc608d70d",
"build_date": "2023-01-04T09:35:21.782467981Z",
"build_snapshot": false,
"lucene_version": "9.4.2",
"minimum_wire_compatibility_version": "7.17.0",
"minimum_index_compatibility_version": "7.0.0"
},
"tagline": "You Know, for Search"
}
- 进入容器命令
docker exec -it es /bin/bash
Docker安装Kibana
- 拉取镜像(这里以8.6.0版本为例)
docker pull kibana:8.6.0
- 创建kibana的挂载点
mkdir -p /usr/local/kibana/data
chmod 777 /usr/local/kibana/data
- 创建kibana容器
docker run -d \
--restart=always \
--name kibana \
--network es-net \
-p 5601:5601 \
-v /usr/local/kibana/data:/usr/share/kibana/data \
-e ELASTICSEARCH_HOSTS=http://es:9200 \
kibana:8.6.0
- 测试是否安装成功
浏览器访问ip地址+端口号: xxx.xxx.xxx.xxx:5601
能正常打开则安装成功,注意服务器的端口是否开放哦
Kibana设置中文
- 进入kibana容器的config目录
docker exec -it kibana /bin/bash
cd config
- 修改配置文件
cat > kibana.yml <<EOF
server.host: "0.0.0.0"
server.shutdownTimeout: "5s"
elasticsearch.hosts: ["http://xxx.xxx.xxx.xxx:9200"]
monitoring.ui.container.elasticsearch.enabled: true
i18n.locale: "zh-CN"
EOF
Elasticsearch安装IK分词器
- 进入es容器
docker exec -it es /bin/bash
- 安装指令(注意版本要和es一致)
./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v8.6.0/elasticsearch-analysis-ik-8.6.0.zip
标签:8.6,kibana,Elasticsearch,Kibana,Docker,local,docker,es,usr
From: https://www.cnblogs.com/ximensama/p/17921933.html