• 报错信息
    [ERROR] 2023-11-03 11:49:43.008 +0800 – execute sql error: Error while compiling statement: FAILED: SemanticException No valid privileges
    User hdfs does not have privileges for CREATETABLE
    The required privileges: Server=server1->URI=hdfs://nameservice1/user/hive/external/dim/dim_pub_material_price->action=*->grantOption=false;
    [ERROR] 2023-11-03 11:49:43.008 +0800 – sql task error
    org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: SemanticException No valid privileges
    User hdfs does not have privileges for CREATETABLE
  • 运行报错的语句
    drop table if exists dim.dim_pub_material_price;
    create external table dim.dim_pub_material_price
    (`material_price_code` string comment ‘物料价格唯一编码’,
    `company_code` string comment ‘公司编码’,
    `company_name_abbr` string comment ‘公司简称’,
    `customer_code` string comment ‘客户编码’,
    `customer_name_abbr` string comment ‘客户简称’,
    `product_type` string comment ‘产品类型’,
    `material_code` string comment ‘物料编码’,
    `material_name_abbr` string comment ‘物料简称’,
    `price_type` string comment ‘价格类型’,
    `material_price` decimal(38,2) comment ‘物料价格’,
    `currency_type` string comment ‘货币类型’,
    `start_time` string comment ‘有效期始’,
    `end_time` string comment ‘有效期止’,
    `create_time` string comment ‘创建日期’,
    `update_time` string comment ‘更新日期’,
    `etl_insert_time` date comment ‘etl处理时间’
    ) comment ‘物料价格表’
    partitioned by(
    `dt` string comment ‘日期分区YYYYMMDD’
    )
    row format delimited fields terminated by “\u0001”
    stored as textfile
    location “/user/hive/external/dim/dim_pub_material_price”
    ;
  • 登录hue的用户 hive / Fuda@2023
  • beeline
  • !connect jdbc:hive2://hadoopm02:10000/dim;principal=hive/hadoopm02@HADOOP.COM
  • 解决思路1:
    • external文件夹授予777权限,不再报错
  • [admin@hadoopm01 ~]$ kinit -kt /opt/kerberos_keytab/dolphinscheduler.keytab hdfs/hdfs
  • [admin@hadoopm01 ~]$ hadoop fs -chmod -R 777 /user/hive/external/
  • 解决思路2:
    • 利于hue上的’安全性‘设置,去授予相关的sentry访问权限

作者 admin

张宴银,大数据开发工程师

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注