docker下安装Elasticsearch

1. 创建虚拟网桥

bash 复制代码
docker network create es-net

因为docker和kibana需要共享同一个网络,所以利用docker创建一个共享网络es-net

bash 复制代码
#查看共享网络
docker network ls

2.拉取Kibana的Docker镜像

bash 复制代码
docker pull kibana:7.4.2

2.1运行Kibana容器

bash 复制代码
docker run -d --name kibana -e ELASTICSEARCH_HOSTS=http://elasticsearch:9200 --network=es-net  -p 5601:5601 kibana:7.4.2

设置elasticsearch的地址,因为kibana已经与elasticsearch在一个网络,因此可以用容器名直接访问elasticsearch

现在,你可以通过浏览器访问http://localhost:5601来使用Kibana

2.2 汉化

bash 复制代码
打开 /usr/share/kibana/config/kibana.yml 在文档末尾加入
i18n.locale: zh-CN

3. 拉取elasticsearch镜像

bash 复制代码
docker pull elasticsearch:7.17.1
# 查看镜像是否拉取成功
docker images

3.1 创建映射文件夹及配置文件

3.2 创建容器

bash 复制代码
docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300  -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms512m -Xmx512m" -v C:\mq\es\config\elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v C:\mq\es\data:/usr/share/elasticsearch/data -v C:\mq\es\plugins:/usr/share/elasticsearch/plugins  --privileged --network es-net   elasticsearch:7.4.2

3.3 浏览器访问:http://127.0.0.1:9200/

4.下载ik分词器插件

再次强调:ik分词器的版本需要和es的版本一致

bash 复制代码
https://github.com/infinilabs/analysis-ik/releases?page=2

4.1 将ik转移到docker容器内部

将解压好的ik文件夹放在/tmp下,下面将ik复制到docker容器中。

bash 复制代码
# bash复制代码docker 
cp /tmp/ik elasticsearch:/usr/share/elasticsearch/plugins

4.2 重新启动ES容器

bash 复制代码
docker restart elasticsearch

5.安装elasticsearch-head

bash 复制代码
docker pull mobz/elasticsearch-head:5

5.1 运行elasticsearch-head容器并链接到elasticsearch容器

bash 复制代码
docker run -d --name elasticsearch-head --link elasticsearch:elasticsearch -p 9100:9100 mobz/elasticsearch-head:5

6.访问

Node Exporterhttp://localhost:9100/

7.ik分词器配置-自定义分词

相关推荐
没有名字的小羊25 分钟前
8.Docker镜像讲解
运维·docker·容器·tomcat
木鱼时刻1 小时前
容器与 Kubernetes 基本概念与架构
容器·架构·kubernetes
G皮T2 小时前
【Elasticsearch】检索排序 & 分页
大数据·elasticsearch·搜索引擎·排序·分页·检索·深度分页
企鹅侠客3 小时前
实践篇:14-构建 Node.js 应用程序镜像
docker·node.js·dockerfile
做一个AC梦3 小时前
Docker安装失败:Docker Desktop installation failed
运维·docker·容器
Shan12053 小时前
浅谈Docker Kicks in的应用
运维·docker·容器
Li&&Tao3 小时前
docker 常用命令
docker·容器·eureka
Jiude5 小时前
MinIO 社区版被故意阉割,Web管理功能全面移除。我来试试国产RustFS
后端·docker·架构
飞询6 小时前
Docker 安装 Elasticsearch 9
elasticsearch·docker
G皮T7 小时前
【Elasticsearch】检索高亮
大数据·elasticsearch·搜索引擎·全文检索·kibana·检索·高亮