部署ES7+配置X-Pack
docker pull elasticsearch:7.4.2
docker pull kibana:7.4.2
mkdir -p /mnt/bigdata/elasticsearch/config
mkdir -p /mnt/bigdata/elasticsearch/data
echo "http.host: 0.0.0.0" >/mnt/bigdata/elasticsearch/config/elasticsearch.yml
# 跨域允许设置的头信息,默认为X-Requested-With,Content-Type,Content-Lengt
http.cors.allow-headers: Authorization
# 这条配置表示开启xpack认证机制
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
递归更改权限,给与ES挂载目录最大权限,保证所有用户可读可写,不然默认是root用户才可以读写chmod -R 777 /mnt/bigdata/elasticsearch/
配置ES占用内存,挂载目录,启动ES容器
docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \-e "discovery.type=single-node" \-e ES_JAVA_OPTS="-Xms1024m -Xmx2048m" \ -v /mnt/bigdata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \ -v /mnt/bigdata/elasticsearch/data:/usr/share/elasticsearch/data \ -v /mnt/bigdata/elasticsearch/plugins:/usr/share/elasticsearch/plugins \-d elasticsearch:7.4.2
查看ES容器是否启动成功
docker logs elasticsearch或者docker logs 容器id
进入容器,挨个设置elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user等账号的密码
docker exec -it elasticsearch /bin/bash
cd bin/
/elasticsearch-setup-passwords interactive
重启ES容器
部署Kibana7
启动kibana容器
docker run --name kibana -e ELASTICSEARCH_HOSTS=http://宿主机内网ip:9200 -p 5601:5601 -d kibana:7.4.2
进入kibana容器,修改启动配置文件
docker exec it kibana
vi /usr/share/kibana/config/kibana.yml
添加如下配置: