programing

mysql 사용자가 볼륨에 액세스할 수 없는 것 같아 Azure에서 mariadb 컨테이너를 시작할 수 없습니다.

css3 2023. 8. 28. 21:17

mysql 사용자가 볼륨에 액세스할 수 없는 것 같아 Azure에서 mariadb 컨테이너를 시작할 수 없습니다.

저는 도커 컴포지트로 간단한 mariadb 컨테이너를 zure에 시작하려고 합니다.볼륨에 연결하지 않으면 작동하지만 볼륨을 사용하여 영구 스토리지를 사용하려고 할 때마다 컨테이너가 제대로 부팅되지 않습니다.도커 작성 설정 아래:

version: '3.8'

services:

  db:
    image: mariadb:10.5.8
    volumes:
      - data-volume:/var/lib/mysql
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=****
      - MYSQL_DATABASE=****
      - MYSQL_USER=****
      - MYSQL_PASSWORD=****
    ports:
      - 3306:3306

volumes:
  data-volume:
    driver: azure_file
    driver_opts:
      share_name: myshare
      storage_account_name: mystorage

항상 mariadblog에 이 오류가 발생하기 때문에 mysql 사용자에게 특정 작업에 대한 권한이 부족한 것 같습니다.비록 볼륨에 파일이 적혀 있지만요.

021-02-22 16:36:18+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.8+maria~focal started.
2021-02-22 16:36:21+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2021-02-22 16:36:22+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.8+maria~focal started.
2021-02-22 16:36:22+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 commands:

'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h  password 'new-password'

Alternatively you can run:
'/usr/bin/mysql_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 or the
MySQL manual for more instructions.

Please report any problems at https://mariadb.org/jira

The latest information about MariaDB is available at https://mariadb.org/.
You can find additional information about the MySQL part at:
https://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

2021-02-22 16:36:49+00:00 [Note] [Entrypoint]: Database files initialized
2021-02-22 16:36:49+00:00 [Note] [Entrypoint]: Starting temporary server
2021-02-22 16:36:49+00:00 [Note] [Entrypoint]: Waiting for server startup
2021-02-22 16:36:49 0 [Note] mysqld (mysqld 10.5.8-MariaDB-1:10.5.8+maria~focal) starting as process 162 ...
2021-02-22 16:36:49 0 [Note] InnoDB: Using Linux native AIO
2021-02-22 16:36:49 0 [Note] InnoDB: Uses event mutexes
2021-02-22 16:36:49 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-02-22 16:36:49 0 [Note] InnoDB: Number of pools: 1
2021-02-22 16:36:49 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2021-02-22 16:36:49 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
2021-02-22 16:36:49 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
2021-02-22 16:36:49 0 [Note] InnoDB: Completed initialization of buffer pool
2021-02-22 16:36:49 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-02-22 16:36:49 0 [Warning] InnoDB: Retry attempts for reading partial data failed.
2021-02-22 16:36:49 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-02-22 16:36:49 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-02-22 16:36:49 0 [ERROR] [FATAL] InnoDB: Tried to read 65536 bytes at offset 38400, but was only able to read 0.Cannot read from file. OS error number 13.
210222 16:36:49 [ERROR] mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.

To report this bug, see https://mariadb.com/kb/en/reporting-bugs

We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed, 
something is definitely wrong and this may fail.

