最近換了新電腦所以各種環(huán)境重新搞一遍,順便做個記錄,接下來是安裝操作步驟:
1.下載Elasticsearch:
Docker pull elasticsearch:7.6.2
2.下載kibana:
docker pull kibana:7.6.2
備注:下載的時候版本要統(tǒng)一一下,不然會導(dǎo)致一些版本問題出現(xiàn)
3.下載好之后進(jìn)行如下配置:
mkdir -p /mydata/elasticsearch/config
mkdir -p /mydata/elasticsearch/dataecho "http.host: 0.0.0.0" >/mydata/elasticsearch/config/elasticsearch.yml
/Users/hzp/mydata/elasticsearchecho "http.host: 0.0.0.0" >/Users/hzp/mydata/elasticsearch/config/elasticsearch.yml
chmod -R 777 /mydata/elasticsearch/
4.啟動Elastic Search:
docker run --name elasticsearch -p 9200:9200 -p 9300:9300
-e "discovery.type=single-node"
-e ES_JAVA_OPTS="-Xms64m -Xmx512m"
-v /Users/hzp/mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /Users/hzp/mydata/elasticsearch/data:/usr/share/elasticsearch/data -v /Users/hzp/mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins -d elasticsearch:7.6.2
設(shè)置開機啟動elasticsearch:
docker update elasticsearch --restart=always
5.啟動kibana:
docker run --name kibana -e ELASTICSEARCH_HOSTS=http://172.17.0.2:9200 -p 5601:5601 -d kibana:7.6.2
ELASTICSEARCH_HOSTS=http://172.17.0.2:9200
此處遇到個坑,導(dǎo)致一直無法訪問kibana,這里es的ip需要寫成docker 容器給es分配的ip地址,同時需要修改
kibana.yml中的配置連接信息。
首先需要進(jìn)入到kibana 容器中修改kibana.yml:
# Default Kibana configuration for docker target
server.name: kibanaserver.host: "0"
elasticsearch.hosts: [ "http://172.17.0.2:9200" ] //將此處的地址替換為docker容器給es分配的地址
xpack.monitoring.ui.container.elasticsearch.enabled: true
通過 docker inspect elasticsearch 查看ip 信息
6.設(shè)置開機啟動kibana:
docker update kibana --restart=always
7.測試一下:
查看elasticsearch版本信息:
http://127.0.0.1:9200/
返回如下信息:{ "name" : "cf379b6ff501",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "wsFx1GjnR7amY5oksej4bQ",
"version" : {
"number" : "7.6.2",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "ef48eb35cf30adf4db14086e8aabd07ef6fb113f",
"build_date" : "2020-03-26T06:34:37.794943Z",
"build_snapshot" : false,
"lucene_version" : "8.4.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
}, "tagline" : "You Know, for Search"
}
8.查看elasticsearch 節(jié)點信息:
http://localhost:9200/_cat/nodes
返回如下:
127.0.0.1 19 97 6 0.16 0.46 1.12 dilm * cf379b6ff501
9.訪問kibana http://127.0.0.1:5601/App/kibana#/home:
10.通過kibana devTool 進(jìn)行命令操作:
好了,今天的分享就到這里,覺得有用的大家可以做個收藏關(guān)注,謝謝。