通过NFS在Docker Swarm中使用MariaDB时出现问题

iyfjxgzm  于 2022-11-08  发布在  Docker
关注(0)|答案(1)|浏览(160)

我在使用nfs共享的Docker Swarm中使用MariaDB时遇到问题。数据库在fdatasync后突然停止接受新连接()失败。这种情况是随机发生的。几小时后或几天后。如果我删除服务并重新启动它,一切都运行正常。服务似乎无法自我修复。但我认为这种错误甚至不应该发生,即使服务应该自我修复。我将数据库作为Nextcloud应用程序的持久层运行。
这是我的docker-compose文件:

version: '3.3'
services:
  nextcloud_db:
    image: mariadb:10.7.4
    #container_name: nextcloud-db
    command:
      - "--transaction-isolation=READ-COMMITTED"
      - "--log-bin=ROW"
      - "--innodb_read_only_compressed=OFF"
      - "--character-set-server=utf8mb4"
      - "--collation-server=utf8mb4_unicode_ci"
      #- "--innodb-rollback-on-timeout=ON" # Tested this but did not help
    deploy:
      replicas: 1
      update_config:
        parallelism: 1
        delay: 10s
      restart_policy:
        condition: on-failure
      labels:
        - traefik.enable=false
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
      - db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=myrootpassword
      - MYSQL_PASSWORD=mymysqlpassword
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_INITDB_SKIP_TZINFO=1
    networks:
      - nextcloud

### other services for running nextcloud ###

volumes:
  db:
    driver_opts:
      type: "nfs"
      o: "addr=<storage-server-ip>,nolock,soft,rw"
      device: ":/mnt/storage/nextcloud/db"

networks:
  traefik-public:
    external: true
  nextcloud:
    driver: overlay
    # driver_opts:
    #   encrypted: "true"

以下是数据库停止运行后的日志:

nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | 2022-06-29 19:51:17 4671 [ERROR] [FATAL] InnoDB: fdatasync() returned 5
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | 220629 19:51:17 [ERROR] mysqld got signal 6 ;
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | This could be because you hit a bug. It is also possible that this binary
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | or one of the libraries it was linked against is corrupt, improperly built,
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | or misconfigured. This error can also be caused by malfunctioning hardware.
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    |
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | To report this bug, see https://mariadb.com/kb/en/reporting-bugs
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    |
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | We will try our best to scrape up some info that will hopefully help
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | diagnose the problem, but since we have already crashed,
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | something is definitely wrong and this may fail.
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    |
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | Server version: 10.7.4-MariaDB-1:10.7.4+maria~focal-log
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | key_buffer_size=134217728
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | read_buffer_size=131072
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | max_used_connections=10
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | max_threads=153
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | thread_count=11
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | It is possible that mysqld could use up to
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467995 K  bytes of memory
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | Hope that's ok; if not, decrease some variables in the equation.
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    |
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | Thread pointer: 0x55d81db99108
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | Attempting backtrace. You can use the following information to find out
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | where mysqld died. If you see no messages after this, something went
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | terribly wrong...
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | stack_bottom = 0x7fcf10137d98 thread_stack 0x49000
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | mariadbd(my_print_stacktrace+0x32)[0x55d81b24de52]
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | mariadbd(handle_fatal_signal+0x485)[0x55d81ad282b5]
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | 2022-06-29 21:49:49 4673 [Warning] Aborted connection 4673 to db: 'nextcloud' user: 'nextcloud' host: '10.0.7.189' (Got an error reading communication packets)
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | 2022-06-29 21:49:49 4672 [Warning] Aborted connection 4672 to db: 'nextcloud' user: 'nextcloud' host: '10.0.7.189' (Got an error reading communication packets)
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | 2022-06-29 21:49:49 4674 [Warning] Aborted connection 4674 to db: 'nextcloud' user: 'nextcloud' host: '10.0.7.189' (Got an error reading communication packets)
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | 2022-06-29 22:16:02 4676 [Warning] Aborted connection 4676 to db: 'nextcloud' user: 'nextcloud' host: '10.0.7.189' (Got an error reading communication packets)
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | 2022-06-29 22:18:13 4678 [Warning] Aborted connection 4678 to db: 'nextcloud' user: 'nextcloud' host: '10.0.7.189' (Got an error reading communication packets)
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | 2022-06-29 22:24:46 4679 [Warning] Aborted connection 4679 to db: 'nextcloud' user: 'nextcloud' host: '10.0.7.189' (Got an error reading communication packets)
nc_nextcloud_db.1.1mfx9xkwd1sd@v220210169548138574    | 2022-07-01 21:49:02 7148 [Warning] Aborted connection 7148 to db: 'nextcloud' user: 'nextcloud' host: '10.0.7.189' (Got an error reading communication packets)

我没有发现其他与此有关的日志。
有人知道这里发生了什么吗?
也许NFS共享在几秒钟内不可用,因此数据库出现读/写问题?在此错误发生后,mariadb服务是否可以自我修复?只要数据库服务在运行,就没有其他问题。我可以上传和删除文件等。因此,这不是nfs共享上的权限问题。
更多MariaDB指标:https://jpst.it/2TX-F
主机系统信息:

Docker node VM with Ubuntu:
Ubuntu 20.04.4 LTS
2 vCPUs
8 GB RAM
160 GB SSD System-Storage (Raid 10)

相关问题