安装前先设置docker的国内的镜像私服,这样构建部署会快很多
mkdir /etc/docker/
vi /etc/docker/daemon.json
{
"registry-mirrors":
["https://fzhifedh.mirror.aliyuncs.com","https://hub.daocloud.io","http://hub-mirror.c.163.com","https://registry.docker-cn.com"]
}
第一步:宿主机器创建文件夹并且授权
mkdir /home/data/es6/data
mkdir /home/data/es6/logs
chmod 777 /home/data/es6/data
chmod 777 /home/data/es6/logs
第二步:修改宿主机器参数
sysctl -w vm.max_map_count=655360 && sysctl -p
vi /etc/security/limits.conf
------------------------增加 start -----------------------------
* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
------------------------增加 end -----------------------------
vi /etc/security/limits.d/20-nproc.conf
------------------------增加 start -----------------------------
* soft nproc 4096
------------------------增加 end -----------------------------
第三步:下载es镜像
docker pull daocloud.io/library/elasticsearch:6.6.0
第四步:创建es容器
docker run -d \
--net=host \
--nameelasticsearch\
--restart=always \
-p 9200:9200 \
-p 9300:9300 \
-e ES_JAVA_OPTS="-Xms512m -Xmx512m" \
-e "discovery.type=single-node" \
-v /home/data/es6/data/:/usr/share/elasticsearch/data \
-v /home/data/es6/logs/:/usr/share/elasticsearch/logs \
-v /home/data/es6/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
daocloud.io/library/elasticsearch:6.6.0
http://192.168.0.128:9200/ 判断部署是否成功,可以访问9200端口验证
第五步:下载kibana镜像
docker pull daocloud.io/library/kibana:6.6.0
docker run -it --restart=always --net=host -e ELASTICSEARCH_HOSTS=http://192.168.0.128:9200 -p 5601:5601 --name kibana -d daocloud.io/library/kibana:6.6.0