一、Docker安装ES7.14.0
1、下载镜像
docker pull elasticsearch:7.14.0
2、docker安装服务器托管网7.14.0
mkdir -p /usr/local/elasticsearch/config
mkdir -p /usr/local/elasticsearch/data
chmod 777 -R /usr/local/elasticsearch/
echo “http.host: 0.0.0.0” >> /usr/local/elasticsearch/config/elasticesearch.yml
docker run –name elasticsearch -p 9200:9200 -p 9300:9300 -e “discovery.type=single-node” -e ES_JAVA_OPTS=”-Xms64m -Xmx128m” -v /usr/local/elasticsearch/config/elasticesearch.yml:/usr/local/elasticsearch/config/elasticesearch.yml -v /usr/local/elasticsearch/data:/usr/local/elasticsearch/data -v /usr/local/elasticsearch/plugins:/usr/local/elasticsearch/plugins -d elasticsearch:7.14.0
- -e “cluster.name=es-docker-cluster”:设置集群名称
- -e “http.host=0.0.0.0″:监听的地址,可以外网访问
- -e “ES_JAVA_OPTS=-Xms64m -Xmx128m”:内存大小
- -e “discovery.type=single-node”:非集群模式
- -v es-data:/usr/share/elasticsearch/data:目录映射,绑定elasticsearch的数据目录
- -v es-logs:/usr/share/elasticsearch/logs:目录映射,绑定elasticsearch的日志目录
- -v es-plugins:/usr/share/elasticsearch/plugins:目录映射,绑定elasticsearch的插件目录
- -p 9服务器托管网200:9200:端口映射配置
3、访问
http://10.1.1.74:9200
二、Docker安装kibana:7.14.0
1、下载镜像
版本:kibana:7.14.0 需要和ES版本对应
Kibana 是一个免费且开放的用户界面,能够让您对 Elasticsearch 数据进行可视化。
2、安装kibana
docker run -d –name kibana714 -e ELASTICSEARCH_HOSTS=”http://10.1.1.74:9200″ -p 5601:5601 kibana:7.14.0
- -e ELASTICSEARCH_HOSTS ES地址:注意不要使用127.0.0.1
访问UI界面:http://10.1.1.74:5601/
三、Docker-compose安装ES和kibana(有些问题)
1、创建配置文件目录
mkdir -p /usr/local/elasticsearch/config
mkdir -p /usr/local/elasticsearch/data
chmod 777 -R /usr/local/elasticsearch/
echo “http.host: 0.0.0.0” >> /usr/local/elasticsearch/config/elasticesearch.yml
2、#创建docker-compose.yml文件
version: "3"
volumes:
es-data:
services:
elasticsearch:
image: elasticsearch:7.14.0
ports:
- "9200:9200"
- "9300:9300"
environment:
- "discovery.type=single-node"
- "ES_JAVA_OPTS=-Xms256m -Xmx256m"
volumes:
- /usr/local/elasticsearch/data:/usr/share/elasticsearch/data
- /usr/local/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- /usr/local/elasticsearch/plugins:/usr/share/elasticsearch/plugins
networks:
- es
kibana:
image: kibana:7.14.0
container_name: kibaba7.14
ports:
- "5601:5601"
environment:
- "ELASTICSEARCH_HOSTS=http://10.1.1.74:9200"
depends_on:
- elasticsearch
networks:
- es
networks:
es:
driver: bridge
3、#自我检测自己写的有没有语法上的问题
docker-compose config -q
4、#启动和停止
docker-compose up -d
docker-compose down
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net