1、安装Elasticsearch
docker pull elasticsearch:7.14.2
docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.14.2
测试是否成功:
tu@bogon ~ % curl localhost:9200
{
"name" : "b3f5483752a1",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "13VFsELCSDWX4WH5g5djBw",
"version" : {
"number" : "7.14.2",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "6bc13727ce758c0e943c3c21653b3da82f627f75",
"build_date" : "2021-09-15T10:18:09.722761972Z",
"build_snapshot" : false,
"lucene_version" : "8.9.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
2、安装可视化工具kibana
docker pull kibana:7.14.2
docker run -d -p 5601:5601 kibana:7.14.2
这里需要修改一下kibana的配置:
docker exec -it 5b9561b4b92d bash //进入kibana容器
vi config/kibana.yml //修改elasticsearch.hosts为你自己主机的ip
elasticsearch.hosts: [ "http://172.16.0.78:9200" ]
docker restart 5b9561b4b92d //退出容器并重启
浏览器打开http://localhost:5601/查看效果: