web-dev-qa-db-ja.com

InnoDBがメモリを割り当てることができないためにMysqlがクラッシュする

MySQLは、my.cnfで設定されたinnodb-buffer-pool-size(現在は210M)を超える大きなリクエストが原因でクラッシュすることがあります。これは、mysqlが最初に起動するように設定する必要がありました。 。

エラーログは次のとおりです。

    130518 17:28:52 mysqld_safe Number of processes running now: 0
    130518 17:28:52 mysqld_safe mysqld restarted
    130518 17:28:52 [Note] Plugin 'FEDERATED' is disabled.
    130518 17:28:52 InnoDB: Mutexes and rw_locks use GCC atomic builtins
    130518 17:28:52 InnoDB: Compressed tables use zlib 1.2.3
    130518 17:28:52 InnoDB: Using Linux native AIO
    130518 17:28:52 InnoDB: Initializing buffer pool, size = 210.0M
    InnoDB: mmap(223117312 bytes) failed; errno 12
    130518 17:28:52 InnoDB: Completed initialization of buffer pool
    130518 17:28:52 InnoDB: Fatal error: cannot allocate memory for the buffer pool
    130518 17:28:52 [ERROR] Plugin 'InnoDB' init function returned error.
    130518 17:28:52 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
    130518 17:28:52 [ERROR] Unknown/unsupported storage engine: InnoDB
    130518 17:28:52 [ERROR] Aborting

    130518 17:28:52 [Note] /usr/libexec/mysqld: Shutdown complete

    130518 17:28:52 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

サーバーを再起動し、ここでmysqldを再起動しました。問題を一時的に修正しますが、再びクラッシュします。

    130518 18:22:32 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    130518 18:22:32 [Note] Plugin 'FEDERATED' is disabled.
    130518 18:22:32 InnoDB: Mutexes and rw_locks use GCC atomic builtins
    130518 18:22:32 InnoDB: Compressed tables use zlib 1.2.3
    130518 18:22:32 InnoDB: Using Linux native AIO
    130518 18:22:32 InnoDB: Initializing buffer pool, size = 210.0M
    130518 18:22:32 InnoDB: Completed initialization of buffer pool
    130518 18:22:32 InnoDB: highest supported file format is Barracuda.
    InnoDB: The log sequence number in ibdata files does not match
    InnoDB: the log sequence number in the ib_logfiles!
    130518 18:22:32  InnoDB: Database was not shut down normally!
    InnoDB: Starting crash recovery.
    InnoDB: Reading tablespace information from the .ibd files...
    InnoDB: Restoring possible half-written data pages from the doublewrite
    InnoDB: buffer...
    130518 18:22:32  InnoDB: Waiting for the background threads to start
    130518 18:22:33 InnoDB: 5.5.31 started; log sequence number 789470772
    130518 18:22:33 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
    130518 18:22:33 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
    [mysqld]
    130518 18:22:33 [Note] Server socket created on IP: '0.0.0.0'.
    130518 18:22:33 [ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it
    130518 18:22:33 [ERROR] Native table 'performance_schema'.'events_waits_current' has the wrong structure
    130518 18:22:33 [ERROR] Native table 'performance_schema'.'events_waits_history' has the wrong structure
    130518 18:22:33 [ERROR] Native table 'performance_schema'.'events_waits_history_long' has the wrong structure
    130518 18:22:33 [ERROR] Native table 'performance_schema'.'setup_consumers' has the wrong structure
    130518 18:22:33 [ERROR] Native table 'performance_schema'.'setup_instruments' has the wrong structure
    130518 18:22:33 [ERROR] Native table 'performance_schema'.'setup_timers' has the wrong structure
    130518 18:22:33 [ERROR] Native table 'performance_schema'.'performance_timers' has the wrong structure
    130518 18:22:33 [ERROR] Native table 'performance_schema'.'threads' has the wrong structure
    130518 18:22:33 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_thread_by_event_name' has the wrong structure
    130518 18:22:33 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_instance' has the wrong structure
    130518 18:22:33 [ERROR] Native table 'performance_schema'.'events_waits_summary_global_by_event_name' has the wrong structure
    130518 18:22:33 [ERROR] Native table 'performance_schema'.'file_summary_by_event_name' has the wrong structure
    130518 18:22:33 [ERROR] Native table 'performance_schema'.'file_summary_by_instance' has the wrong structure
    130518 18:22:33 [ERROR] Native table 'performance_schema'.'mutex_instances' has the wrong structure
    130518 18:22:33 [ERROR] Native table 'performance_schema'.'rwlock_instances' has the wrong structure
    130518 18:22:33 [ERROR] Native table 'performance_schema'.'cond_instances' has the wrong structure
    130518 18:22:33 [ERROR] Native table 'performance_schema'.'file_instances' has the wrong structure
    130518 18:22:33 [Note] Event Scheduler: Loaded 0 events
    130518 18:22:33 [Note] /usr/libexec/mysqld: ready for connections.
    Version: '5.5.31'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL) by Remi

これが私のmy.cnfです:Pastebin.com/SSeU8gxK

2
slyv

次のパラメータを追加して、問題が解決したかどうかを確認します。
innodb_buffer_pool_instances = 3
innodb_change_buffering = inserts
innodb_flush_method = O_DIRECT

1
Sunrays