1.安装Elasticsearch
docker pull elasticsearch:5.6.16
docker network create somenetwork
docker run -d --name elasticsearch --net somenetwork -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:5.6.16
注意,需要修改ES配置文件,否则head插件无法连接
sudo docker exec -it es容器id /bin/bash
vi config/elasticsearch.yml 加入以下两行内容,添加后重启ES容器
http.cors.enabled: true
http.cors.allow-origin: "*"
如果Docker无法使用vi,需要安装vim
apt-get update
apt-get install -y vim
编辑完成后重启容器
浏览器访问http://localhost:9200/,出现以下内容表示启动成功
{
"name" : "Ko2wV1k",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "Mxo7Oa5cSi2qel3CJa8RBg",
"version" : {
"number" : "5.6.16",
"build_hash" : "3a740d1",
"build_date" : "2019-03-13T15:33:36.565Z",
"build_snapshot" : false,
"lucene_version" : "6.6.1"
},
"tagline" : "You Know, for Search"
}
2.安装Kibana
docker pull kibana:5.6.16
docker network create somenetwork
docker run -d --name kibana --net somenetwork -p 5601:5601 kibana:5.6.16
3.安装head插件
docker pull mobz/elasticsearch-head:5
docker run -d -p 9100:9100 docker.io/mobz/elasticsearch-head:5
至此,大功告成!可以愉快的玩耍了!
网友评论