Pivotal Knowledge Base

Follow

Ambari: MySQL status failed but service is runnning

Environment

  • PHD 3.0
  • Ambari 1.7.1
  • Locale set to non-english language

Symptom

MySQL server shows as stopped in Ambari interface. Even after trying to start it, it blinks green for a while, and then shows stopped again. The following error is present in ambari.log

INFO 2015-04-30 10:44:44,137 PythonExecutor.py:118 - Result: {'structuredOut': {}, 'stdout': '2015-04-30 10:44:44,045 - Execute[\'service mysqld status | grep running\'] 
{}
2015-04-30 10:44:44,107 - Error while executing command \'status\':
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py",
line 123, in execute
method(env)
File "/var/lib/ambari-agent/cache/stacks/PHD/2.0.6/services/HIVE/package/scripts/mysql_server.py", line 67, in status
mysql_service(daemon_name=status_params.daemon_name, action = \'status\')
File "/var/lib/ambari-agent/cache/stacks/PHD/2.0.6/services/HIVE/package/scripts/mysql_service.py", line 29, in mysql_service
Execute(status_cmd)
File "/usr/lib/python2.6/site-packages/resource_management/core/base.py", line 148, in __init__
self.env.run()
File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 149, in run
self.run_action(resource, action)
File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 115, in run_action
provider_action()
File "/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py", line 241, in action_run
raise ex
Fail: Execution of \'service mysqld status | grep running\' returned 1.', 'stderr': '2015-04-30 10:44:44,107 - Error while executing command \'status\':
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 123, in execute
method(env)
File "/var/lib/ambari-agent/cache/stacks/PHD/2.0.6/services/HIVE/package/scripts/mysql_server.py", line 67, in status
mysql_service(daemon_name=status_params.daemon_name, action = \'status\')
File "/var/lib/ambari-agent/cache/stacks/PHD/2.0.6/services/HIVE/package/scripts/mysql_service.py", line 29, in mysql_service
Execute(status_cmd)
File "/usr/lib/python2.6/site-packages/resource_management/core/base.py", line 148, in __init__
self.env.run()
File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 149, in run
self.run_action(resource, action)
File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 115, in run_action
provider_action()
File "/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py",
line 241, in action_run
raise ex
Fail: Execution of \'service mysqld status | grep running\' returned 1.', 'exitcode': 1}

Cause

Ambari does some checks based on command outputs. The checks assume that language is in English; so those checks will fail for locales that change output messages (e.g. German, Italian, Spanish, etc.)

Fix

As a workaround, we have to modify manually the following file:

/var/lib/ambari-server/resources/stacks/PHD/2.0.6/services/HIVE/package/scripts/mysql_service.py

And change the line 25 in the following way:

- status_cmd = format('service {daemon_name} status | grep running')
+ status_cmd = format("pgrep -l '^{daemon_name}$'")

Comments

Powered by Zendesk