Percona XtraDB Cluster: SElinux is not always the culprit !Frederic Descamps
If you are using SElinux, you should know that it’s advised to disable it to avoid issue with PXC. Generally the communication between your nodes doesn’t work properly and a node having SElinux enabled won’t be able to join the cluster.
So when a node doesn’t join the cluster where it should, my first reflex is to have a look at audit.log. But recently I faced another problem: the node joined the cluster but SST failed (whatever which method was used, discarding skip).
I checked SElinux and it was of course disabled, then I add some debug information in the SST script but it seemed that the script was never launched. And this time the culprit is called : AppArmor !
Percona doesn’t provide any AppArmor profile for PXC, but it seems that on this server (Ubuntu TLS), a previous version of MySQL was installed and then removed but the AppArmor profile was still present.
So if you use apparmor (or if you don’t know) and you want to check is there is a profile for mysql, you can run the following command :
apparmor module is loaded.
7 profiles are loaded.
7 profiles are in enforce mode.
0 profiles are in complain mode.
2 processes have profiles defined.
2 processes are in enforce mode.
0 processes are in complain mode.
You can disable a profile easily by running
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
For more information related to AppArmor, you can refer to Ubuntu’s wiki
So now if you run ubuntu, you have two things to check first : SElinux and AppArmor !
Note: We often advise to disable SElinux and AppArmor on dedicated MySQL servers to avoid the performance overhead