Support Questions

Find answers, ask questions, and share your expertise

Unable Start NameNode after Ranger HDFS Plugin Enabled

avatar
Contributor

Hi Team,

I tried to enable the HDFS Ranger plugin which asked me to restart NameNode/DataNode/Secondry Namenode but it failed to start with below error.

NameNode works very well if I disable HDFS Ranger plugin.

Appreciate your help to resolve this issue.

I am using Ambari Version 2.5.0.3 and HDP Stack 2.5.3.0

Traceback (most recent call last):
  File "/var/lib/ambari-agent/cache/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py", line 424, in <module>
    NameNode().execute()
  File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 314, in execute
    method(env)
  File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 762, in restart
    self.start(env, upgrade_type=upgrade_type)
  File "/var/lib/ambari-agent/cache/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py", line 100, in start
    upgrade_suspended=params.upgrade_suspended, env=env)
  File "/usr/lib/python2.6/site-packages/ambari_commons/os_family_impl.py", line 89, in thunk
    return fn(*args, **kwargs)
  File "/var/lib/ambari-agent/cache/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_namenode.py", line 104, in namenode
    setup_ranger_hdfs(upgrade_type=upgrade_type)
  File "/var/lib/ambari-agent/cache/common-services/HDFS/2.1.0.2.0/package/scripts/setup_ranger_hdfs.py", line 68, in setup_ranger_hdfs
    component_user_keytab=params.nn_keytab if params.security_enabled else None)
  File "/usr/lib/python2.6/site-packages/resource_management/libraries/functions/setup_ranger_plugin_xml.py", line 103, in setup_ranger_plugin
    component_user_principal, component_user_keytab)
  File "/usr/lib/python2.6/site-packages/resource_management/libraries/functions/ranger_functions_v2.py", line 106, in create_ranger_repository
    response_code = self.check_ranger_login_urllib2(self.base_url)
  File "/usr/lib/python2.6/site-packages/resource_management/libraries/functions/decorator.py", line 82, in wrapper
    return function(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/resource_management/libraries/functions/ranger_functions_v2.py", line 208, in check_ranger_login_urllib2
    response = openurl(url, timeout=20)
  File "/usr/lib/python2.6/site-packages/ambari_commons/inet_utils.py", line 41, in openurl
    return urllib2.urlopen(url, timeout=timeout, *args, **kwargs)
  File "/usr/lib64/python2.6/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib64/python2.6/urllib2.py", line 383, in open
    protocol = req.get_type()
  File "/usr/lib64/python2.6/urllib2.py", line 244, in get_type
    raise ValueError, "unknown url type: %s" % self.__original
ValueError: unknown url type: {{policymgr_mgr_url}}
1 ACCEPTED SOLUTION

avatar
Cloudera Employee

Good morning @Bhavesh Vadaliya

From what I've seen, you can work around issues with {{policymgr_mgr_url}} by copying the Ranger's External URL field into these values. You may need to do this for all plugins reporting the issue.

View solution in original post

4 REPLIES 4

avatar
Cloudera Employee

Good morning @Bhavesh Vadaliya

From what I've seen, you can work around issues with {{policymgr_mgr_url}} by copying the Ranger's External URL field into these values. You may need to do this for all plugins reporting the issue.

avatar
Contributor

I had the similar problem with hive. It got resolved after

copying the Ranger's External URL field into

{{policymgr_mgr_url}} value in advance hive-site.xml.


Thank you so much

avatar
Contributor

Adding a bit of clarification to above mentioned solution. Find "Ranger External URL" in the field  Ranger > Configs > Advanced > Ranger Settings. It will be something like "http://<ranger_admin_host>:6080" . Copy this URL and update the particular service to which Ranger plugin is enabled. For example : If its HDFS, HDFS > Configs > Advanced > Advanced ranger-hdfs-security > ranger.plugin.hdfs.policy.rest.url. Usually this field should be auto populated by Ranger External URL value. If its not, it will be like "{{policy_mgr_url}}"Update this field by adding "Ranger External URL". Restart Ranger service, ranger KMS service and all required services. 

avatar
Explorer

Good Noon,

i have similar issue of Namenode not starting after enabling hdfs plugin in ranger. below is the error noticed.

Quick help would be much appreciated.

. Sleeping for 8 sec(s) 2018-06-14 11:13:40,182 - Will retry 30 time(s), caught exception: Connection failed to Ranger Admin. Http status code - 403. <HTML><HEAD> <TITLE>Access Denied</TITLE> </HEAD> <BODY> <FONT face="Helvetica"> <big><strong></strong></big><BR> </FONT> <blockquote> <TABLE border=0 cellPadding=1 width="80%"> <TR><TD> <FONT face="Helvetica"> <big>Access Denied (policy_denied)</big> <BR> <BR> </FONT> </TD></TR> <TR><TD> <FONT face="Helvetica"> Your system policy has denied access to the requested URL. </FONT> </TD></TR> <TR><TD> <FONT face="Helvetica">