当前位置:网站首页>Troubleshooting: MySQL containers in alicloud lightweight application servers stop automatically

Troubleshooting: MySQL containers in alicloud lightweight application servers stop automatically

2022-06-09 04:43:00 Migrant worker Lao Wang

Blog home page :https://tomcat.blog.csdn.net
Blogger's nickname : Lao Wang of migrant workers
Main areas :Java、Linux、K8S
We look forward to your attention, praise and collection comments
 hometown

Details of the problem

Recently, I helped a graduate teacher to deploy a set of on alicloud lightweight application servers app Back end , Contains a MySQL Service instances and a set of Java Code .MySQL The deployment of is to use yum install docker Environmental Science , Then run one of them MySQL Containers .Java The deployment of is to use yum install jdk Environmental Science , And then run java -jar ${jar file } that will do . I deploy and run first MySQL service , Run again Jar file .

The operation of the whole deployment is not complicated , There should be no problem . But run start Jar When you file , The database connection error is always reported , As shown in the figure below :
 Please add a picture description
Face the problem , First of all, I was in the local IDEA Medium test start , But no error was reported .

Then I found that every time Java Run at startup jar In the process of packaging ,MySQL The container will stop . Even after the container hangs up , I will restart it manually right away ,MySQL The container will also stop again in twoorthree minutes .

This is depressing , function Jar package , How could it lead to MySQL Hang up ?

Question why

Finally, I realized that the alicloud lightweight application server may be configured too low , The server that the teacher chooses is the cheapest ,1 nucleus CPU,1G Memory . Start up Jar When you file ,MySQL The container stopped because of insufficient memory .

solve the problem

Find the cause , Then the problem will be solved .

There are two solutions :

  1. Upgrade server configuration . This is the simplest and most direct way .
  2. Deploy in a way that consumes less resources .

In this deployment , I took the second approach , No more use and startup docker, Instead, the traditional method , A set of... Is deployed directly on the server MySQL service . Then the problem was solved .


If you want to reprint , Please indicate the source of this article : Migrant worker Lao Wang's CSDN Blog https://blog.csdn.net/monarch91 .

原网站

版权声明
本文为[Migrant worker Lao Wang]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206090441373025.html