Often the database import in Plesk hangs at 100%. Users often notice errors even while importing a comparatively small database.
At Bobcares, our Support Engineers often get the request to solve Plesk usage problems as a part of our Server Management Services.
Today, let’s analyze the cause and see how our Support Team fix Database import issues for our customers.
What causes Database import to hang in Plesk
Recently we received a request from one of our customers that the database import task from Plesk was getting hang. This was even the case with considerably smaller databases. Mysql error log at “/var/log/mysql/error.log” was reporting the error as shown below:
While we cross-checked the Mysql CPU usage, we noticed that the usage has spiked to a great extend. A typical usage that we noticed resembled the one below:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
16164 mysql 20 0 2654656 748200 8044 S 201.0 18.3 2698:08 mysqld
This error generally triggers due to non-optimized client databases.
How to fix Database import hang in Plesk
As the database import tasks normally hang at 100% due to non-optimized databases, we need to optimize the databases to fix this error permanently.
One solution here would be to allocate RAM to the MySQL server. For this, we need to connect to the Plesk server via SSH. Then, we need to open the MySQL configuration file my.cnf
or my.ini
with any text editor. Locations of these files vary for different Linux distros.
For CentOS/RHEL:
/etc/my.cnf
For Debian/Ubuntu:
/etc/mysql/my.cnf
Then, we need to add the following directives under the [mysqld]
section or increase the values if these directives are already defined:
innodb_buffer_pool_size=1024M
query_cache_size=64M
Once the changes are made, save the changes and close the file. Also, note to restart the MySQL service with the appropriate command:
For CentOS/RHEL:
# systemctl restart mariadb
For Debian/Ubuntu:
# systemctl restart mysqld
Now, we need to monitor CPU usage. If CPU consumption increases again, our Support Engineers consider reviewing the SQL code of a database that has slow queries.
During a high level of CPU usage, we can find queries that are currently running and taking a lot of time with the command below:
plesk db "SHOW FULL PROCESSLIST"
This would help us to note down the queries that are getting stuck up. We also note to check the MySQL error log file /var/log/mysqld.log
for errors.
Another possible reason could be low RAM and disk space available in the server. We can check RAM and free disk space with the command below:
# free -h
# df -h
[Need any further assistance to fix Plesk server errors? – We’re available 24*7 ]
Conclusion
In short, the database import task in Plesk fails due to non-optimized client databases. Today, we saw some tips that our Support Engineers use to optimize the databases.
0 Comments