Done
Details
Details
Assignee
Hrvoje Matijakovic
Hrvoje MatijakovicReporter
Gena Makhomed
Gena MakhomedNeeds QA
Yes
Components
Fix versions
Affects versions
Priority
Smart Checklist
Smart Checklist
Created April 23, 2023 at 10:28 PM
Updated August 6, 2024 at 3:16 PM
Resolved August 6, 2024 at 3:15 PM
Install percona-server-server-8.0.32-24.1.el9.x86_64.rpm on the Rocky Linux from official Percona Server for MySQL repo.
In the provided in the rpm default ```/etc/my.cnf``` file I see:
```
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
```
But in the ```/etc/logrotate.d/mysql``` I can see different path: ```/var/lib/mysql/mysqld.log```.
This is means, what ```/etc/logrotate.d/mysql``` configuration file is totally useless, because it never can rotate the ```/var/log/mysqld.log``` mysqld error log.
Path ```/var/lib/mysql/mysqld.log``` in the ```/etc/logrotate.d/mysql``` is wrong, because logs should be stored inside ```/var/log/``` but not nside ```/var/lib/```.
Also it will be very good, if ```slow-query-log-file=/var/log/mysqld-slow.log``` also will be included in the ```/etc/my.cnf``` file, disabled by default, for example like this:
```
slow_query_log=OFF
slow_query_log_file = /var/log/mysqld-slow.log
```
and in rpm file as zero length file with mysql:mysql owner and 0600 permissions.
this will greatly simplify Percona Server for MySQL usagage, especially for new users.
Ideally, log file ```/var/log/mysqld-slow.log``` should be also included in the ```/etc/logrotate.d/mysql``` config for no need for manual logrotate configuration in the future.
Proposed variant of ```/etc/logrotate.d/mysql``` configuration file for including in the future releases of Percona Server for MySQL:
```
/var/log/mysqld.log
/var/log/mysqld-slow.log
{
create 600 mysql mysql
notifempty
daily
rotate 5
missingok
#compress
nodateext
postrotate
# just if mysqld is really running
if test -x /usr/bin/mysqladmin && \
/usr/bin/mysqladmin ping &>/dev/null
then
/usr/bin/mysqladmin flush-logs
fi
endscript
}
```
compression is disabled by default for easy of view and analyze logs with percona-tools,
nodateext is set for more beautiful look of files in the /var/log/ directory. For example:
```
ls -la /var/log/mysql*
rw------ 1 mysql mysql 0 Mar 31 03:27 /var/log/mysqld.log
rw------ 1 mysql mysql 222 Mar 30 09:27 /var/log/mysqld.log.1
rw------ 1 mysql mysql 222 Mar 28 10:40 /var/log/mysqld.log.2
rw------ 1 mysql mysql 222 Mar 24 11:36 /var/log/mysqld.log.3
rw------ 1 mysql mysql 222 Mar 23 17:41 /var/log/mysqld.log.4
rw------ 1 mysql mysql 222 Mar 22 11:09 /var/log/mysqld.log.5
rw------ 1 mysql mysql 710046076 Apr 24 01:07 /var/log/mysqld-slow.log
rw------ 1 mysql mysql 820775869 Apr 23 03:32 /var/log/mysqld-slow.log.1
rw------ 1 mysql mysql 760071061 Apr 22 03:08 /var/log/mysqld-slow.log.2
rw------ 1 mysql mysql 833239054 Apr 21 03:36 /var/log/mysqld-slow.log.3
rw------ 1 mysql mysql 792484303 Apr 20 03:39 /var/log/mysqld-slow.log.4
rw------ 1 mysql mysql 799129876 Apr 19 03:35 /var/log/mysqld-slow.log.5
```
P.S.
Also, ```pid-file=/var/run/mysqld/mysqld.pid``` - is the wrong setting.
May be it will me better to use just ```pid-file=/run/mysqld/mysqld.pid``` ?
Because /var/run is just symlink to the ```../run``` on the all modern distros.
In the configuration file ```/usr/lib/tmpfiles.d/mysql.conf ``` already right path, for creating ```/run/mysqld``` directory: ```d /run/mysqld 0755 mysql mysql -```.
In the rpm file directory ```/var/run/mysqld``` is useless, because if you remove file ```/usr/lib/tmpfiles.d/mysql.conf ``` on the package uninstall - this directory ```/var/run/mysqld``` fill not be more created on the ```/run``` tmpfs filesystem after reboot.
Can you please fix these packaging bugs and errors in the Percona Server for MySQL rpm?