You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

非Hadoop用户运行Hive报错,如何修改inode目录为/user/fratboy?

Fixing Hive Issues When Running as Non-Hadoop User

Hey there! Let's work through your Hive problems one by one—first that SLF4J warning, then configuring the correct HDFS directory for your fratboy user.

1. Resolve the SLF4J Multiple Bindings Warning

That warning pops up because both Hadoop and Hive include SLF4J logging implementations, and they're conflicting. It's mostly a nuisance, but fixing it will clean up your logs. Here's how:

  • Head to your Hive lib directory: /usr/local/hadoop/hive/lib
  • Move the conflicting log4j-slf4j-impl jar to a backup so it's no longer on the classpath:
    mv /usr/local/hadoop/hive/lib/log4j-slf4j-impl-2.6.2.jar /usr/local/hadoop/hive/lib/log4j-slf4j-impl-2.6.2.jar.bak
    

This removes Hive's SLF4J binding, letting Hadoop's take over (since they should be compatible).

2. Configure Hive to Use /user/fratboy as Its Base Directory

To stop Hive from trying to access root directories, you need to update its core configuration file (hive-site.xml). Here's the step-by-step:

Step 1: Edit hive-site.xml

Find the config file in your Hive conf directory (usually /usr/local/hadoop/hive/conf). Open it in a text editor and add or modify these properties:

<property>
  <name>hive.metastore.warehouse.dir</name>
  <value>hdfs://localhost:9000/user/fratboy/warehouse</value>
  <description>Location of default database for the warehouse</description>
</property>

<property>
  <name>hive.exec.scratchdir</name>
  <value>hdfs://localhost:9000/user/fratboy/hive/scratch</value>
  <description>Scratch space for Hive jobs</description>
</property>

(Note: Adjust the HDFS URL hdfs://localhost:9000 to match your cluster's actual address if needed.)

Step 2: Create and Set Permissions for HDFS Directories

Even though you've created /user/fratboy, Hive needs specific subdirectories. Run these commands as fratboy (or use sudo -u fratboy):

# Create required subdirectories
hdfs dfs -mkdir -p /user/fratboy/warehouse
hdfs dfs -mkdir -p /user/fratboy/hive/scratch

# Set ownership (already done for the parent, but double-check)
hdfs dfs -chown -R fratboy:fratboy /user/fratboy

# Set proper permissions
hdfs dfs -chmod -R 755 /user/fratboy/warehouse  # Read/write for owner, read for others
hdfs dfs -chmod -R 777 /user/fratboy/hive/scratch  # Temp dir needs universal write access

Step 3: Restart Hive (if running as a service)

If you have Hive services (like metastore) running, restart them to apply the new config. If you're just running the Hive CLI, close and reopen it.

Once you've done these steps, running Hive as fratboy should no longer try to access root directories, and that SLF4J warning should be gone!

内容的提问来源于stack exchange,提问作者Under Memphis

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 07:23:58