def checkServerProcess(): hostAndPorts = conf.get('zookeeper.hosts') serverlist = getQuorumPeerMain(hostAndPorts.split(',')) for host in serverlist: content = exeCmd.execJps(host) if len(re.findall(serverlist.get(host), content)) < 1: log.warn('{host} 节点 QuorumPeerMain 服务未运行'.format(host=host)) startZk(host, 'QuorumPeerMain') else: log.info('{host} 节点 QuorumPeerMain 服务正在运行'.format(host=host))
def checkServerProcess(): HostAndPorts = conf.get('flume.hosts') flumeServerList = getFlume(HostAndPorts.split(',')) for host in flumeServerList: content = exeCmd.execJps(host) if len(re.findall(flumeServerList.get(host), content)) < 1: log.warn(host + ' 节点 ' + 'flume' + ' 服务未运行') startFlume(host, 'flume') else: log.info(host + ' 节点 ' + 'flume' + '服务正在运行')
def checkServerProcess(): hostAndPorts = conf.get('es.hosts') print(hostAndPorts) serverlist = getES(hostAndPorts.split(',')) for host in serverlist: content = exeCmd.execJps(host) if (len(re.findall(serverlist.get(host), content)) < 1): log.warn(host + ' 节点 ' + 'Elasticsearch' + ' 服务未运行') startES(host, 'Elasticsearch') else: log.info(host + ' 节点 ' + 'Elasticsearch ' + '服务正在运行')
def exeCheckServerProcess(): serverList = checkServerProcess() for host in serverList: content = exeCmd.execJps(host) for serverName in serverList.get(host).split(','): if len(re.findall(serverName, content)) < 1: log.warn('{host} 节点 {serverName} 服务未运行'.format( host=host, serverName=serverName)) startHbase(host, serverName.lower()) else: log.info('{host} 节点 {serverName} 服务正在运行'.format( host=host, serverName=serverName))
def checkServerProcess(): hostAndPorts = conf.get('tomcat.hosts') serverlist, proNums = getBootstrap(hostAndPorts.split(',')) for host in serverlist: content = exeCmd.execJps(host) nowProNum = len(re.findall(serverlist.get(host), content)) proNum = int(proNums.get(host)) if nowProNum < proNum: log.warn('{host} 节点 {proNum} 个 Bootstrap 服务未运行'.format( host=host, proNum=(proNum - nowProNum))) startBootstrap(host, 'Bootstrap') else: log.info('{host} 节点 {proNum} 个 Bootstrap 服务正在运行'.format( host=host, proNum=proNum))
def checkServerProcess(): hostAndPorts = conf.get('hive.server2') serverlist = getHiveServer2(hostAndPorts.split(',')) hostAndPorts = conf.get('hive.metastore') serverlist = getHiveMetaStore(hostAndPorts.split(','), serverlist) for host in serverlist: content = exeCmd.execJps(host, 'ansible client -l {host} -a "jps -m"') for server in serverlist.get(host).split(','): if len(re.findall(server, content)) < 1: log.warn('{host} 节点 {server} 服务未运行'.format(host=host, server=server)) startHive(host, server) else: log.info('{host} 节点 {server} 服务正在运行'.format(host=host, server=server))
def exeCheckServerProcess(): serverList = checkServerProcess() startNum = 0 for host in serverList: content = exeCmd.execJps(host) for server in serverList.get(host).split(','): if len(re.findall(server, content)) < 1: log.warn('{host} 节点 {server} 服务未运行'.format(host=host, server=server)) start_hadoop(host, server.lower()) startNum += 1 else: log.info('{host} 节点 {server} 服务正在运行'.format(host=host, server=server)) if startNum > 0: log.warn("检测到有 {startNum} 个hadoop进程重启".format(startNum=startNum)) time_util.sleep(30)
def checkServerProcess(): webHostAndPorts = conf.get('azkaban.web.hosts') serverProcessList = getWeb(webHostAndPorts.split(',')) execHostAndPorts = conf.get('azkaban.exe.hosts') serverProcessList = getExe(execHostAndPorts.split(','), serverProcessList) for host in serverProcessList: content = exeCmd.execJps(host) for serverName in serverProcessList.get(host).split(','): if len(re.findall(serverName, content)) < 1: log.warn('{host} 节点 {serverName} 服务未运行'.format( host=host, serverName=serverName)) startAzkaban(host, serverName) else: log.info('{host} 节点 {serverName} 服务正在运行'.format( host=host, serverName=serverName))
def checkServerProcess(): hostAndPorts = conf.get('kafka.hosts') serverlist = getKafka(hostAndPorts.split(',')) proNum = conf.get('kafka.process.number') if proNum == '': proNum = 1 else: proNum = int(proNum) for host in serverlist: content = exeCmd.execJps(host) nowProNum = len(re.findall(serverlist.get(host), content)) if nowProNum < proNum: log.warn('{host} 节点 {proNum} 个 Kafka 服务未运行'.format( host=host, proNum=(proNum - nowProNum))) startKafka(host, 'Kafka') else: log.info('{host} 节点 {proNum} 个 Kafka 服务正在运行'.format( host=host, proNum=proNum))