MySQL现在偶尔会崩溃,因为我相信,在my.cnf(当前为210M)的innodb-buffer-pool-size集合上面有一个大的请求,这个请求我首先要为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
添加以下参数并检查问题是否已解决:
innodb_buffer_pool_instances = 3
innodb_change_buffering =刀片
innodb_flush_method = O_DIRECT