MariaDB容器未启动-Github上的任务

ca1c2owp  于 2023-10-20  发布在  Git
关注(0)|答案(1)|浏览(104)

我正在尝试为GitHub上的工作流创建MariaDB容器。工作流文件为:

name: Rails 7.0 Test with MariaDB

on:
  workflow_dispatch:
  push:
    branches:
      - main
  pull_request:
    branches:
      - '*'

jobs:
  build:
    runs-on: ubuntu-20.04

    services:
      mariadb:
        image: mariadb:latest
        ports:
          - 3306:3306
        env:
          MYSQL_ROOT_PASSWORD: root_password
          MYSQL_DATABASE: test_db
          MYSQL_USER: test_user
          MYSQL_PASSWORD: test_password
        options: --health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=5s --health-retries=3

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v2

      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.1

      - name: Install Dependencies
        run: |
          gem install bundler
          bundle install

      - name: Set up Database
        run: |
          cp config/database.yml.ci config/database.yml
          sed -i "s/username: root/username: test_user/g" config/database.yml
          sed -i "s/password:$/password: test_password/g" config/database.yml

      - name: Prepare Database
        run: |
          bundle exec rails db:create
          bundle exec rails db:migrate

      - name: Run Tests
        run: |
          bundle exec rspec

当容器启动时,它会收到以下警告,但它们只是警告,没有错误:

Warning: 14 19:05:57 0 [Warning] 'user' entry 'root@34b47ecf4f5d' ignored in --skip-name-resolve mode.
Warning: 14 19:05:57 0 [Warning] 'proxies_priv' entry '@% root@34b47ecf4f5d' ignored in --skip-name-resolve mode.

任务的日志文件显示:

