Closed BarbzYHOOL closed 5 years ago
/var/lib/mysql/ib_logfile0
belongs to mysql group @ShahriyarR
@BarbzYHOOL Welcome back :) So based on error it seems to be the Unix system permissions problem. Please see following discussion - maybe it can be useful. https://bugs.mysql.com/bug.php?id=84488
I mean, how do you proceed yourself??
I can change /var/lib/mysql to be owned by a "backup" user or even chmod 777, or maybe create a group "percona" and add users mysql
and xtrabackup
in it?
What is your way of doing this? do you run it as root? @ShahriyarR
If you have already spotted that this is exactly the user issue then you can try it to run as sudo
at least.
From official doc:
https://www.percona.com/doc/percona-xtrabackup/LATEST/using_xtrabackup/privileges.html#permissions-and-privileges-needed
Once connected to the server, in order to perform a backup you will need READ, WRITE and EXECUTE permissions at a filesystem level in the server’s datadir.
Of course it works with sudo, but you made a PR https://github.com/ShahriyarR/MySQL-AutoXtraBackup/issues/302 about not needing sudo
So I suppose you know how to proceed to NOT use sudo or root for autoxtrabackup.
So, how do you proceed yourself??
What is your way of doing this? do you run it as root? or with sudo?
How should I proceed? I can change /var/lib/mysql to be owned by a specific "backup" user or even chmod 777, or maybe create a group "percona" and add users "mysql" and "xtrabackup" in it?
Found this solution:
runuser -s "/bin/sh" mysql -c "autoxtrabackup --backup -v -l DEBUG"
what do you think @ShahriyarR :P
I did not have such issue with my tests and production servers :) What do you suggest to add to autoxtrabackup in term of this?
I think nothing needs to be added but to the documentation eventually but in fact it's something related to xtrabackup, I just asked you because you're cool :P
It's just about permissions and by the way you didn't tell me how you run autoxtrabackup (as root, as sudo, or as a simple user but in that case what are your permissions on /var/lib/mysql etc)
@ShahriyarR
@BarbzYHOOL ahah :)
Let me describe the Percona XtraBackup
and autoxtrabackup
itself.
Percona's tool is for hot-online physical backup for MySQL server.
autoxtrabackup is basically Python wrapper command line tool with bunch of bugs :)
MySQL server is owned by mysql
system user and datadir is owned by mysql
user as well so it should not be changed. XtraBackup itself may require root privileges if you are going to parse system files, if you are going to backup to some system folder etc.
In general most of us using Percona XtraBackup under sudo or root - so this not a problem and should not be avoided. Consider situation, you have disaster, you have prepared your full and incremental backups and now you need to recover:
/var/lib/mysql
)mysql:mysql
.Al these kind of steps are going to be possible only with root privileges.
@ShahriyarR ok, I don't remember how autoxtrabackup work for restoring backups but I suppose I can still run it as mysql user lol
I got confused because in one of your PR you talked about sudo for logs, and I still don't understand what was the point if everything else requires sudo
@BarbzYHOOL it was a specific case where I was testing in one of our test servers without polluting system folders. Mentioned steps are fully automated by autoxtrabackup but still they can be achieved manually as well. So just ignore those user related things and please continue to dig into and to find bugs :)
ok, at least my method works even if it's NOT needed (but i wanted to do it properly, in case a bug erases all my /root :P)
I try to run it as a user but i keep getting file permission errors
@ShahriyarR