In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
How to solve the problem of still displaying the stop status after the Ambari custom service starts successfully? in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
1. Overview
If you encounter this situation, first go to / var/log/ambari-agent/ambari-agent.log to check the log output.
After the service is installed, the status () method is executed about 60 seconds apart. If an error is reported during the execution of the status () method, the service is stopped on the Ambari page. If no errors are reported during the execution of the status () method, the service appears fine on the Ambari page.
Usually in the status () method, we use check_process_status () in the resource_management module provided by Ambari to determine the status of the service.
Check_process_status () determines the startup status of the service by detecting the process number in a pid file. Usually there is only one process number in the pid file, such as 12168.
2. Problem example analysis 2.1, error report
Taking the custom service JanusGraph as an example, the status () method reads as follows:
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)
Partial contents of the graphexp_params.py file:
From resource_management import *
Config = Script.get_config ()
# nginx pid file path of graphexp
Graphexp_pid_dir = config ['configurations'] [' graphexp-server'] ['graphexp_pid_dir']
# nginx pid file path of graphexp
Graphexp_nginx_pid_file = os.path.join (graphexp_pid_dir, 'graphexp_nginx.pid')
The above code dynamically acquires the graphexp_pid_dir configuration item on the Ambari page and pieces together a pid file path that contains only the process number of the graphexp component.
An error occurred. According to the output of the / var/log/ambari-agent/ambari-agent.log log, it was found that an error was reported when getting the parameter values in the graphexp-server.xml file in status_params.py, as shown in the following figure:
2.2. Troubleshooting
Under the status () method, the output config ['configurations'] finds that it can only print:
Ams-hbase-env,infra-solr-env,hbase-env,ams-env,elastic-env,janusgraph-env,ams-grafana-env,hadoop-env,zookeeper-env,cluster-env
For these values, there is no graphexp-server entry.
There are a lot of prints in the start () method, and all the configurations xml files are loaded into:
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
So guess that in the status () method, you can only identify the configuration content in xxx-env.xml. But ambari2.7 's custom service doesn't have this problem, it only appears on ambari2.6.
2.3. Solution
Create a new graphexp-env.xml file and add graphexp_pid_dir configuration items to the file. The graphexp_pid_dir writing of the graphexp_params.py file is modified to:
# nginx pid file path of graphexp
Graphexp_pid_dir = config ['configurations'] [' graphexp-env'] ['graphexp_pid_dir']
# nginx pid file path of graphexp
Graphexp_nginx_pid_file = os.path.join (graphexp_pid_dir, 'graphexp_nginx.pid')
In the status () method, get the configuration in the graphexp-env.xml file, and only the contents of xxx-env.xml can be loaded into the status () method.
3. Suggestions for debugging the status () method
Because status () is a polling call, and the exact location of the log output is not known (it is not output to ambari-agent.log), you can use the Execute ("echo {0} > > / tmp/test.log" .format (status_params.gtm_standby_pid_file)) command to output the desired parameter values. At the same time, the specific number of error lines of the code can be judged according to the position of the above Execute statement, which is convenient to locate the error location of the code.
This is the answer to the question about how to solve the problem that still displays the stop status after the Ambari custom service starts successfully. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.