Server version: 10.5.8-MariaDB-1:10.5.8+maria~focal
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=0
max_threads=153
thread_count=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467860 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x0 thread_stack 0x49000
mysqld(my_print_stacktrace+0x32)[0x55611b833692]
Printing to addr2line failed
mysqld(handle_fatal_signal+0x485)[0x55611b28ae45]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0)[0x7f01295d63c0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7f01290dd18b]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7f01290bc859]
mysqld(+0x62dcbb)[0x55611af4fcbb]
mysqld(+0x610b88)[0x55611af32b88]
mysqld(+0xcd8946)[0x55611b5fa946]
mysqld(+0xcc3cbb)[0x55611b5e5cbb]
mysqld(+0xcc8b4b)[0x55611b5eab4b]
mysqld(+0xccce49)[0x55611b5eee49]
mysqld(+0xccd460)[0x55611b5ef460]
mysqld(+0x62636a)[0x55611af4836a]
mysqld(+0xc60c49)[0x55611b582c49]
mysqld(_Z24ha_initialize_handlertonP13st_plugin_int+0x82)[0x55611b28deb2]
mysqld(+0x76b36a)[0x55611b08d36a]
mysqld(_Z11plugin_initPiPPci+0x965)[0x55611b08e645]
mysqld(+0x68ab0b)[0x55611afacb0b]
mysqld(_Z11mysqld_mainiPPc+0x435)[0x55611afb26b5]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7f01290be0b3]
mysqld(_start+0x2e)[0x55611afa712e]
The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/ contains
information that should help you find out what is causing the crash.
Writing a core file...
Working directory at /var/lib/mysql
Resource Limits:
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            8388608              unlimited            bytes     
Max core file size        0                    unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             4326                 4326                 processes 
Max open files            32184                32184                files     
Max locked memory         65536                65536                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       4326                 4326                 signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0                    
Max realtime timeout      unlimited            unlimited            us        
Core pattern: core

/usr/local/bin/docker-entrypoint.sh: line 103:   162 Aborted                 "$@" --skip-networking --socket="${SOCKET}"

2021-02-22 16:36:49 [ERROR] InnoDB:이 오류는 mysqld에 디렉터리에 대한 액세스 권한이 없음을 의미합니다.

이미 사용자 지정 mariadb 이미지로 시도했지만 성공하지 못했습니다.

FROM mariadb:10.5.8

RUN chown 999:999 /var/lib/mysql

그리고 도커 합성 파일에서 볼륨 사양 없이 컨테이너를 시작하고 컨테이너에 로그인하면 mysql 사용자가 파일을 생성한 것을 알 수 있습니다.내가 여기서 뭘 놓쳤지요?

-rw-rw---- 1 mysql mysql     32768 Mar  8 11:01 aria_log.00000001
-rw-rw---- 1 mysql mysql        52 Mar  8 11:01 aria_log_control
-rw-rw---- 1 mysql mysql       976 Mar  8 11:01 ib_buffer_pool
-rw-rw---- 1 mysql mysql 100663296 Mar  8 11:01 ib_logfile0
-rw-rw---- 1 mysql mysql  12582912 Mar  8 11:01 ibdata1
-rw-rw---- 1 mysql mysql  12582912 Mar  8 11:01 ibtmp1
drwx------ 2 mysql mysql      4096 Mar  8 11:01 mydatabase
-rw-rw---- 1 mysql mysql         0 Mar  8 11:01 multi-master.info
drwx------ 2 mysql mysql      4096 Mar  8 11:01 mysql
drwx------ 2 mysql mysql      4096 Mar  8 11:01 performance_schema

또한 이 볼륨은 도커라시 기능을 통해 생성되었습니다.https://docs.docker.com/cloud/aci-compose-features/ #persistent-messages

업데이트: 공식 mysql(5.7) 도커 이미지에는 이 문제가 없습니다.바로 사용할 수 있습니다.

이것은 Azure 파일 공유의 문제입니다.파일 공유를 마운트하면 마운트 지점에root사용자를 소유자 및 그룹으로 지정합니다.우리는 그것을 바꿀 수 없습니다, 왜냐하면 그것은 Azure에 의해 디자인되었기 때문입니다.이 문제는 현재 해결되지 않았습니다.

괜찮으시다면 AKS로 시도해보시고 Azure 디스크를 볼륨으로 사용해보시길 권합니다.이런 식으로는 문제가 발생하지 않습니다.여기에서 유사한 문제를 참조하십시오.

언급URL : https://stackoverflow.com/questions/66511123/unable-to-start-a-mariadb-container-on-azure-because-mysql-user-doesnt-seem-to