最近换了新电脑所以各种环境重新搞一遍,顺便做个记录,接下来是安装操作步骤:
1.下载Elasticsearch:
Docker pull elasticsearch:7.6.2
2.下载kibana:
docker pull kibana:7.6.2
备注:下载的时候版本要统一一下,不然会导致一些版本问题出现
3.下载好之后进行如下配置:
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
设置开机启动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
此处遇到个坑,导致一直无法访问kibana,这里es的ip需要写成docker 容器给es分配的ip地址,同时需要修改
kibana.yml中的配置连接信息。
首先需要进入到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.设置开机启动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 节点信息:
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 进行命令操作:
好了,今天的分享就到这里,觉得有用的大家可以做个收藏关注,谢谢。