Ambari自定义服务开发问题处理-Agent安装服务报错unknown
[toc]
# 问题描述
在安装自定义服务时,Agent报错,提示ValueError: unknown locale: UTF-8
Traceback (most recent call last):
File "/var/lib/ambari-agent/cache/stack-hooks/before-INSTALL/scripts/hook.py", line 37, in <module>
BeforeInstallHook().execute()
File "/usr/lib/ambari-agent/lib/resource_management/libraries/script/script.py", line 352, in execute
method(env)
File "/var/lib/ambari-agent/cache/stack-hooks/before-INSTALL/scripts/hook.py", line 33, in hook
install_packages()
File "/var/lib/ambari-agent/cache/stack-hooks/before-INSTALL/scripts/shared_initialization.py", line 37, in install_packages
retry_count=params.agent_stack_retry_count)
File "/usr/lib/ambari-agent/lib/resource_management/core/base.py", line 125, in __new__
cls(names_list.pop(0), env, provider, **kwargs)
File "/usr/lib/ambari-agent/lib/resource_management/core/base.py", line 166, in __init__
self.env.run()
File "/usr/lib/ambari-agent/lib/resource_management/core/environment.py", line 160, in run
self.run_action(resource, action)
File "/usr/lib/ambari-agent/lib/resource_management/core/environment.py", line 124, in run_action
provider_action()
File "/usr/lib/ambari-agent/lib/resource_management/core/providers/packaging.py", line 30, in action_install
self._pkg_manager.install_package(package_name, self.__create_context())
File "/usr/lib/ambari-agent/lib/ambari_commons/repo_manager/yum_manager.py", line 211, in install_package
elif context.is_upgrade or context.use_repos or not self._check_existence(name):
File "/usr/lib/ambari-agent/lib/ambari_commons/repo_manager/yum_manager.py", line 278, in _check_existence
return self.yum_check_package_available(name)
File "/usr/lib/ambari-agent/lib/ambari_commons/repo_manager/yum_manager.py", line 293, in yum_check_package_available
package_list = yb.rpmdb.simplePkgList()
File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 1083, in <lambda>
rpmdb = property(fget=lambda self: self._getRpmDB(),
File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 648, in _getRpmDB
self._rpmdb = rpmsack.RPMDBPackageSack(root=self.conf.installroot,
File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 1079, in <lambda>
conf = property(fget=lambda self: self._getConfig(),
File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 386, in _getConfig
startupconf.pluginconfpath,disabled_plugins,enabled_plugins)
File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 630, in doPluginSetup
plugin_types, confpath, disabled_plugins, enabled_plugins)
File "/usr/lib/python2.7/site-packages/yum/plugins.py", line 166, in __init__
self.run('config')
File "/usr/lib/python2.7/site-packages/yum/plugins.py", line 188, in run
func(conduitcls(self, self.base, conf, **kwargs))
File "/usr/lib/yum-plugins/langpacks.py", line 205, in config_hook
(lang, encoding) = locale.getdefaultlocale()
File "/usr/lib64/python2.7/locale.py", line 511, in getdefaultlocale
return _parse_localename(localename)
File "/usr/lib64/python2.7/locale.py", line 443, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# 解决方法
服务器编码问题,在文件:/usr/sbin/ambari-agent
中添加
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
1
2
2
如下图所示:
重启服务:
ambari-agent restart
上次更新: 2024/04/08, 10:55:49