mkdir /root/app/elk/es/data
增加目录权限不增加权限,es有可能启动不起来
chmod -R +777 /root/app/elk/es
配置文件docker-compose.yml 在/root/app/elk下创建docker-compose.yml
下面需要注意的是kibana那里最好填写你的机器ip
version: '2.2'services: elasticsearch: image: elasticsearch:7.1.1 container_name: elasticsearch7.1.1 environment: - discovery.type=single-node - "ES_JAVA_OPTS=-Xms512m -Xmx512m" volumes: - /root/app/elk/es/data:/usr/share/elasticsearch/data hostname: elasticsearch restart: always ports: - 9200:9200 - 9300:9300 kibana: image: kibana:7.1.1 container_name: kibana7.1.1 environment: - elasticsearch.hosts=http://你的机器ip:9200 hostname: kibana depends_on: - elasticsearch restart: always ports: - "5601:5601"
防火墙开放端口9200,9300,5601
进入目录cd /root/app/elk
启动docker-compose up -d
查看eshttp://你的ip:9200/_cat/health?v
查看kibanahttp://你的ip:5601/
关闭docker-compose down -v