使用docker安装ElasticSearch和Kibana和ik分词器

切换到root用户

sudo root

密码:vagrant

1、下载elasticsearch和kibana

docker pull elasticsearch:7.4.2
docker pull kibana:7.4.2

2、建立映射文件夹

 mkdir -p /mydata/elasticsearch/config
 mkdir -p /mydata/elasticsearch/data

3、设置任何机器可访问elasticsearch:将http.host: 0.0.0.0写入


 echo "http.host: 0.0.0.0">>/mydata/elasticsearch/config/elasticsearch.yml

4、配置映射路径并且启动 elasticsearch

 docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \
 -e "discovery.type=single-node" \
 -e ES_JAVA_OPTS="-Xms64m -Xmx128m" \
 -v /mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
 -v /mydata/elasticsearch/data:/usr/share/elasticsearch/data \
 -v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins\
 -d elasticsearch:7.4.2

补充:

5、 chmod -R 777 /mydata/elasticsearch/ 授权访问

6、 chmod -R 777 /mydata/elasticsearch/ 查看日志

7、启动elasticsearch:docker start elasticsearch

 

 5、安装kibana

docker run --name kibana -e ELASTICSEARCH_HOSTS=http://192.168.56.10:9200 -p 5601:5601 \
-d kibana:7.4.2

6、安装ik分词器

wget  https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.4.2/elasticsearch-analysis-ik-7.4.2.zip

 如果没有wget命令

yum install -y wget

7、 cd elasticsearch/plugs

 yum install -y unzip zip
 unzip elasticsearch-analysis-ik-7.4.2.zip

 

补充:docker的安装以及使用docker安装mysql和redis链接:https://blog.csdn.net/AdolfQiu/article/details/107190581 

 

你可能感兴趣的:(备注笔记,elasticsearch,es,docker)