Service container mariadb failed.
  /usr/bin/docker logs --details 34b47ecf4f5d8d2907f3a9dd7b35ad4b1be86e4b986a8fdf3950bbb1b8e94c69
   2023-08-14 19:05:56+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:11.0.2+maria~ubu2204 started.
   2023-08-14 19:05:56+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
   2023-08-14 19:05:56+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:11.0.2+maria~ubu2204 started.
   2023-08-14 19:05:56+00:00 [Note] [Entrypoint]: Initializing database files
   
   
   PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
   To do so, start the server, then issue the following command:
   
   '/usr/bin/mariadb-secure-installation'
   
   which will also give you the option of removing the test
   databases and anonymous user created by default.  This is
   strongly recommended for production servers.
   
   See the MariaDB Knowledgebase at https://mariadb.com/kb
   
   Please report any problems at https://mariadb.org/jira
   
   The latest information about MariaDB is available at https://mariadb.org/.
   
   Consider joining MariaDB's strong and vibrant community:
   https://mariadb.org/get-involved/
   
   2023-08-14 19:05:57+00:00 [Note] [Entrypoint]: Database files initialized
   2023-08-14 19:05:57+00:00 [Note] [Entrypoint]: Starting temporary server
   2023-08-14 19:05:57+00:00 [Note] [Entrypoint]: Waiting for server startup
   2023-08-14 19:05:57 0 [Note] Starting MariaDB 11.0.2-MariaDB-1:11.0.2+maria~ubu2204 source revision 0005f2f06c8e1aea4915887decad67885108a929 as process 95
   2023-08-14 19:05:57 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
   2023-08-14 19:05:57 0 [Note] InnoDB: Using transactional memory
   2023-08-14 19:05:57 0 [Note] InnoDB: Number of transaction pools: 1
   2023-08-14 19:05:57 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
   2023-08-14 19:05:57 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
   2023-08-14 19:05:57 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
   2023-08-14 19:05:57 0 [Note] InnoDB: Completed initialization of buffer pool
   2023-08-14 19:05:57 0 [Note] InnoDB: File system buffers for log disabled (block size=4096 bytes)
   2023-08-14 19:05:57 0 [Note] InnoDB: Opened 3 undo tablespaces
   2023-08-14 19:05:57 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active.
   2023-08-14 19:05:57 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
   2023-08-14 19:05:57 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
   2023-08-14 19:05:57 0 [Note] InnoDB: log sequence number 46151; transaction id 14
   2023-08-14 19:05:57 0 [Note] Plugin 'FEEDBACK' is disabled.
   2023-08-14 19:05:57 0 [Note] Plugin 'wsrep-provider' is disabled.
  Warning: 14 19:05:57 0 [Warning] 'user' entry 'root@34b47ecf4f5d' ignored in --skip-name-resolve mode.
  Warning: 14 19:05:57 0 [Warning] 'proxies_priv' entry '@% root@34b47ecf4f5d' ignored in --skip-name-resolve mode.
   2023-08-14 19:05:57 0 [Note] mariadbd: ready for connections.
   Version: '11.0.2-MariaDB-1:11.0.2+maria~ubu2204'  socket: '/run/mysqld/mysqld.sock'  port: 0  mariadb.org binary distribution
   2023-08-14 19:05:58+00:00 [Note] [Entrypoint]: Temporary server started.
   2023-08-14 19:05:59+00:00 [Note] [Entrypoint]: Creating database test_db
   2023-08-14 19:05:59+00:00 [Note] [Entrypoint]: Creating user test_user
   2023-08-14 19:05:59+00:00 [Note] [Entrypoint]: Giving user test_user access to schema test_db
   2023-08-14 19:05:59+00:00 [Note] [Entrypoint]: Securing system users (equivalent to running mysql_secure_installation)
   
   2023-08-14 19:05:59+00:00 [Note] [Entrypoint]: Stopping temporary server
   2023-08-14 19:05:59 0 [Note] mariadbd (initiated by: unknown): Normal shutdown
   2023-08-14 19:05:59 0 [Note] InnoDB: FTS optimize thread exiting.
   2023-08-14 19:05:59 0 [Note] InnoDB: Starting shutdown...
   2023-08-14 19:05:59+00:00 [Note] [Entrypoint]: Temporary server stopped
   2023-08-14 19:05:59 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
   2023-08-14 19:05:59 0 [Note] InnoDB: Buffer pool(s) dump completed at 230814 19:05:59
   2023-08-14 19:05:59 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"
   2023-08-14 19:05:59 0 [Note] InnoDB: Shutdown completed; log sequence number 47401; transaction id 15
   2023-08-14 19:05:59 0 [Note] mariadbd: Shutdown complete
   
   
   2023-08-14 19:05:59+00:00 [Note] [Entrypoint]: MariaDB init process done. Ready for start up.
   
   2023-08-14 19:05:59 0 [Note] Starting MariaDB 11.0.2-MariaDB-1:11.0.2+maria~ubu2204 source revision 0005f2f06c8e1aea4915887decad67885108a929 as process 1
   2023-08-14 19:05:59 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
   2023-08-14 19:05:59 0 [Note] InnoDB: Using transactional memory
   2023-08-14 19:05:59 0 [Note] InnoDB: Number of transaction pools: 1
   2023-08-14 19:05:59 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
   2023-08-14 19:05:59 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
   2023-08-14 19:05:59 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
   2023-08-14 19:05:59 0 [Note] InnoDB: Completed initialization of buffer pool
   2023-08-14 19:05:59 0 [Note] InnoDB: File system buffers for log disabled (block size=4096 bytes)
   2023-08-14 19:05:59 0 [Note] InnoDB: Opened 3 undo tablespaces
   2023-08-14 19:05:59 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active.
   2023-08-14 19:05:59 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
   2023-08-14 19:05:59 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
   2023-08-14 19:05:59 0 [Note] InnoDB: log sequence number 47401; transaction id 14
   2023-08-14 19:05:59 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
   2023-08-14 19:05:59 0 [Note] Plugin 'FEEDBACK' is disabled.
   2023-08-14 19:05:59 0 [Note] Plugin 'wsrep-provider' is disabled.
   2023-08-14 19:05:59 0 [Note] InnoDB: Buffer pool(s) load completed at 230814 19:05:59
   2023-08-14 19:05:59 0 [Note] Server socket created on IP: '0.0.0.0'.
   2023-08-14 19:05:59 0 [Note] Server socket created on IP: '::'.
   2023-08-14 19:05:59 0 [Note] mariadbd: ready for connections.
   Version: '11.0.2-MariaDB-1:11.0.2+maria~ubu2204'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
  Error: Failed to initialize container mariadb:latest
Error: One or more containers failed to start.

有人知道为什么这个容器启动不了吗?警告是否被视为失败?

h6my8fg2

h6my8fg21#

通过the blogmysqladmin ping是错误的健康检查(过早返回true),并且mysqladmin和所有mysql*命名的可执行文件已从11.0+容器中删除。
替换为:

options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3

也可以使用MariaDB名称:

env:
          MARIADB_ROOT_PASSWORD: root_password
          MARIADB_DATABASE: test_db
          MARIADB_USER: test_user
          MARIADB_PASSWORD: test_password

是的,我仍然需要清理容器映像中的这两个警告。
感谢您使用MariaDB进行测试!

相关问题