简体   繁体   English

监控在Docker容器中运行的MySQL?

[英]Monitoring MySQL running within a docker container?

I am running mysql (percona) within a docker container. 我正在docker容器中运行mysql(percona)。 Our normal operations are fine, but once in a while when using it with 1000s of insert operations consecutively, my db connection is lost is and results in my application crash. 我们的正常操作很好,但是偶尔将其与数千次插入操作连续使用时,我的数据库连接丢失,并导致我的应用程序崩溃。

How do I monitor the mysql instance running inside the docker container? 如何监视在docker容器中运行的mysql实例? What solutions are available to me? 我可以使用哪些解决方案? Ideally, I would like to monitor mysql from the host environment, see the logs and notice when we hit an application error. 理想情况下,我想从主机环境监视mysql,查看日志并在遇到应用程序错误时发出通知。

Any suggestions? 有什么建议么?

You can collect logs from container's output: docker logs -f container_id 您可以从容器的输出中收集日志: docker logs -f container_id

Or even run bash inside this container and work as you want: docker exec -it container_id bash 甚至在此容器中运行bash并根据需要工作: docker exec -it container_id bash

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM