Aravindh Varadharaju created AMBARI-18106:
---------------------------------------------

             Summary: Service Check Fails for Hive when run through Ambari
                 Key: AMBARI-18106
                 URL: https://issues.apache.org/jira/browse/AMBARI-18106
             Project: Ambari
          Issue Type: Bug
          Components: ambari-agent
    Affects Versions: 2.2.2
            Reporter: Aravindh Varadharaju
            Priority: Minor


When I run Service Check for Hive through Actions Drop down, it fails with the 
error shown below:

  File 
"/var/lib/ambari-agent/cache/common-services/HIVE/0.12.0.2.0/package/alerts/alert_hive_metastore.py",
 line 190, in execute
    timeout=int(check_command_timeout) )
  File "/usr/lib/python2.6/site-packages/resource_management/core/base.py", 
line 154, in __init__
    self.env.run()
  File 
"/usr/lib/python2.6/site-packages/resource_management/core/environment.py", 
line 160, in run
    self.run_action(resource, action)
  File 
"/usr/lib/python2.6/site-packages/resource_management/core/environment.py", 
line 124, in run_action
    provider_action()
  File 
"/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py",
 line 238, in action_run
    tries=self.resource.tries, try_sleep=self.resource.try_sleep)
  File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", 
line 70, in inner
    result = function(command, **kwargs)
  File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", 
line 92, in checked_call
    tries=tries, try_sleep=try_sleep)
  File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", 
line 140, in _call_wrapper
    result = _call(command, **kwargs_copy)
  File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", 
line 291, in _call
    raise Fail(err_msg)
Fail: Execution of 'export 
HIVE_CONF_DIR='/usr/hdp/current/hive-metastore/conf/conf.server' ; hive 
--hiveconf hive.metastore.uris=thrift://hdfs10.internal.shutterfly.com:9083     
            --hiveconf hive.metastore.client.connect.retry.delay=1              
   --hiveconf hive.metastore.failure.retries=1                 --hiveconf 
hive.metastore.connect.retries=1                 --hiveconf 
hive.metastore.client.socket.timeout=14                 --hiveconf 
hive.execution.engine=mr -e 'show databases;'' returned 1. WARNING: Use "yarn 
jar" to launch YARN applications.
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /tmp/ambari-qa/hive.log (Permission denied)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:142)
        at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
        at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
        at 
org.apache.log4j.DailyRollingFileAppender.activateOptions(DailyRollingFileAppender.java:223)
        at 
org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
        at 
org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:172)
        at 
org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:104)
        at 
org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:842)
        at 
org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768)
        at 
org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648)
        at 
org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514)
        at 
org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:580)
        at 
org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:415)
        at 
org.apache.hadoop.hive.common.LogUtils.initHiveLog4jDefault(LogUtils.java:127)
        at 
org.apache.hadoop.hive.common.LogUtils.initHiveLog4jCommon(LogUtils.java:77)
        at 
org.apache.hadoop.hive.common.LogUtils.initHiveLog4j(LogUtils.java:58)
        at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:640)
        at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:624)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
log4j:ERROR Either File or DatePattern options are not set for appender [DRFA].

Logging initialized using configuration in 
file:/etc/hive/2.4.2.0-258/0/conf.server/hive-log4j.properties
Exception in thread "main" java.lang.RuntimeException: 
java.lang.RuntimeException: java.io.IOException: Permission denied
        at 
org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:503)
        at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:680)
        at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:624)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.lang.RuntimeException: java.io.IOException: Permission denied
        at 
org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:496)
        ... 8 more
Caused by: java.io.IOException: Permission denied
        at java.io.UnixFileSystem.createFileExclusively(Native Method)
        at java.io.File.createNewFile(File.java:1006)
        at java.io.File.createTempFile(File.java:1989)
        at 
org.apache.hadoop.hive.ql.session.SessionState.createTempFile(SessionState.java:820)
        at 
org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:494)
        ... 8 more
)

The issue gets fixed if I make a change in two places for "user" parameter in 
the file. By default the user is set to params.smokeuser. If I replace the 
parameter to params.hdfs_user, then the check passes.

/var/lib/ambari-agent/cache/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_service_check.py

    Execute(prepare_cmd,
            tries=3,
            user=params.hdfs_user,
            try_sleep=5,
            path=['/usr/sbin', '/usr/local/bin', '/bin', '/usr/bin', exec_path],
            logoutput=True)

    Execute(cleanup_cmd,
            tries=3,
            user=params.hdfs_user,
            try_sleep=5,
            path=['/usr/sbin', '/usr/local/bin', '/bin', '/usr/bin', exec_path],
            logoutput=True)

The same approach was followed in this patch: 
https://issues.apache.org/jira/browse/AMBARI-11305



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to