docker-compose elasticsearch
时间: 2023-05-04 14:01:20 浏览: 66
docker-compose elasticsearch 是一个使用 Docker Compose 部署 Elasticsearch 的命令。它会根据指定的 YAML 配置文件,启动 Elasticsearch 容器,并可同时启动其他服务容器,如 Kibana、Logstash 等,以构建一个完整的 ELK(Elasticsearch + Logstash + Kibana)环境。
相关问题
docker-compose elasticsearch kibana
Docker Compose is a tool for defining and running multi-container Docker applications. Elasticsearch and Kibana are two popular open-source tools for searching and analyzing data.
To set up Elasticsearch and Kibana using Docker Compose, follow these steps:
1. Create a new directory for your Docker Compose project.
2. Create a new file called `docker-compose.yml` in that directory.
3. Add the following code to the `docker-compose.yml` file:
```
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2
environment:
- discovery.type=single-node
ports:
- 9200:9200
kibana:
image: docker.elastic.co/kibana/kibana:7.9.2
ports:
- 5601:5601
environment:
- ELASTICSEARCH_URL=http://elasticsearch:9200
```
4. Save the `docker-compose.yml` file.
5. Open a terminal and navigate to the directory where you saved the `docker-compose.yml` file.
6. Run the following command to start the Elasticsearch and Kibana containers:
```
docker-compose up
```
7. Wait for the containers to start up. You can check the logs by running:
```
docker-compose logs
```
8. Once the containers are running, you can access Kibana by opening a web browser and going to `http://localhost:5601`. You can access Elasticsearch by going to `http://localhost:9200`.
That's it! You now have Elasticsearch and Kibana running in Docker Compose. You can customize the configuration by modifying the `docker-compose.yml` file.
docker-compose elasticsearch 8 kibana配置
以下是使用docker-compose配置elasticsearch 8和kibana的示例:
1. 创建一个新的目录并在其中创建docker-compose.yml文件
```
mkdir es-kibana
cd es-kibana
touch docker-compose.yml
```
2. 编辑docker-compose.yml文件
```
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.0.0
container_name: elasticsearch
environment:
- discovery.type=single-node
ports:
- "9200:9200"
volumes:
- esdata:/usr/share/elasticsearch/data
kibana:
image: docker.elastic.co/kibana/kibana:8.0.0
container_name: kibana
depends_on:
- elasticsearch
ports:
- "5601:5601"
volumes:
esdata:
```
3. 启动docker-compose
```
docker-compose up
```
4. 验证elasticsearch和kibana是否正在运行
- 打开浏览器并访问http://localhost:9200,应该会看到elasticsearch的响应
- 打开浏览器并访问http://localhost:5601,应该会看到kibana的登录页面
现在你已经成功地使用docker-compose配置了elasticsearch 8和kibana!