Comments (6)
It looks like I'm working with temporary base
No, persistent storage(volume) is used for DB in your case:
zabbix-db-storage:
image: busybox:latest
volumes:
- /var/lib/mysql
...
volumes_from:
- zabbix-db-storage
DB is populated automatically during first start (zabbix/zabbix-db-mariadb is empty mysql server):
zabbix-server_1 | [LOG 16:09:58] Checking if database exists or SQL import is required
zabbix-server_1 | [WARNING 16:09:58] Zabbix database doesn't exist. Installing and importing default settings
zabbix-server_1 |
zabbix-server_1 | [LOG 16:09:58] Database and user created, importing default SQL
zabbix-server_1 |
zabbix-server_1 | [LOG 16:10:19] Import finished, starting
Next run Zabbix DB is detected, so DB import won't be executed,
zabbix-server_1 | [LOG 16:49:20] Checking if database exists or SQL import is required
zabbix-server_1 | [LOG 16:49:20] Zabbix database exists, starting server
Test it, but it should be OK.
from dockbix-xxl.
yes, config contains a section that specifies to use a persistent storage
zabbix-db-storage:
image: busybox:latest
volumes:
- /var/lib/mysql
...
volumes_from:
- zabbix-db-storage
but after stop and start container changes are not saved.
$ docker inspect zabbix30_zabbix-db_1
[
{
"Id": "380f1e435635a94a006a7cbce3f097580c36d730949dbd68ea39507670dce705",
"Created": "2016-02-02T20:21:32.309697083Z",
"Path": "/run.sh",
"Args": [],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 25422,
"ExitCode": 0,
"Error": "",
"StartedAt": "2016-02-02T20:21:32.750592691Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "a9002ccad7ef2ff66db334a61f8d274accc8189d1815ac5cbb9d19e7d26ef10d",
"ResolvConfPath": "/mnt/sdb/var/lib/docker/containers/380f1e435635a94a006a7cbce3f097580c36d730949dbd68ea39507670dce705/resolv.conf",
"HostnamePath": "/mnt/sdb/var/lib/docker/containers/380f1e435635a94a006a7cbce3f097580c36d730949dbd68ea39507670dce705/hostname",
"HostsPath": "/mnt/sdb/var/lib/docker/containers/380f1e435635a94a006a7cbce3f097580c36d730949dbd68ea39507670dce705/hosts",
"LogPath": "/mnt/sdb/var/lib/docker/containers/380f1e435635a94a006a7cbce3f097580c36d730949dbd68ea39507670dce705/380f1e435635a94a006a7cbce3f097580c36d730949dbd68ea39507670dce705-json.log",
"Name": "/zabbix30_zabbix-db_1",
"RestartCount": 0,
"Driver": "aufs",
"ExecDriver": "native-0.2",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": [
"b5460cd0b9a60a4d5c21c8145ec9675050e8164c7043954b5dbaa51ce8a20019"
],
"HostConfig": {
"Binds": [
"/backups:/backups:rw"
],
"ContainerIDFile": "",
"LxcConf": null,
"Memory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"KernelMemory": 0,
"CpuShares": 0,
"CpuPeriod": 0,
"CpusetCpus": "",
"CpusetMems": "",
"CpuQuota": 0,
"BlkioWeight": 0,
"OomKillDisable": false,
"MemorySwappiness": null,
"Privileged": false,
"PortBindings": {},
"Links": null,
"PublishAllPorts": false,
"Dns": null,
"DnsOptions": null,
"DnsSearch": null,
"ExtraHosts": null,
"VolumesFrom": [
"d6e3c4c2943f961eeff93951e976577def1ff1c116b1850f8fad835e86d72b42:rw"
],
"Devices": null,
"NetworkMode": "default",
"IpcMode": "",
"PidMode": "",
"UTSMode": "",
"CapAdd": null,
"CapDrop": null,
"GroupAdd": null,
"RestartPolicy": {
"Name": "",
"MaximumRetryCount": 0
},
"SecurityOpt": null,
"ReadonlyRootfs": false,
"Ulimits": null,
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"CgroupParent": "",
"ConsoleSize": [
0,
0
],
"VolumeDriver": ""
},
"GraphDriver": {
"Name": "aufs",
"Data": null
},
"Mounts": [
{
"Name": "6e72af9cab24e42db9eb790d2c18ac2aa05f87d53332874f6dd3cebec480cf1a",
"Source": "/mnt/sdb/var/lib/docker/volumes/6e72af9cab24e42db9eb790d2c18ac2aa05f87d53332874f6dd3cebec480cf1a/_data",
"Destination": "/var/lib/mysql",
"Driver": "local",
"Mode": "",
"RW": true
},
{
"Source": "/backups",
"Destination": "/backups",
"Mode": "rw",
"RW": true
}
],
"Config": {
"Hostname": "380f1e435635",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"3306/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"MARIADB_PASS=my_password",
"MARIADB_USER=zabbix",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"DB_max_allowed_packet=64M",
"DB_query_cache_size=0",
"DB_query_cache_type=0",
"DB_sync_binlog=0",
"DB_innodb_buffer_pool_size=768M",
"DB_innodb_log_file_size=128M",
"DB_innodb_flush_method=O_DIRECT",
"DB_innodb_old_blocks_time=1000",
"DB_innodb_flush_log_at_trx_commit=0",
"DB_open_files_limit=4096",
"DB_max_connections=300",
"TERM=xterm"
],
"Cmd": [
"/run.sh"
],
"Image": "zabbix/zabbix-db-mariadb",
"Volumes": {
"/backups": {},
"/var/lib/mysql": {}
},
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"build-date": "2015-12-23",
"com.docker.compose.config-hash": "ec83508f0f6b96e66c9adabe802b133cddefa3d9a192332effdc939b3d7d4a32",
"com.docker.compose.container-number": "1",
"com.docker.compose.oneoff": "False",
"com.docker.compose.project": "zabbix30",
"com.docker.compose.service": "zabbix-db",
"com.docker.compose.version": "1.6.0rc2",
"license": "GPLv2",
"name": "CentOS Base Image",
"vendor": "CentOS"
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "3502f1ee986152a62640175e8d69e3bb8eb74ab657a048a8e358e1703fb47b52",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"3306/tcp": null
},
"SandboxKey": "/var/run/docker/netns/3502f1ee9861",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "60ba1308592b9e9a401376d1377f30fd3dcf2866281c20097c8fe79cfd6246e3",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.3",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:03",
"Networks": {
"bridge": {
"EndpointID": "60ba1308592b9e9a401376d1377f30fd3dcf2866281c20097c8fe79cfd6246e3",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.3",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:03"
}
}
}
}
]
from dockbix-xxl.
I don't understand. What did you change and what is expected result?
from dockbix-xxl.
I'm sorry that I did not accurately describe the problem.
I pull zabbix images and did not modify any configs
i want to zabbix database stored on the host. Persistent storage (volume) is used for DB in docker-compose.yml:
zabbix-db-storage:
image: busybox:latest
volumes:
- /var/lib/mysql
...
volumes_from:
- zabbix-db-storage
I ran zabbix-server container, go to URL http://zabbix and configure it (create host TEST) in zabbix admin panel.
I expect to files in /var/lib/mysql on host changed, but these files not change. Then i stopped the containers, removed them and start. I go to Zabbix admin panel, but there are not old settings (host TEST).
If I understand correctly my data must store in /var/lib/mysql on host. But data stored only in container
from dockbix-xxl.
Then i stopped the containers, removed them and start.
Don't remove zabbix30_zabbix-db-storage_1 container and you will be fine.
If I understand correctly my data must store in /var/lib/mysql on host. But data stored only in container
Yes, you can store them in /var/lib/mysql on your host - but you need to configure it your docker-compose.yml file. Also now are stored data on your host, my example:
docker inspect zabbix30_zabbix-db-storage_1
...
"Mounts": [
{
"Name": "3b48d36682826bcf00c4c29ca427848dc589e377b13114f6ba3b80504ff7aeae",
"Source": "/mnt/sda1/var/lib/docker/volumes/3b48d36682826bcf00c4c29ca427848dc589e377b13114f6ba3b80504ff7aeae/_data",
"Destination": "/var/lib/mysql",
"Driver": "local",
"Mode": "",
"RW": true
}
],
...
root@default:~# ls -lah /mnt/sda1/var/lib/docker/volumes/3b48d36682826bcf00c4c29ca427848dc589e377b13114f6ba3b80504ff7aeae/_data
total 340024
drwxr-xr-x 5 997 root 4.0K Feb 2 16:57 .
drwxr-xr-x 3 root root 4.0K Feb 2 16:45 ..
-rw-rw---- 1 997 995 16.0K Feb 2 16:57 aria_log.00000001
-rw-rw---- 1 997 995 52 Feb 2 16:57 aria_log_control
-rw-r--r-- 1 997 root 3.7K Feb 2 16:57 error.log
-rw-r--r-- 1 997 root 2.0K Feb 2 16:47 error.log.old
-rw-rw---- 1 997 995 128.0M Feb 2 16:57 ib_logfile0
-rw-rw---- 1 997 995 128.0M Feb 2 16:47 ib_logfile1
-rw-rw---- 1 997 995 76.0M Feb 2 16:57 ibdata1
-rw-rw---- 1 997 995 0 Feb 2 16:47 multi-master.info
drwx------ 2 997 root 4.0K Feb 2 16:47 mysql
drwx------ 2 997 995 4.0K Feb 2 16:47 performance_schema
drwx------ 2 997 995 12.0K Feb 2 16:48 zabbix
It's advance concept (volumes-from
) of storing data in Docker world. It's not simple concept (volume
), so don't be confused.
I recommend you to dig into documentation and guides how to use volumes in the Docker. Then you can implement concept, which will fit for your case and needs.
from dockbix-xxl.
I figure out. I thought that the mysql data will be stored in /var/lib/mysql.
Thank you!
from dockbix-xxl.
Related Issues (20)
- Error message on top of the Dashboard HOT 3
- TLS PSK connection problems after update to 3.4.4 HOT 1
- SERVER_PORT undefined? HOT 6
- Requesting capability to bootstrap with pre-existing but empty db HOT 1
- Remove Google Analytics "integration" HOT 1
- Traps not working (snmptrapd + SNMPTT) HOT 1
- Dockbix-db-storage won´t start - STATUS: Exited (0) HOT 3
- XXL grapher extension not working since Zabbix 3.4.5 HOT 2
- Zabbix icmp pinger processes more than 75% busy HOT 1
- jQuery is not defined HOT 17
- Zabbix database should be created with utf8_bin collation HOT 1
- VOLUME definitions prevent creating inherited images with alerts & external scripts HOT 5
- Old version of Nmap HOT 1
- Grapher XXL stopped working since Zabbix 4.0.0 HOT 1
- Questions about how to replace the font HOT 8
- Zabbix failing to start in Kubernetes HOT 4
- Lack of free swap space on Zabbix server HOT 1
- New Version HOT 1
- VMware Discovery? HOT 1
- Link broken in README
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dockbix-xxl.