Closed paulz1 closed 7 years ago
It looks like a memory problem. Be sure to have at least 2GB free RAM for DB container.
That was my first idea. But, the host server has 8GB de RAM.
$ free -m
total used free shared buffers cached
Mem: 8005 286 7719 8 10 160
-/+ buffers/cache: 115 7890
Swap: 4767 0 4767
So it's seems that there is a lot of free mem.
Could you provide docker info
please?
$ docker info
Containers: 17
Running: 1
Paused: 0
Stopped: 16
Images: 34
Server Version: 17.04.0-ce
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: xfs
Dirs: 79
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary:
containerd version: 422e31ce907fd9c3833a38d7b8fdd023e5a76e73
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228
init version: 949e6fa
Kernel Version: 3.16.0-4-amd64
Operating System: Debian GNU/Linux 8 (jessie)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.818GiB
Name: domain-zabbix
ID: 6HE2:BHH2:2BIR:V42H:VN2B:H6XD:UIDW:IIIL:DWZR:AC43:SZDZ:SBRB
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Http Proxy: http://domain-proxy:8080
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No memory limit support
WARNING: No swap limit support
WARNING: No kernel memory limit support
WARNING: No oom kill disable support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support
Just for information, it's not a problem with max_open_files
.
max_open_files is defined in /etc/my.cnf.d/tuning.cnf
I set it to 8192.
The Warning has gone, but the MariaDB still does not start with the same message.
Ah, sorry, forget to precise...
I change Name
and Http Proxy
but the both value are correct.
Sorry, to ask a lot question in once, but I try to investigate on my side as well.
Could it be the rights problem?
This is the list of files in /var/lib/mysql
(inside of container) :
# ls -alh
total 333M
drwxr-xr-x 5 mysql mysql 4.0K Apr 18 12:03 .
drwxr-xr-x 15 root root 38 Apr 13 21:25 ..
-rw-rw---- 1 997 995 16K Apr 3 16:08 aria_log.00000001
-rw-rw---- 1 997 995 52 Apr 3 16:08 aria_log_control
-rw-r--r-- 1 mysql root 3.1K Apr 18 12:03 error.log
-rw-r--r-- 1 mysql root 1.6K Apr 18 10:25 error.log.old
-rw-rw---- 1 997 995 128M Apr 17 02:38 ib_logfile0
-rw-rw---- 1 997 995 128M Apr 17 00:09 ib_logfile1
-rw-rw---- 1 997 995 76M Apr 17 02:38 ibdata1
-rw-rw---- 1 997 995 0 Jul 21 2016 multi-master.info
drwx------ 2 997 root 4.0K Jul 21 2016 mysql
srwxrwxrwx 1 997 995 0 Apr 3 16:09 mysql.sock
drwx------ 2 997 995 4.0K Jul 21 2016 performance_schema
drwx------ 2 997 995 12K Sep 20 2016 zabbix
But,
# grep mysql /etc/passwd
mysql:x:998:996:MySQL server:/var/lib/mysql:/sbin/nologin
Is it normal that uid and gid of files don't correspond to uid/gid of mysql user? And is it possible that docker pull could change uid/gid?
Another question... how to fix it?
I'm not able to replicate your issue on docker 17.04 with current latest images. Could you delete all containers and run these commands please:
docker run -d -v /var/lib/mysql --name zabbix-db-storage busybox:latest
docker run \
-d \
--name zabbix-db \
-v /backups:/backups \
-v /etc/localtime:/etc/localtime:ro \
--volumes-from zabbix-db-storage \
--env="MARIADB_USER=zabbix" \
--env="MARIADB_PASS=my_password" \
monitoringartist/zabbix-db-mariadb
docker logs -f zabbix-db
Hmmm... Do I understand correctly that if I delete my zabbix-db-storage container I will lost my zabbix database? At least between today and my last mysqldump (which is a little bit far from yesterday).
Do I understand correctly that if I delete my zabbix-db-storage container I will lost my zabbix database?
Yes, you will delete your zabbix DB data.
Ok. So...
a) at first, I connect to running container and chage the ownership of files in /var/lib/mysql
chown -R mysql:mysql /var/lib/mysql
it was sufficient to correct the problem.
Now MariaDB starts and so zabbix container works as well (an so I could make a mysqldump of zabbix database :-) ).
b) just for invetigate
This zabbix server is a VM, so clone it and the remove all containers and run the new ones with your commands.
It works without problem as well.
I do not print the logs
output because it just works well without problem.
So the summary: a) That was a problem with the rights/ownership of /var/lib/mysql b) setting the good ownership correct the problem; c) the only strange thing is why the uid/gid of mysql user has changed in zabbix-db container (or on the storage).
I think we could close the issue. We will see if this problem will appear again in the future.
And... Thank you very-very much for your help.
I did
docker pull monitoringartist/zabbix-db-mariadb
today... Then MariaDB could not start now. I'm not sure it's because of pulling of new image, as there was a problem with running container even before pull.This is an error.log from MariaDb container :
Does the message about "
Could not increase number of max_open_files to more than 4096 (request: 4407)
" is important. I thought that it could explain the problem, but it's just marked as Warning.And, if not... what could explain the problem with "./ibdata1"? This is a part of compose file :