2016-05-31 9 views
-1

これは私のWordpress Siteがなぜ「データベース接続を確立する際にエラーが発生しました」というエラーでクラッシュするのかわかりません。EC2インスタンス - Wordpressデータベースがクラッシュし続ける

mysqlサービスを再起動すると一時的にこの問題は解決されるようですが、必然的に何度もクラッシュします。

私はそれがメモリの問題かもしれないと思ったので、私は1gbから2gbにインスタンスをアップグレードしました。しかし、何も変更されていないようです。私はむしろメモリに関連していない場合、これのための膨大な余分な費用を支払うつもりはないです。

クラッシュに関連するmysqlログファイルの一部です。すべてのクラッシュは、以下が含まれているように見える:

160519 13:03:21 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 
160519 13:03:21 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 
160519 13:03:21 [Note] /usr/libexec/mysql55/mysqld (mysqld 5.5.46) starting as process 18275 ... 
160519 13:03:21 [Note] Plugin 'FEDERATED' is disabled. 
160519 13:03:21 InnoDB: The InnoDB memory heap is disabled 
160519 13:03:21 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
160519 13:03:21 InnoDB: Compressed tables use zlib 1.2.8 
160519 13:03:21 InnoDB: Using Linux native AIO 
160519 13:03:21 InnoDB: Initializing buffer pool, size = 128.0M 
InnoDB: mmap(137363456 bytes) failed; errno 12 
160519 13:03:21 InnoDB: Completed initialization of buffer pool 
160519 13:03:21 InnoDB: Fatal error: cannot allocate memory for the buffer pool 
160519 13:03:21 [ERROR] Plugin 'InnoDB' init function returned error. 
160519 13:03:21 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 
160519 13:03:21 [ERROR] Unknown/unsupported storage engine: InnoDB 
160519 13:03:21 [ERROR] Aborting 

160519 13:03:21 [Note] /usr/libexec/mysql55/mysqld: Shutdown complete 

**** **** UPDATE

は、だから私は下に述べたようにinnodb_buffer_pool_sizeのサイズを変更してもスワップファイルを作ってきました。私のサイトはまだ数時間おきにクラッシュし、私はゆっくりと生きる意志を失っています。

160507 16:28:20 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 
160507 16:28:20 [Note] /usr/libexec/mysql55/mysqld (mysqld 5.5.46) starting as process 26457 ... 
160507 16:28:20 [Note] Plugin 'FEDERATED' is disabled. 
160507 16:28:20 InnoDB: The InnoDB memory heap is disabled 
160507 16:28:20 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
160507 16:28:20 InnoDB: Compressed tables use zlib 1.2.8 
160507 16:28:20 InnoDB: Using Linux native AIO 
160507 16:28:20 InnoDB: Initializing buffer pool, size = 128.0M 
160507 16:28:20 InnoDB: Completed initialization of buffer pool 
InnoDB: The first specified data file ./ibdata1 did not exist: 
InnoDB: a new database to be created! 
160507 16:28:20 InnoDB: Setting file ./ibdata1 size to 10 MB 
InnoDB: Database physically writes the file full: wait... 
160507 16:28:21 InnoDB: Log file ./ib_logfile0 did not exist: new to be created 
InnoDB: Setting log file ./ib_logfile0 size to 5 MB 
InnoDB: Database physically writes the file full: wait... 
160507 16:28:21 InnoDB: Log file ./ib_logfile1 did not exist: new to be created 
InnoDB: Setting log file ./ib_logfile1 size to 5 MB 
InnoDB: Database physically writes the file full: wait... 
InnoDB: Doublewrite buffer not found: creating new 
InnoDB: Doublewrite buffer created 
InnoDB: 127 rollback segment(s) active. 
InnoDB: Creating foreign key constraint system tables 
InnoDB: Foreign key constraint system tables created 
160507 16:28:21 InnoDB: Waiting for the background threads to start 
160507 16:28:22 InnoDB: 5.5.46 started; log sequence number 0 
160507 16:28:22 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306 
160507 16:28:22 [Note] - '0.0.0.0' resolves to '0.0.0.0'; 
160507 16:28:22 [Note] Server socket created on IP: '0.0.0.0'. 
160507 16:28:22 [Note] Event Scheduler: Loaded 0 events 
160507 16:28:22 [Note] /usr/libexec/mysql55/mysqld: ready for connections. 
Version: '5.5.46' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL) 
160507 17:56:05 [Note] /usr/libexec/mysql55/mysqld: Normal shutdown 

160507 17:56:05 [Note] Event Scheduler: Purging the queue. 0 events 
160507 17:56:05 InnoDB: Starting shutdown... 
160507 17:56:06 InnoDB: Shutdown completed; log sequence number 2733606 
160507 17:56:06 [Note] /usr/libexec/mysql55/mysqld: Shutdown complete 
+0

データベースに負荷がかかる原因があります。スワップメモリ​​を増やしてみて、クエリを確認したり、プラグインを無効にしてクラッシュが再び発生したかどうかを確認してください。 –

+0

これを試してみますが、毎回アカウントの権限が失われたり、 – zarate32

+0

この質問を確認するhttp://stackoverflow.com/questions/25965638/mysql-fatal-error-cannot-allocate-memory-for-the-buffer-pool – error2007s

答えて

0

バッファサイズが高すぎます。それはおそらくあなたがAmazonでLinuxを使用している場合

https://dba.stackexchange.com/questions/27328/how-large-should-be-mysql-innodb-buffer-pool-size

、MySQLのドキュメントによると(https://dev.mysql.com/doc/refman/5.7/en/ha-vm-aws-setup.html)は、このための設定は、/ etcにあるdba.stackexchange.comにこの答えを見ると、その大きさにする必要はありません。

/my.cnfおそらくinnodb_buffer_pool_size = 10Mに、このファイルの設定を変更すると、あなたの問題を解決するだろう

上記の修正上記のログに示されている特定の問題。メモリ使用に関するログに記録されている別の問題がある場合は、スワップを使用してこれらのコマンドで

/bin/dd if=/dev/zero of=/swapfile bs=1M count=4096; /sbin/mkswap /swapfile; /sbin/swapon /swapfile 

を4GiBのスワップファイルを追加し、それはあなたのシステムが遅くて肥大化を実行することを可能にする魔法ではありません。しかし、これによりメモリ使用量が "飛び越える"ことができれば良いかもしれません。

+0

私はこれをやろうとしましたが、私のサイトは引き続きダウンしてアクセス不能です。もし私がmysqlとapacheを再起動すると、巧みに動作しますが、30分ほどで死ぬでしょう。私はそれを得ることはできません。今では全くロードされず、サイトが – zarate32

+0

に到達できないと言う前にハングするだけです。その変更を行った場合は別のエラーをログに記録する必要があります – Vorsprung

+0

この問題が文書化されたスワップファイルの可能性もありますか? – zarate32

関連する問題