0

I'm trying to run a MariaDB container on a raspberry pi. The container is created through docker-compose and to persist the data I want to use my NAS. To mount a directory from the NAS to the container I want to use NFS.

The container is able to spin up, but MariaDB does not start correctly, stating that it is not able to lock the aria control file. When I spin up the container without the NFS mount (so with the storage defined inside the container) it works without an issue.

logging from the mariadb container:

2022-03-26 16:46:57+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.7.1+maria~focal started.
2022-03-26 16:46:58+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-03-26 16:46:58+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.7.1+maria~focal started.
2022-03-26 16:46:59+00:00 [Note] [Entrypoint]: Initializing database files
2022-03-26 16:50:40 0 [ERROR] mariadbd: Got error 'Could not get an exclusive lock; file is probably in use by another process' when trying to use aria control file '/var/lib/mysql/aria_log_control'
2022-03-26 16:47:05 0 [ERROR] mariadbd: Can't lock aria control file '/var/lib/mysql/aria_log_control' for exclusive use, error: 37. Will retry for 30 seconds
2022-03-26 16:50:40 0 [ERROR] Plugin 'Aria' init function returned error.
2022-03-26 16:50:40 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2022-03-26 16:50:40 0 [ERROR] InnoDB: The data file './ibdata1' must be writable
2022-03-26 16:50:40 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2022-03-26 16:50:40 0 [ERROR] Plugin 'InnoDB' init function returned error.
2022-03-26 16:50:40 0 [ERROR] Failed to initialize plugins.
2022-03-26 16:50:40 0 [ERROR] Aborting

This is my docker compose file:

version: "3.8"

services:
  mariadb:
    image: arm64v8/mariadb:10.7
    container_name: mariadbtemp
    restart: unless-stopped    
    security_opt:
      - seccomp:unconfined
      - apparmor:unconfined
    command: mysqld --skip-grant-tables --innodb-buffer-pool-size=128M  --transaction-isolation=READ-COMMITTED  --character-set-server=utf8mb4  --collation-server=utf8mb4_unicode_ci   --max-connections=512   --innodb-rollback-on-timeout=OFF    --innodb-lock-wait-timeout=120     
    volumes: # Don't remove permanent storage for index database files!
     - mariadbtemp:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: <password>
      MYSQL_DATABASE: photoprism
      MYSQL_USER: photoprism
      MYSQL_PASSWORD: <password>

volumes:
  mariadbtemp:
    driver_opts:
      type: nfs
      o: addr=<ip-adress>,rw,noatime,rsize=8192,wsize=8192,tcp,timeo=14
      device: :/DataVolume/databases

output of cat /etc/exports from the NAS:

/nfs    *(rw,sync,no_subtree_check,all_squash,insecure,anonuid=500,anongid=1000)

/DataVolume/databases           <ip-adress of dockerhost>(rw,sync,no_subtree_check,insecure)

output of ls -aln /DataVolume/databases on the NAS:

total 320
drwxr-xr-x 2 999 999 65536 Mar 26 16:20 .
drwxr-xr-x 8   0   0 65536 Feb  7 14:21 ..
-rw-rw---- 1 999 999 16384 Mar 10 19:32 aria_log.00000001
-rw-rw---- 1 999 999    52 Mar 10 19:32 aria_log_control
-rw-rw---- 1 999 999     9 Mar 26 16:20 ddl_recovery.log
---------- 1 999 999     0 Mar 10 19:20 ibdata1

I have tried to mount the NFS share directly to the container, defining the NFS-share as external and configuring it through docker and also to mount the NFSshare to the docker host and trying it that. None have worked. Does anyone have a suggestion as to how to continue?

1 Answer 1

1

The error looks like a permission issue. Are you sure the mariadb mysqld process is running with the same UID / same user? Can you test to write to that volume as this user?

NFS is not the best choice for innodb to persist data on for a lot of reasons: https://dev.mysql.com/doc/refman/5.6/en/disk-issues.html#disk-issues-nfs

My expirience is, the closer to the faster storage hardware, the better mariadb is performing. Depending on your use case, you might get better results running the database on a different piece than the services that access it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .