【问题标题】:How to configure Hive warehouse path?如何配置 Hive 仓库路径?
【发布时间】:2014-11-08 00:42:07
【问题描述】:

我修改了这部分

<property>
  <name>hive.metastore.warehouse.dir</name>
  <value>/user/hive/warehouse</value>
  <description>location of default database for the warehouse</description>
</property>

hive-default.xml.template 的我自己的路径。运行 hive 时,如果我尝试创建一个表,它说它可以创建 file://mypath/etc.. 它仍在寻找/user/hive/warehouse。我做错什么了吗?我尝试创建 hive-site.xml,但它似乎也不起作用。

【问题讨论】:

    标签: hadoop hive hdfs


    【解决方案1】:

    修改hive-site.xml中的仓库路径如下:

    <property>
      <name>hive.metastore.warehouse.dir</name>
      <value>Your_Path_HERE</value>
      <description>location of default database for the warehouse</description>
    </property>
    

    如果&lt;Your_Path_HERE&gt;目录在本地系统上,则授予其权限

    sudo chown -R user <Your_Path_HERE>
    sudo chmod -R 777 <Your_Path_HERE>
    

    如果给定路径在 HDFS 上,则停止并启动 hadoop 服务

    stop-all.sh
    start-all.sh
    

    【讨论】:

    • 我正在使用 hdfs 路径。我已经配置了 hive-site.xml。我已授予 hdfs 路径的权限。我正在使用下面的代码 conf = SparkConf().setAppName("sample").setMaster("local") sc = SparkContext(conf = conf) sqlContext = HiveContext(sc) sqlContext.sql("show databases").show ()。我看不到 Hive 仓库中的数据库。
    • 创建配置单元上下文。 System.setProperty("hive.metastore.uris", "metastore 的 url"); val hiveContext = new HiveContext(sparkContext);
    【解决方案2】:

    你已经在hive-site.xml中指定了属性:

    <property>
      <name>hive.metastore.warehouse.dir</name>
      <value>/user/hivestore/warehouse </value>
    </property>
    

    修改后尝试通过退出并启动 hive-shell 重新加载 hive shell。

    此外,请确保使用 hive 的每个人都对上述属性中指定的目录具有适当的读/写权限

    【讨论】:

      猜你喜欢
      • 2019-06-11
      • 1970-01-01
      • 2018-02-13
      • 2016-04-17
      • 2018-05-29
      • 1970-01-01
      • 1970-01-01
      • 2021-09-01
      • 1970-01-01
      相关资源
      最近更新 更多