mysql 치명적 오류: 버퍼 풀에 메모리를 할당할 수 없습니다.
MySQL의 오류 로그를 가지고 있습니다. 알 수 있나요?웹 사이트가 잠시 작동하다가 몇 시간 후에 MySQL이 완전히 종료됩니다.
140919 10:48:27 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
140919 10:48:27 [Note] Plugin 'FEDERATED' is disabled.
140919 10:48:27 InnoDB: The InnoDB memory heap is disabled
140919 10:48:27 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140919 10:48:27 InnoDB: Compressed tables use zlib 1.2.3.4
140919 10:48:28 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
140919 10:48:28 InnoDB: Completed initialization of buffer pool
140919 10:48:28 InnoDB: Fatal error: cannot allocate memory for the buffer pool
140919 10:48:28 [ERROR] Plugin 'InnoDB' init function returned error.
140919 10:48:28 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140919 10:48:28 [ERROR] Unknown/unsupported storage engine: InnoDB
140919 10:48:28 [ERROR] Aborting
140919 10:48:28 [Note] /usr/sbin/mysqld: Shutdown complete
140919 10:48:28 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
140919 10:48:28 [Note] Plugin 'FEDERATED' is disabled.
140919 10:48:28 InnoDB: The InnoDB memory heap is disabled
140919 10:48:28 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140919 10:48:28 InnoDB: Compressed tables use zlib 1.2.3.4
140919 10:48:28 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
140919 10:48:28 InnoDB: Completed initialization of buffer pool
140919 10:48:28 InnoDB: Fatal error: cannot allocate memory for the buffer pool
140919 10:48:28 [ERROR] Plugin 'InnoDB' init function returned error.
140919 10:48:28 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140919 10:48:28 [ERROR] Unknown/unsupported storage engine: InnoDB
140919 10:48:28 [ERROR] Aborting
140919 10:48:28 [Note] /usr/sbin/mysqld: Shutdown complete
TLDR;
메모리가 부족하여 Mysql을 다시 시작할 수 없습니다. 적절한 스왑 파일이 구성되어 있는지 확인하십시오.
도움이 안 됐어요?이 문제가 해결되지 않은 경우 연구를 계속하기 위한 보다 적합한 질문은 다음과 같습니다.
- mysqld 서비스는 ec2 서버에서 하루에 한 번 중지됩니다.
- https://askubuntu.com/questions/422037/optimising-mysql-settings-mysqld-running-out-of-memory
배경
EC2에 설치한 첫 번째 시스템에서 정확히 이 문제가 발생했습니다. EC2에서 호스팅된 프레스 사이트라는 단어가 "데이터베이스 연결 설정 오류"로 인해 가끔 다운되는 것이 특징입니다.
로그는 OP가 게시한 것과 동일한 오류를 보여주었습니다.오류(타임 스탬프가 제거됨)에 대한 내 판독값은 다음과 같습니다.
- 메모리 부족 오류:
InnoDB: Fatal error: cannot allocate memory for the buffer pool - InnoDB는 충분한 메모리 없이 시작할 수 없습니다.
[ERROR] Plugin 'InnoDB' init function returned error. [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. [ERROR] Unknown/unsupported storage engine: InnoDB [ERROR] Aborting - mysqld가 종료되고 있습니다. 이는 이러한 맥락에서 실제로 다시 시작하지 못하는 것을 의미합니다!
[Note] /usr/sbin/mysqld: Shutdown complete
확인 중/var/log/syslogmysql 산출량 검색:
Out of memory: Kill process 15452 (mysqld) score 93 or sacrifice child
Killed process 15452 (mysqld) total-vm:888672kB, anon-rss:56252kB, file-rss:0kB
init: mysql main process (15452) killed by KILL signal
init: mysql main process ended, respawning
type=1400 audit(1443812767.391:30): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=21984 comm="apparmor_parser"
init: mysql main process (21996) terminated with status 1
init: mysql main process ended, respawning
init: mysql post-start process (21997) terminated with status 1
<repeated>
참고: 로그가 cron에 의해 회전되기 전에 오류가 발생한 경우 보관된 로그를 압축하고 검색해야 할 수 있습니다.
해결책
제 경우 근본적인 문제는 스왑 파일 구성을 소홀히 했다는 것입니다.
를 실행하여 구성되었는지 확인할 수 있습니다.free -m.
total used free shared buffers cached Mem: 604340 587364 16976 0 29260 72280 -/+ buffers/cache: 485824 118516 Swap: 0 0 0
위의 예에서 스왑: 0은 스왑 파일이 없음을 나타냅니다.
설정에 대한 튜토리얼:
- https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04
- https://help.ubuntu.com/community/SwapFaq
큰 것이 반드시 더 좋은 것은 아닙니다!Ubuntu 가이드에서:
"축소 반환"은 RAM 크기의 두 배 이상의 스왑 공간이 필요한 경우 RAM을 추가하는 것이 좋습니다. 하드 디스크 드라이브(HDD) 액세스 속도가 RAM 액세스 속도보다 약 10배 느리기 때문에 1초 정도 걸리던 것이 갑자기 15분 이상 걸립니다!그리고 여전히 빠른 솔리드 스테이트 드라이브(SSD)에 1분 이상...
여기 있는 다른 답변과 관련하여...
The InnoDB memory heap is disabled
이는 실제로 오류가 아니라 InnoDB가 자체 메모리 할당기 대신 시스템의 내부 메모리 할당기를 사용하고 있음을 나타냅니다.기본값은 yes/1이며 생산에 사용할 수 있습니다.
문서에 따르면 이 명령은 더 이상 사용되지 않으며 5.6 이상의 MySQL 버전에서 제거될 것입니다(그리고 MariaDB로 가정합니다).
http://dev.mysql.com/doc/refman/5.6/en/innodb-performance-use_sys_malloc.html
감사합니다: 루벤 셰이드 코멘트
[Note] Plugin 'FEDERATED' is disabled.
Federated disabled에 대한 메시지는 오류가 아닙니다.그것은 단지 당신의 mysql 서버에 연합 엔진이 켜져 있지 않다는 것을 의미했습니다.기본적으로 사용되지 않습니다.당신이 그것이 필요하지 않다면, 이 메시지에 대해 신경 쓰지 마세요.
참조: https://stackoverflow.com/a/16470822/2586761
저는 이 답변이 토론에 추가된다는 것을 발견했습니다: https://www.digitalocean.com/community/questions/mysql-server-keeps-stopping-unexpectedly?answer=26021
즉, innodb_buffer_pool_size를 64M과 같은 적절한 값으로 설정하는 것 외에도 /etc/apache2/mods-enabled/mpm_prefork.conf를 수정하여 Apache에 의해 시작된 연결 수를 줄여야 할 수도 있습니다.
<IfModule mpm_prefork_module>
StartServers 3
MinSpareServers 3
MaxSpareServers 5
MaxRequestWorkers 25
MaxConnectionsPerChild 1024
</IfModule>
해결책은 더 이상의 공간이 아닙니다. 문제는 mysql이 아닌 Apache 웹 서버입니다. 실제로 nodb-buffer-pool-size를 줄여야 합니다.
이 버퍼는 처음부터 mysql 프로세스에서 사용되므로 Apache가 더 많은 리소스를 필요로 할 때 커널이 서비스에서 RAM을 제거합니다. 이는 서버를 중단하는 대신 mysql을 중지하는 것을 의미합니다.
또한 cron을 추가하여 db 상태를 확인하고 ngnx 또는 httplight로 변경하지 않으려면 다시 시작합니다.
언급URL : https://stackoverflow.com/questions/25965638/mysql-fatal-error-cannot-allocate-memory-for-the-buffer-pool
'programing' 카테고리의 다른 글
| 공기 흐름에서 동적 워크플로우를 만드는 올바른 방법 (0) | 2023.08.01 |
|---|---|
| 다중 글꼴 가중치, 하나의 @ 글꼴-면 쿼리 (0) | 2023.08.01 |
| NSData 또는 UIImage에서 이미지 유형 찾기 (0) | 2023.08.01 |
| 그룹화, 그룹화, 그룹화, 평균화 (0) | 2023.07.27 |
| JSONP를 사용하여 html 페이지 로드 (0) | 2023.07.27 |