linux下docker安装ES(7.8.0)和kibana。CentOS 8.2
拉取镜像
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.8.0
运行es
docker run --name elasticsearch -d -e ES_JAVA_OPTS="-Xms512m -Xmx512m" -e "discovery.type=single-node" -p 9200:9200 -p 9300:9300 elasticsearch:7.8.0
拉取kibana镜像(kibana镜像要和es镜像版本保持一致)
docker pull kibana:7.8.0
运行kibana
docker run --name kib-01 -p 5601:5601 docker.elastic.co/kibana/kibana:7.8.0
访问本机9200端口
curl http://localhost:9200
#正常返回内容
{
"name" : "79526307081e",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "9AFfqXc9SiGhQ5Cr9zClSw",
"version" : {
"number" : "7.8.0",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "757314695644ea9a1dc2fecd26d1a43856725e65",
"build_date" : "2020-06-14T19:35:50.234439Z",
"build_snapshot" : false,
"lucene_version" : "8.5.1",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
配置elasticsearch.yml和kibana.yml
以上述docker容器为例,进入elasticsearch和kibana容器内修改配置文件
docker exec -it -u root elasticsearch /bin/bash
接着进入config文件夹下修改elasticsearch.yml
cd config/
vim elasticsearch.yml
vim需要手动安装
yum install vim
进入yml文件后按下i进行编辑主要添加es对跨域的支持
http.cors.enabled: true
http.cors.allow-origin: "*"
同理进入kibana
docker exec -it -u root kib-01 /bin/bash
cd config/
vim kibana.yml
修改配置文件
server.name: kibana
server.host: "0.0.0.0" #默认为0
elasticsearch.hosts: [ "http://本机ip地址:9200" ]
monitoring.ui.container.elasticsearch.enabled: false #默认false,但是拉取镜像运行尽然默认开启了。
重启docker
systemctl restart docker
访问5601
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/280106.html