Support Questions

Find answers, ask questions, and share your expertise

Add custom service via Ambari ERROR

avatar
Explorer

Hi all:

I got HDP3.0 installed with Ambari 2.7 on my test_cluster, and my old cluster has HDP2.6.1.0 running for several months.

I add a custom service 'ELASTICSEARCH' in my old cluster running very well , however when I copy config to /var/lib/ambari-server/resources/stacks/HDP/3.0/services/ELASTICSEARCH and restart ambari-server ,I cannot install ELASTICSEARCH with this ERROR:

Traceback (most recent call last):
  File "/var/lib/ambari-agent/cache/stack-hooks/before-ANY/scripts/hook.py", line 35, in <module>
    BeforeAnyHook().execute()
  File "/usr/lib/ambari-agent/lib/resource_management/libraries/script/script.py", line 353, in execute
    method(env)
  File "/var/lib/ambari-agent/cache/stack-hooks/before-ANY/scripts/hook.py", line 29, in hook
    setup_users()
  File "/var/lib/ambari-agent/cache/stack-hooks/before-ANY/scripts/shared_initialization.py", line 50, in setup_users
    groups = params.user_to_groups_dict[user],
KeyError: u'elasticsearch'
Error: Error: Unable to run the custom hook script ['/usr/bin/python', '/var/lib/ambari-agent/cache/stack-hooks/before-ANY/scripts/hook.py', 'ANY', '/var/lib/ambari-agent/data/command-452.json', '/var/lib/ambari-agent/cache/stack-hooks/before-ANY', '/var/lib/ambari-agent/data/structured-out-452.json', 'INFO', '/var/lib/ambari-agent/tmp', 'PROTOCOL_TLSv1_2', '']

I thought it related to my user&group configuration ,but I have no templates and I have no idea how it works.

Any suggestions would be very thankful !!!

1 ACCEPTED SOLUTION

avatar

Hi @Henry Luo,

I see as per the code : https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/stack-hooks/before-ANY/...

You script is failing at "Creates users before cluster installation" step .

I would suggest you skip creating group users via the below REST API : You can refer to this document to perform it via rest API : https://community.hortonworks.com/articles/63557/how-to-edit-the-cluster-envxml-entries-using-ambar....

or else can perform the same via :

[root@asnaik1 scripts]# pwd /var/lib/ambari-server/resources/scripts
[root@asnaik1 scripts]# python configs.py -u admin -p admin -n asnaik -l asnaik1.openstacklocal -t 8080 -a get -c cluster-env |grep -i ignore_groupsusers_create
    "ignore_groupsusers_create": "false",
[root@asnaik1 scripts]# python configs.py -u admin -p admin -n asnaik -l asnaik1.openstacklocal -t 8080 -a set -c cluster-env -k  ignore_groupsusers_create -v true
2018-08-09 04:12:14,914 INFO ### Performing "set":
2018-08-09 04:12:14,914 INFO ### new property - "ignore_groupsusers_create":"true"
2018-08-09 04:12:14,940 INFO ### on (Site:cluster-env, Tag:version1527268503510)
2018-08-09 04:12:14,953 INFO ### PUTting json into: doSet_version1533787934953155.json
2018-08-09 04:12:15,059 INFO ### NEW Site:cluster-env, Tag:version1533787934953155
[root@asnaik1 scripts]# python configs.py -u admin -p admin -n asnaik -l asnaik1.openstacklocal -t 8080 -a get -c cluster-env |grep -i ignore_groupsusers_create
    "ignore_groupsusers_create": "true",

you can get the help from

[root@asnaik1 scripts]# python configs.py --help

and retry the operation. this time ambari wont be creating a elasticsearch user.

Hope this helps.

Please accept the answer if this helped you.

View solution in original post

1 REPLY 1

avatar

Hi @Henry Luo,

I see as per the code : https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/stack-hooks/before-ANY/...

You script is failing at "Creates users before cluster installation" step .

I would suggest you skip creating group users via the below REST API : You can refer to this document to perform it via rest API : https://community.hortonworks.com/articles/63557/how-to-edit-the-cluster-envxml-entries-using-ambar....

or else can perform the same via :

[root@asnaik1 scripts]# pwd /var/lib/ambari-server/resources/scripts
[root@asnaik1 scripts]# python configs.py -u admin -p admin -n asnaik -l asnaik1.openstacklocal -t 8080 -a get -c cluster-env |grep -i ignore_groupsusers_create
    "ignore_groupsusers_create": "false",
[root@asnaik1 scripts]# python configs.py -u admin -p admin -n asnaik -l asnaik1.openstacklocal -t 8080 -a set -c cluster-env -k  ignore_groupsusers_create -v true
2018-08-09 04:12:14,914 INFO ### Performing "set":
2018-08-09 04:12:14,914 INFO ### new property - "ignore_groupsusers_create":"true"
2018-08-09 04:12:14,940 INFO ### on (Site:cluster-env, Tag:version1527268503510)
2018-08-09 04:12:14,953 INFO ### PUTting json into: doSet_version1533787934953155.json
2018-08-09 04:12:15,059 INFO ### NEW Site:cluster-env, Tag:version1533787934953155
[root@asnaik1 scripts]# python configs.py -u admin -p admin -n asnaik -l asnaik1.openstacklocal -t 8080 -a get -c cluster-env |grep -i ignore_groupsusers_create
    "ignore_groupsusers_create": "true",

you can get the help from

[root@asnaik1 scripts]# python configs.py --help

and retry the operation. this time ambari wont be creating a elasticsearch user.

Hope this helps.

Please accept the answer if this helped you.