请问怎么查看节点中的客户端连接,以及清除那些不活跃连接

如题

请先 登录 后评论

1 个回答

wale

查看连接用getSessionMemoryStat函数,清除连接用closeSessions函数。以下函数可清除集群中超过N小时不活跃的连接,供参考:

/* *
*  @ brief  This function is used to close inactive sessions.
*  @ param
*  hours determines the interval (in hours) after which a session is determined as inactive. The default value is 12.
*  @ Return  a table of the active connections
*  @ sample usage  closeInactiveSessions(24)
*/


def closeInactiveSessions(hours=12) {
    sessionIds = exec sessionId from pnodeRun(getSessionMemoryStat) where now() - lastActiveTime > long(hours*60*60*1000)
    pnodeRun(closeSessions{sessionIds})
    return pnodeRun(getSessionMemoryStat)
}

请先 登录 后评论