简体   繁体   English

每当我重新启动 docker/elk 映像时,数据都会丢失

[英]The data is getting lost whenever I restart the docker/elk image

I'm using docker/elk image to display my data in kibana dashboard (Version 6.6.0) and It works pretty good.我正在使用 docker/elk 图像在 kibana 仪表板(版本 6.6.0)中显示我的数据,并且效果很好。 I started the service like using below command.我像使用以下命令一样启动了服务。

Docker Image git repo : Docker 图像 git 回购

 https://github.com/caas/docker-elk

Command:命令:

    sudo docker-compose up --detach

Expecting that it will run background, and did as expected.期望它将在后台运行,并按预期进行。 After two days the server up and running the and third day the kibana alone getting stopped.两天后服务器启动并运行,第三天单独停止了 kibana。 and Used below command to make it up and running.并使用以下命令使其启动并运行。

    sudo docker run -d <Docer_image_name>

It's up and running when I use docker ps command.当我使用 docker ps 命令时,它已启动并运行。 But when I tried to hit the kibana server in chrome browser it says not reachable.但是当我尝试在 chrome 浏览器中访问 kibana 服务器时,它说无法访问。

So I just used to below command to restart the service.所以我只是习惯了下面的命令来重新启动服务。

    sudo docker-compose down

After that I can see kibana server in chrome browser which is up and running but I do see all my data is lost.之后,我可以在 Chrome 浏览器中看到 kibana 服务器已启动并正在运行,但我确实看到我的所有数据都丢失了。

I used below URL in jenkins to collect the data.我在 jenkins 中使用了下面的 URL 来收集数据。

`http://hostname:9200/ecdpipe_builds/extern`al 

Any idea how can I resolve this issue?知道如何解决这个问题吗?

I did not see the persistent storage configuration the image you mentioned in their GitHub docker-compose file.我没有看到你在他们的 GitHub docker-compose 文件中提到的图像的持久存储配置。

This is common to lost data in case of docker container if you did not provide persistent storage configuration.如果您未提供持久存储配置,则在 docker 容器的情况下丢失数据很常见。 so docker-compose down may cause to lost you data if there is no persistent configuration docker-compose file.所以如果没有持久配置 docker-compose 文件, docker-compose down可能会导致您的数据丢失。

Persisting log data持久化日志数据

In order to keep log data across container restarts, this image mounts /var/lib/elasticsearch — which is the directory that Elasticsearch stores its data in — as a volume.为了在容器重新启动时保留日志数据,此映像将/var/lib/elasticsearch elasticsearch(Elasticsearch 存储其数据的目录)作为卷挂载。

You may however want to use a dedicated data volume to persist this log data, for instance to facilitate back-up and restore operations.但是,您可能希望使用专用数据卷来保存此日志数据,例如便于备份和恢复操作。

One way to do this is to mount a Docker named volume using docker's -v option, as in:一种方法是使用 docker 的 -v 选项安装 Docker 命名卷,如下所示:

$ sudo docker run -p 5601:5601 -p 9200:9200  -p 5044:5044 \
    -v elk-data:/var/lib/elasticsearch --name elk sebp/elk

This command mounts the named volume elk-data to /var/lib/elasticsearch (and automatically creates the volume if it doesn't exist; you could also pre-create it manually using docker volume create elk-data).此命令将命名卷 elk-data 挂载到 /var/lib/elasticsearch(如果卷不存在,则自动创建该卷;您也可以使用 docker volume create elk-data 手动预创建它)。

So you can set these paths in your docker-compose file accordingly.因此,您可以在 docker-compose 文件中相应地设置这些路径。 Here is the link that you can check elk-docker-persisting-log-data这是您可以检查elk-docker-persisting-log-data的链接

Use docker volume or file location as persistant space使用 docker 卷或文件位置作为持久空间

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 服务器重启后Redis数据丢失 - Redis data lost after server restart 根据Linux Docker + Rethinkdb映像调整了Azure VM的大小,并且数据丢失了,这是可以预期的吗? - Resized Azure VM based on the Linux Docker+Rethinkdb image and the data was lost, is this to be expected? 在 Docker 中不断重启容器 - Continuously restart container in Docker 获取32位Centos Docker映像 - Getting 32 bit Centos docker image 我正在使用 amazon Linux 2 & 每当我尝试使用 yum 命令时,我都会收到错误消息 - I am working on amazon Linux 2 & whenever I am trying to use yum command I am getting error 我收到错误消息:每当我运行yml策略标记实例时,此处都不允许使用映射值 - I am getting error: mappings value are not allowed here whenever I am running the yml policy to tag the instance 从“ Docker Hub”下载映像后,应将配置文件放在哪里? 在数据量上? - After downloading image from “Docker Hub”, where should I put my configuration file? In data volume? 我如何重新启动我的网站并将新更改应用到 docker 容器? - How can i restart my website and apply new changes to a docker container? 如何使用Docker映像构建应用程序? - How do I build an application with a docker image? 如何创建可分发的 Docker 映像? - How do I create a distributable Docker image?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM