0

I cannot fully kill a mysql service on CentOS 7. I tried to find all PIDs:

ps -ef | grep 'mysql'

and then kill them with kill -9 ...

but mysql recreates after some time.

Also I tried to kill it like this:

killall -KILL mysql mysqld_safe mysqld

The same effect. After several seconds mysql rejoins.

Why it happens?

EDITED:

# ps aux | grep mysql
root     15284  0.0  0.3 115384  1804 ?        Ss   12:10   0:00 /bin/sh /usr/bin/mysqld_safe --basedir=/usr  --wsrep-new-cluster 
mysql    15743  0.1 40.3 1353412 202276 ?      Sl   12:10   0:03 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --wsrep-provider=/usr/lib64/galera3/libgalera_smm.so --wsrep-new-cluster --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock --wsrep_start_position=43de3d74-bca8-11e6-a178-57b39b925285:9                                                                                                                         
root     16303  0.0  0.1 112648   976 pts/0    R+   12:56   0:00 grep --color=auto mysql

I am using a mysql fork (Percona Xtradb Cluster) and it can't be stopped if the node is partitioned from the cluster. It can be stopped only if I disable a mysql service and reboot a node. But it is much better for me to kill the process without node rebooting. So

systemctl stop mysql

Doesn't work. It tries to stop it but without success.

I have installed it from Percona repository via yum:

yum install Percona-XtraDB-Cluster-57

Situation is the next:
There was 3 nodes and they crashed. After some time only 2 nodes could start. But they are waiting for the 3rd node. They have state: activating. If I try to stop mysql service then it change its state to: deactivating. But it can't be stopped. So, I try to kill mysql service and provision a new cluster from 2 nodes. But I can't stop mysql without reboot (reboot isn't a solution for me).

  • can you post the output of ps aux | grep mysql ? – Wissam Roujoulah Dec 8 '16 at 10:24
  • I have edited a question. Added output – Alexandr Dec 8 '16 at 10:57
  • You may have a service running that is restarting mariadb. For example on webservers with cPanel installed, there is a chksrvd process that monitors other services and restarts them. A bit more background information on your server and its function would be helpful for us – rcjohnson Dec 8 '16 at 10:58
  • I have edited my question. I am using Percona Xtradb Cluster without cPanel. I have installed only Percona Xtradb Cluster with this command: sudo yum install Percona-XtraDB-Cluster-57 – Alexandr Dec 8 '16 at 11:06
0

Can you check "/etc/inittab" entry for MySQL if it is starting with respawn . If it is , then you can comment out the line in "/etc/inittab" Try killing mysql with
kill -HUP PID of MYSQL

  • I haven't anything except comments in "/etc/inittab". 'kill -HUP PID' also doesn't work (the same result then I try to stop mysql).. – Alexandr Dec 11 '16 at 12:59
0

I have found why it reboots.

In the service file /usr/lib/systemd/system/mysql.service there was enabled restart:

Restart=always

I commented it:

#Restart=always

After machine reboot I can kill a mysql process as follows:

killall -KILL mysql mysqld_safe mysqld

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.