I've an Amazon t2.small EC2 - 1 Core and 2GB RAM it's more than the minimum requirements for CentOS and Virtualmin
My System:
- CentOS 7.5.1804
- Virtualmin
- MySQL 5.5.60-MariaDB
- Apache 2.4.6
The MySQL service was always stop working a month ago after a lot of visits and I can restart it from Webmin again until I read an article in DigitalOcean blog to add the [Restart=Always] in the file [/etc/systemd/system/multi-user.target.wants/mariadb.service] and I test it by killing the process then the service starts again automatically No stop for 22 days
Now the service stopped working again, I opened the [mariadb.service] file I found the line [Restart=Always] still there but the service stopped randomly.
Note: I still can start it from the Webmin no problem with that, But all websites become unavailable because of DB connection.
I need to trace this issue but I've no experience for such issues .. How to solve that?
MySQL configuration: my.conf
symbolic-links=0
innodb_file_per_table = 1
myisam_sort_buffer_size = 8M
read_rnd_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
sort_buffer_size = 512K
table_open_cache = 64
max_allowed_packet = 1M
key_buffer_size = 16M
Some lines from {var/log/messages}
Oct 22 16:49:49 ns1 kernel: Out of memory: Kill process 13092 (mysqld) score 97 or sacrifice child
Oct 22 16:49:49 ns1 kernel: Killed process 13092 (mysqld) total-vm:1065992kB, anon-rss:182972kB, file-rss:0kB, shmem-rss:0kB
Oct 22 16:49:49 ns1 kernel: [12822] 27 12822 28326 73 14 0 0 mysqld_safe
Oct 23 08:58:11 ns1 kernel: [12822] 27 12822 28326 74 14 0 0 mysqld_safe
Oct 23 08:58:11 ns1 kernel: [19703] 27 19703 266425 39874 150 0 0 mysqld
Oct 23 20:04:47 ns1 saslauthd[531]: do_auth : auth failure: [user=mysql] [service=smtp] [realm=] [mech=pam] [reason=PAM auth error]
Oct 23 22:21:25 ns1 kernel: [12822] 27 12822 28326 74 14 0 0 mysqld_safe
Oct 23 22:21:25 ns1 kernel: [19703] 27 19703 266425 48494 161 0 0 mysqld
Oct 23 22:21:25 ns1 kernel: Out of memory: Kill process 19703 (mysqld) score 103 or sacrifice child
Oct 23 22:21:25 ns1 kernel: Killed process 19703 (mysqld) total-vm:1065700kB, anon-rss:193976kB, file-rss:0kB, shmem-rss:0kB
Oct 23 22:21:25 ns1 kernel: [12822] 27 12822 28326 74 14 0 0 mysqld_safe
Oct 23 22:39:58 ns1 kernel: [12822] 27 12822 28326 76 14 0 0 mysqld_safe
Oct 23 22:39:58 ns1 kernel: [19246] 27 19246 266716 16891 98 0 0 mysqld
Oct 23 22:40:02 ns1 kernel: [12822] 27 12822 28326 76 14 0 0 mysqld_safe
Oct 23 22:40:02 ns1 kernel: [19246] 27 19246 266938 17064 98 0 0 mysqld
Oct 23 22:40:05 ns1 kernel: mysqld invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0
Oct 23 22:40:05 ns1 kernel: mysqld cpuset=/ mems_allowed=0
Oct 23 22:40:05 ns1 kernel: CPU: 0 PID: 19357 Comm: mysqld Kdump: loaded Not tainted 3.10.0-862.11.6.el7.x86_64 #1