1、pull 镜像

docker pull docker.elastic.co/elasticsearch/elasticsearch:7.7.0

2、运行elasticsearch

docker run --name=elastic770 -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" --network=network_172_19 --ip=172.19.0.101 -v /var/docker/elastic/data:/data docker.elastic.co/elasticsearch/elasticsearch:7.7.0

注意测试环境加上-e "discovery.type=single-node"

3、安装ik分词插件

docker exec -it elastic770 /bin/bash

./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.7.0/elasticsearch-analysis-ik-7.7.0.zip

4、其他配置

docker exec -it elastic770 /bin/bash

yum update

yum install vim

vim /config/elasticsearch.yml

修改elasticsearch.yml

cluster.name: "elasticsearchSZGHJ"

network.host: 0.0.0.0

node.name: node0

http.host: 0.0.0.0

http.cors.enabled: true

http.cors.allow-origin: "*"

5、安装可视化管理工具

docker run -p 9800:9800 -d --network=network_172_19 --link elastic770:hd containerize/elastichd

在浏览器打开http://localhost:9800

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