最近安裝好了MySQL之後,在啟動MySQL服務時無法正常啟動MySQL。提示沒有更新/var/lib/mfailedZDB.pid並退出。該MySQL與Oracle位於同一主機。有些核心參數進行過調整應該也是使用與MySQL。下面是該問題的具體描述。
1、故障現象
SZDB:/usr/src/mysql_src # /etc/init.d/mysql start
Starting MySQL...The server quit without updating PID file (/var/lib/mfailedZDB.pid).
SZDB:~ # cat /etc/issue #故障環境
Welcome to SUSE Linux Enterprise Server 10 SP3 (x86_64) - Kernel \r (\l).
2、故障分析
#查看err日誌資訊
SZDB:/var/lib/mysql # more SZDB.err
140505 16:05:59 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140505 16:05:59 [Note] Plugin 'FEDERATED' is disabled.
140505 16:05:59 InnoDB: The InnoDB memory heap is disabled
140505 16:05:59 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140505 16:05:59 InnoDB: Compressed tables use zlib 1.2.3
140505 16:05:59 InnoDB: Using Linux native AIO
140505 16:05:59 InnoDB: Warning: io_setup() failed with EAGAIN. Will make 5 attempts before giving up.
InnoDB: Warning: io_setup() attempt 1 failed.
InnoDB: Warning: io_setup() attempt 2 failed.
InnoDB: Warning: io_setup() attempt 3 failed.
InnoDB: Warning: io_setup() attempt 4 failed.
InnoDB: Warning: io_setup() attempt 5 failed.
140505 16:06:02 InnoDB: Error: io_setup() failed with EAGAIN after 5 attempts.
InnoDB: You can disable Linux Native AIO by setting innodb_use_native_aio = 0 in my.cnf
140505 16:06:02 InnoDB: Fatal error: cannot initialize AIO sub-system
140505 16:06:02 [ERROR] Plugin 'InnoDB' init function returned error.
140505 16:06:02 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140505 16:06:02 [ERROR] Unknown/unsupported storage engine: InnoDB
140505 16:06:02 [ERROR] Aborting
140505 16:06:02 [Note] /usr/sbin/mysqld: Shutdown complete
140505 16:06:02 mysqld_safe mysqld from pid file /var/lib/mysql/SZDB.pid ended
#從上面的錯誤記錄檔中可以看到,關鍵的一個資訊io_setup() failed with EAGAIN
#io_setup()鎖定失敗
3、故障解決
錯誤碼EAGAIN表明超出了可用event限制的最大值(見第4點中的描述)
SZDB:~ # cat /proc/sys/fs/aio-max-nr
65536 #64k個
SZDB:~ # vi /etc/sysctl.conf
fs.aio-max-nr=262144 #調整為256k個
SZDB:~ # sysctl -p
# Author : Leshami
# Blog : http://blog.csdn.net/leshami
SZDB:~ # /etc/init.d/mysql start #調整後啟動成功
Starting MySQL... done
4、關於fs.aio-max-nr
該參數指同時可以擁有的的非同步IO請求數目
aio-nr & aio-max-nr:
aio-nr is the running total of the number of events specified on the
io_setup system call for all currently active aio contexts. If aio-nr
reaches aio-max-nr then io_setup will fail with EAGAIN. Note that
raising aio-max-nr does not result in the pre-allocation or re-sizing
of any kernel data structures.
NAME
io_setup - Create an asynchronous I/O context
SYNOPSIS
#include <libaio.h>
Tag Description
----------- ------------------------------------
int io_setup (int maxevents, io_context_t *ctxp);
DESCRIPTION:
io_setup() creates an asynchronous I/O context capable of receiving at least maxevents.#建立一個接收非同步i/o的上下文環境
ctxp must not point to an AIO context that already exists, and must be initialized to 0 prior to the call.
On successful creation of the AIO context, *ctxp is filled in with the resulting handle.
RETURN VALUE:
io_setup() returns 0 on success; otherwise, one of the errors listed in the "Errors" section is returned.
ERRORS:
Tag Description
------ ----------------------------------------------
EINVAL ctxp is not initialized,or the specified maxevents exceeds internal limits. maxevents should be greater than 0.
EFAULT An invalid pointer is passed for ctxp.
ENOMEM Insufficient kernel resources are available.
EAGAIN The specified maxevents exceeds the user’s limit of available events.#此案例中返回的時超出了可用event限制的最大值
ENOSYS io_setup() is not implemented on this architecture.
更多參考
有關Oracle RAC請參考
使用crs_setperm修改RAC資源的所有者及許可權
使用crs_profile管理RAC資源設定檔
RAC 資料庫的啟動與關閉
再說 Oracle RAC services
Services in Oracle Database 10g
Migrate datbase from single instance to Oracle RAC
Oracle RAC 串連到指定執行個體
Oracle RAC 負載平衡測試(結合伺服器端與用戶端)
Oracle RAC 伺服器端串連負載平衡(Load Balance)
Oracle RAC 用戶端串連負載平衡(Load Balance)
ORACLE RAC 下非預設連接埠監聽配置(listener.ora tnsnames.ora)
ORACLE RAC 監聽配置 (listener.ora tnsnames.ora)
配置 RAC 負載平衡與容錯移轉
CRS-1006 , CRS-0215 故障一例
基於Linux (RHEL 5.5) 安裝Oracle 10g RAC
使用 runcluvfy 校正Oracle RAC安裝環境
有關Oracle 網路設定相關基礎以及概念性的問題請參考:
配置非預設連接埠的動態服務註冊
配置sqlnet.ora限制IP訪問Oracle
Oracle 監聽器日誌配置與管理
設定 Oracle 監聽器密碼(LISTENER)
配置ORACLE 用戶端串連到資料庫
有關基於使用者管理的備份和備份恢複的概念請參考
Oracle 冷備份
Oracle 熱備份
Oracle 備份恢複概念
Oracle 執行個體恢複
Oracle 基於使用者管理恢複的處理
SYSTEM 資料表空間管理及備份恢複
SYSAUX資料表空間管理及恢複
Oracle 基於備份控制檔案的恢複(unsing backup controlfile)
有關RMAN的備份恢複與管理請參考
RMAN 概述及其體繫結構
RMAN 配置、監控與管理
RMAN 備份詳解
RMAN 還原與恢複
RMAN catalog 的建立和使用
基於catalog 建立RMAN儲存指令碼
基於catalog 的RMAN 備份與恢複
RMAN 備份路徑困惑
使用RMAN實現異機備份恢複(WIN平台)
使用RMAN遷移檔案系統資料庫到ASM
linux 下RMAN備份shell指令碼
使用RMAN遷移資料庫到異機
有關ORACLE體繫結構請參考
Oracle 資料表空間與資料檔案
Oracle 密碼檔案
Oracle 參數檔案
Oracle 聯機重做記錄檔(ONLINE LOG FILE)
Oracle 控制檔案(CONTROLFILE)
Oracle 歸檔日誌
Oracle 復原(ROLLBACK)和撤銷(UNDO)
Oracle 資料庫執行個體啟動關閉過程
Oracle 10g SGA 的自動化管理
Oracle 執行個體和Oracle資料庫(Oracle體繫結構)