欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

如何解決Ambari自定義服務(wù)啟動成功后依舊顯示停止?fàn)顟B(tài)問題

如何解決Ambari 自定義服務(wù)啟動成功后依舊顯示停止?fàn)顟B(tài)問題,針對這個問題,這篇文章詳細介紹了相對應(yīng)的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。

創(chuàng)新互聯(lián)專注于揭陽網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗。 熱誠為您提供揭陽營銷型網(wǎng)站建設(shè),揭陽網(wǎng)站制作、揭陽網(wǎng)頁設(shè)計、揭陽網(wǎng)站官網(wǎng)定制、小程序開發(fā)服務(wù),打造揭陽網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供揭陽網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。

1、概述

如果遇到該情況,首先前往 /var/log/ambari-agent/ambari-agent.log 查看日志輸出。

服務(wù)安裝后,每隔大約 60s 會執(zhí)行 status() 方法。如果執(zhí)行 status() 方法的過程中報錯,則在 Ambari 頁面上會顯示服務(wù)已停止。如果執(zhí)行 status() 方法的過程中沒報錯,則在 Ambari 頁面上顯示服務(wù)正常。

通常在 status() 方法中,我們會使用 Ambari 提供的 resource_management 模塊里的 check_process_status() 來判斷服務(wù)的狀態(tài)。

check_process_status() 通過檢測一個 pid 文件里面的進程號,來判斷服務(wù)的啟動狀態(tài)。通常 pid 文件內(nèi)只有一個進程號,如 12168 。

 

2、問題示例分析

 
2.1、報錯

以自定義服務(wù) JanusGraph 為例,status() 方法是這樣寫的:

from resource_management import *

def status(self, env):
    import graphexp_params
    env.set_params(graphexp_params)
    check_process_status(graphexp_params.graphexp_nginx_pid_file)
 

graphexp_params.py 文件的局部內(nèi)容:

from resource_management import *

config = Script.get_config()
# graphexp的nginx pid文件路徑
graphexp_pid_dir = config['configurations']['graphexp-server']['graphexp_pid_dir']
# graphexp的nginx pid文件路徑
graphexp_nginx_pid_file = os.path.join(graphexp_pid_dir, 'graphexp_nginx.pid')
 

上述代碼是動態(tài)獲取 Ambari 頁面上的 graphexp_pid_dir 配置項,然后拼湊成一個 pid 文件路徑,這個 pid 文件內(nèi)容只有 graphexp 組件的進程號。

結(jié)果出錯了,根據(jù) /var/log/ambari-agent/ambari-agent.log 日志輸出,發(fā)現(xiàn)在 status_params.py 里面獲取 graphexp-server.xml 文件內(nèi)的參數(shù)值報錯,如下圖所示:

如何解決Ambari 自定義服務(wù)啟動成功后依舊顯示停止?fàn)顟B(tài)問題

 
2.2、問題排查

在 status() 方法下,輸出 config['configurations'] 發(fā)現(xiàn)只能打印出:

ams-hbase-env,infra-solr-env,hbase-env,ams-env,elastic-env,janusgraph-env,ams-grafana-env,hadoop-env,zookeeper-env,cluster-env
 

以上這些值,沒有 graphexp-server 項。

而在 start() 方法里面打印有很多,所有的 configurations 的 xml 文件都被加載到了:

ranger-hdfs-audit,ssl-client,infra-solr-log4j,ranger-hdfs-policymgr-ssl,ams-hbase-site,elastic-config,ranger-hbase-audit,hdfs-logsearch-conf,ams-grafana-env,ranger-hdfs-security,ams-ssl-client,infra-solr-env,ranger-hdfs-plugin-properties,hbase-policy,ams-logsearch-conf,ams-hbase-security-site,hdfs-site,ams-env,ams-site,ams-hbase-policy,janusgraph-env,hadoop-metrics2.properties,hadoop-policy,hdfs-log4j,hbase-site,infra-logsearch-conf,ranger-hbase-plugin-properties,ams-grafana-ini,graphexp-server,ams-ssl-server,infra-solr-xml,ams-log4j,ams-hbase-env,core-site,infra-solr-security-json,gremlin-server,janusgraph-hbase-solr,infra-solr-client-log4j,hbase-logsearch-conf,hadoop-env,zookeeper-log4j,hbase-log4j,postgresql,ssl-server,hbase-env,zoo.cfg,elastic-env,ranger-hbase-policymgr-ssl,zookeeper-logsearch-conf,cluster-env,zookeeper-env,ams-hbase-log4j,ranger-hbase-security
 

所以猜測在 status() 方法里面,只能識別 xxx-env.xml 里面的配置內(nèi)容。但是 ambari2.7 的自定義服務(wù)沒有這個問題,只在 ambari2.6 上出現(xiàn)了。

 
2.3、解決辦法

新建 graphexp-env.xml 文件,將 graphexp_pid_dir 配置項添加到該文件內(nèi)。graphexp_params.py 文件的 graphexp_pid_dir 寫法修改為:

# graphexp的nginx pid文件路徑
graphexp_pid_dir = config['configurations']['graphexp-env']['graphexp_pid_dir']
# graphexp的nginx pid文件路徑
graphexp_nginx_pid_file = os.path.join(graphexp_pid_dir, 'graphexp_nginx.pid')
    在 status() 方法內(nèi),獲取 graphexp-env.xml 文件內(nèi)的配置,只有 xxx-env.xml 的內(nèi)容才可以被 status() 方法加載到。

3、status()方法調(diào)試建議

由于 status() 是輪詢調(diào)用,且目前還不知道日志輸出的具體位置(沒有輸出到 ambari-agent.log 里面),所以可以用 Execute("echo {0} >> /tmp/test.log".format(status_params.gtm_standby_pid_file)) 命令來輸出需要的參數(shù)值。同時也可以根據(jù)上述 Execute 語句位置來判斷代碼具體的報錯行數(shù),方便定位代碼報錯地點。 

關(guān)于如何解決Ambari 自定義服務(wù)啟動成功后依舊顯示停止?fàn)顟B(tài)問題問題的解答就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道了解更多相關(guān)知識。

分享題目:如何解決Ambari自定義服務(wù)啟動成功后依舊顯示停止?fàn)顟B(tài)問題
當(dāng)前路徑:http://www.chinadenli.net/article4/geciie.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供營銷型網(wǎng)站建設(shè)網(wǎng)站設(shè)計用戶體驗建站公司自適應(yīng)網(wǎng)站網(wǎng)站收錄

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

手機網(wǎng)站建設(shè)