Pivotal Knowledge Base

フォローする

Ambariのサービス起動・停止が「UnicodeDecodeError」というエラーで失敗する

環境

  • PHD 3.0.0.0
  • Amabari 1.7.1

事象

NamenodeをAmbariで起動すると以下のエラーで失敗する。しかし、Namenodeサービス起動自体は成功する。

Traceback (most recent call last):
  File "/var/lib/ambari-agent/cache/stacks/PHD/2.0.6/services/HDFS/package/scripts/namenode.py", line 134, in 
    NameNode().execute()
  File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 123, in execute
    method(env)
  File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 233, in restart
    self.start(env)
  File "/var/lib/ambari-agent/cache/stacks/PHD/2.0.6/services/HDFS/package/scripts/namenode.py", line 46, in start
    namenode(action="start")
  File "/var/lib/ambari-agent/cache/stacks/PHD/2.0.6/services/HDFS/package/scripts/hdfs_namenode.py", line 60, in namenode
    only_if=dfs_check_nn_status_cmd #skip when HA not active
  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 237, in action_run
    path=self.resource.path)
  File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 36, in checked_call
    return _call(command, logoutput, True, cwd, env, preexec_fn, user, wait_for_finish, timeout, path)
  File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 101, in _call
    err_msg = Logger.get_protected_text((u"Execution of '%s' returned %d. %s".encode("utf8")) % (command, code, out))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 144: ordinal not in range(128)

原因

ロケールがzh_CN.UTF-8等、英語以外のロケールになっていたため。

[root@namenode1 ~]# more /etc/sysconfig/i18n
LANG="zh_CN.UTF-8"
[root@namenode1 ~]#
[root@namenode1 ~]# locale
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=

解決方法

本事象はAMBARI-5693に報告された既知の事象である。Ambariサーバのロケールをen_US.UTF-8に変更することで解決することができる。

 

コメント

Powered by Zendesk