DRBD經過/proc/drbd文件監控DRBD設備的運行狀況。html
/proc/drbd 文件分爲兩大塊,分別是當前配置的全部drbd資源的實時狀態和DRBD性能指標。網絡
其中,第一行是狀態標誌:app
第二行是性能指標(詳細指標的說明參見 http://drbd.linbit.com/users-guide-8.4/ch-admin.html#s-proc-drbd): less
nns:** nr:** dw:** dr :** al :** bm :** lo :** pe :** ua :** ap :** ep :** wo :** oos :** socket
網絡鏈接狀態就是上述的性能指標中的 "cs:Connnect" 這一列信息,DRBD中全部的狀態以下圖所示,其中紅色部分表示是臨時狀態。ide
其實,這些狀態在DRBD源碼中也能夠看到:性能
/* The order of these constants is important.
* The lower ones (<C_WF_REPORT_PARAMS) indicate
* that there is no socket!
* >=C_WF_REPORT_PARAMS ==> There is a socket
*/
enum drbd_conns {
C_STANDALONE,
C_DISCONNECTING, /* Temporal state on the way to StandAlone. */
C_UNCONNECTED, /* >= C_UNCONNECTED -> inc_net() succeeds */ui/* These temporal states are all used on the way
* from >= C_CONNECTED to Unconnected.
* The 'disconnect reason' states
* I do not allow to change between them. */
C_TIMEOUT,
C_BROKEN_PIPE,
C_NETWORK_FAILURE,
C_PROTOCOL_ERROR,
C_TEAR_DOWN,thisC_WF_CONNECTION,
C_WF_REPORT_PARAMS, /* we have a socket */
C_CONNECTED, /* we have introduced each other */
C_STARTING_SYNC_S, /* starting full sync by admin request. */
C_STARTING_SYNC_T, /* starting full sync by admin request. */
C_WF_BITMAP_S,
C_WF_BITMAP_T,
C_WF_SYNC_UUID,.net/* All SyncStates are tested with this comparison
* xx >= C_SYNC_SOURCE && xx <= C_PAUSED_SYNC_T */
C_SYNC_SOURCE,
C_SYNC_TARGET,
C_VERIFY_S,
C_VERIFY_T,
C_PAUSED_SYNC_S,
C_PAUSED_SYNC_T,C_AHEAD,
C_BEHIND,C_MASK = 31
};
能夠經過查看/proc/drbd 或者是使用命令drbdadm dstate查看資源的磁盤狀態,主要有以下的磁盤狀態:
同時,這些狀態在DRBD源碼中也能夠看到
enum drbd_disk_state {
D_DISKLESS,
D_ATTACHING, /* In the process of reading the meta-data */
D_FAILED, /* Becomes D_DISKLESS as soon as we told it the peer */
/* when >= D_FAILED it is legal to access device->ldev */
D_NEGOTIATING, /* Late attaching state, we need to talk to the peer */
D_INCONSISTENT,
D_OUTDATED,
D_UNKNOWN, /* Only used for the peer, never for myself */
D_CONSISTENT, /* Might be D_OUTDATED, might be D_UP_TO_DATE ... */
D_UP_TO_DATE, /* Only this disk state allows applications' IO ! */
D_MASK = 15
};
經過查看/proc/drbd 的以下圖所示的數據,包含有關I/O 操做的當前資源的信息。
其具體表示的信息以下:
從左到右分別表示:
1. I/O suspension,r表示運行I/O,s表示suspended I/O,正常狀況下爲r
2. Serial resynchronization 串行同步:當資源等待同步時卻推遲了從新同步,這則個標誌變成A,正常狀況爲 –
3. Peer-initiated sync suspension 對等節點發起的同步暫停:當資源正在等待從新同步時,對等節點由於一些緣由發起暫停同步。這個標誌變成p。正常爲–
4. Locally initiated sync suspension 本地發起的同步暫停:當資源等待從新同步時,在本地節點上用戶發起同步暫停,這個標誌變成u。正常爲 –
5. Locally blocked I/O 。正常爲 -。可能會是一下標誌:
d:如由於一個短暫的磁盤狀態致使的drbd內部出現I/O 阻塞
b:備用設備的I/O 阻塞
n:網絡socket出現阻塞
a:設備的I/O 阻塞和網絡阻塞的組合
6. Activity Log update suspension 活動日誌更新暫停:當活動日誌更新暫停,這個標誌變成s。正常爲 –
/proc/drbd 第二行包含每一個資源的計數器和儀表情況的信息,以下圖所示:
每一個狀態指標的含義以下所示。