2

I am using mariadb and wordpress container. But this error keeps on happening. How can I ensure that this crash does not happen anymore ? Am I being attacked ? Or is it a problem that occurs to other people ? How can I attach to mariadb and have access to the shell and try to find out what goes on inside mariadb container?

See below the messages logged after every crash... There seems to be a high number of page hits as well. page visits go up to 20.000 to 60.000 hits on pages. These seem to be the work of crawlers, bots. Not sure if these are malicious attacks.

Any help on how to go about dealing with this problem?

I have mariadb, wordpress and phpmyadmin working in three docker containers under ubuntu 14 on digital ocean. Here are the crash messages:

[1668002.926214] Out of memory: Kill process 16765 (mysqld) score 176 or sacrifice child [1668002.935614] killed process 16765 (mysqld) total-vm:1012836kb, anon-rss:178840kb, file-rss:0kb [1668040.992415] killed process 22570 (php5-fpm) total-vm:418044kB, anon-rss:145392kB, file-rss: 20624kB

New York Server: [1225007.977126] Out of memory: Kill process 3161 (mysqld) score 245 or sacrifice child [ 1225007.985657] killed process 3161 (mysqld) total-vm: 977148kb, anon-rss:122488kb, file-rss:0kB)

Frankfurt server [1632264.057873] Out of memory: Kill process 22421 (mysqld) score 246 or sacrifice child [1632264.067530] Killed process 22421 (mysqld) total-vm: 1005228kb, anon-rss:249328kb, file-rss:0kb

user3669547
  • 231
  • 4
  • 8

1 Answers1

4

The official MySQL images on Docker Hub use a configuration that's recommended by MySQL. Basically, the default configuration is tuned for performance, and is intended for running MySQL on a dedicated server, with lots of memory (multiple gigabytes).

Tune MySQL settings based on your requirements and available resources

When running MySQL in a container on a small DigitalOcean droplet (512MB, 1GB), you will have to modify the default settings to fit your situation. For example; limit the maximum amount of simultaneous connections, less query cache, etc.

Also note that, by default, DigitalOcean droplets don't have swap configured, which means that if they run out of memory, they cannot use the SSD to swap. It's important to configure Swap on those droplets so that MySQL doesn't crash if it's temporarily needing more memory (e.g. when re-idexing the database).

This article describes how to configure a Swap partition on Ubuntu 14.04 on DigitalOcean; How To Add Swap on Ubuntu 14.04

The following issues on the official MySQL Docker repository contain some hints for tuning MySQL settings for "performance" or "memory efficiency";

The MySQL readme on Docker Hub describes how to use a custom configuration file; "Using a custom MySQL configuration file"

Community
  • 1
  • 1
thaJeztah
  • 27,738
  • 9
  • 73
  • 92
  • Turn off the QC. Lower the key_buffer and innodb_buffer_pool_size. – Rick James Jan 18 '16 at 06:58
  • Thanks a lot thaJeztah... Your guidance has been very useful. I have created a swap file of 10 G and the site is back online, but I do not know for how long. – user3669547 Jan 18 '16 at 11:55
  • I am now going to see how to tune MYSQL settings for performance or memory effieciency. I have never done any thing similar so I am not sure how it will go. Is it possible to also do this using phpmyadmin... I have it running with the database in a separate docker container. – user3669547 Jan 18 '16 at 11:58
  • No, phpmyadmin does not let you change the configuration. However, I would start with [configuring Swap](https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04) first, because that will directly prevent the server getting out of memory. After that, you can create a custom configuration; you can try that config on your local docker installation first, and then deploy it – thaJeztah Jan 18 '16 at 15:52