Cloudera Hive傳統許可權管理設定

2021-08-02 09:08:59 字數 3458 閱讀 5134

step1:

新增jar包至

生產hive客戶端路徑/user/lib/hive

生產hive伺服器路徑/opt/cloudera/parcels/cdh/lib/hive/

step2:

admin使用者配置cm中hive元件中hive-site引數

<1> hive service advanced configuration snippet (safety valve) for hive-site.xml

name:hive.security.authorization.enabled    value:true

name:hive.security.authorization.createtable.owner.grants value:all

name:hive.security.authorization.task.factory value:org.apache.hadoop.hive.ql.parse.authorization.hiveauthorizationtaskfactoryimpl

name:hive.warehouse.subdir.inherit.perms value:true

name:hive.semantic.analyzer.hook vlaue:cn.jpush.hiveadmin

name:hive.metastore.authorization.storage.checks value:true

<2> hive client advanced configuration snippet (safety valve) for hive-site.xml

name:hive.security.authorization.enabled value:true

name:hive.security.authorization.createtable.owner.grants value:all

name:hive.security.authorization.task.factory value:org.apache.hadoop.hive.ql.parse.authorization.hiveauthorizationtaskfactoryimpl

name:hive.warehouse.subdir.inherit.perms value:true

name:hive.semantic.analyzer.hook vlaue:cn.jpush.hiveadmin

name:hive.metastore.authorization.storage.checks value:true

<4> hiveserver2 advanced configuration snippet (safety valve) for hive-site.xml

name:hive.semantic.analyzer.hook value:cn.jpush.hiveadmin

step3:

– <3.0>修改集群2臺namenode伺服器檔案 /etc/group,為所有使用者(除ronghui)新增到data組中。

– <3.1>為date組使用者新增kaikai庫的rwx許可權

– hdfs dfs -setfacl -m group:data:rwx /user/hive/warehouse/kaikai.db

– (刪除目前對partner組限定的facl許可權,775許可權,雖然其他組成員在hdfs有讀許可權,但是沒有寫入許可權,同時grant方式禁止partner組讀取data組的庫資料。)

– hdfs dfs -setfacl -b /user/hive/warehouse/sed.db

– <3.2>切換hdfs使用者修改/user/warehouse目錄下的檔案,都改為push使用者:data組,包含warehouse資料夾。

– 便於以後有了排程系統,直接刪除data組的大部分使用者,使用push使用者上線,將檔案都改為755許可權更安全。

– (/user/hive/external已經是push:data,所以不用管。)

– hdfs dfs -chown -r push:data /user/hive/warehouse

– hdfs dfs -chown -r push:data /user/hive/external

– 之後的管理員才能建立的新資料庫。因為hive預設是warehouse是hive:hive的user:group關係。

– hdfs dfs -chown -r push:data /user/hive/warehouse/tmp.db

– <3.3>繼續使用hdfs使用者修改許可權為775。

– hdfs dfs -chmod -r 775 /user/hive/warehouse/ads.db

step4:開始修改hive元資料。

hive -f grant_order.hql

ps:可以在hive元資料中檢視roles,dbs,db_privs,global_privs,role_map表看以上賦權命令對應的資料記錄資訊

hiveadmin class**

package cn.jpush;

/** * created by wmky_kk on 2017-06-01.

* add test

*/import org.apache.hadoop.hive.ql.parse.*;

import org.apache.hadoop.hive.ql.session.sessionstate;

public

class

hiveadmin

extends

abstractsemanticanalyzerhook ;

@override

public astnode preanalyze(hivesemanticanalyzerhookcontext context, astnode ast)throws semanticexception

if (!(admin[0].equalsignorecase(username)||admin[1].equalsignorecase(username)||

admin[2].equalsignorecase(username)||admin[3].equalsignorecase(username)))

break;

default:

break;

}return ast;

}/* public static void main(string args) throws semanticexception ;

string username = "root";

for (string tmp : admin)

}}*/

}

計權聲級(A計權,B計權與C計權)

由於人耳對不同頻率的聲音的感受能力不同,即相同聲壓級的聲音,人們會在聽覺上感到不同的響度。當需要客觀測量又要反映主觀響度感覺的方法來度量和評估實際的聲音強弱。國際標準為 iec61672 2014 由於a計權對描述人耳聽力相對於真實聲學的頻率響應最有意義,所以應用最為廣泛。但由於a計權僅適用於相對安...

嫡權法賦權法 賦權法

權重確定的主客觀賦權法 組員 餘芳雲 盧玲婕鍾靈歡 一 引言 在多屬性決策問題的求解過程中 屬性的權重具有舉足輕重的作用 它被用來反映屬性 的相對重要性。很多多屬性決策方法 如簡單加性加權法 topsis 法 多屬性效用理論 等都涉及到屬性權重 如何科學 合理地確定屬性權重 關係到多屬性決策結果的可...

嫡權法賦權法 賦權法

權重確定的主客觀賦權法 組員 餘芳雲1011200110 盧玲婕1011200147 鍾靈歡1011200148 一 引言 在多屬性決策問題的求解過程中,屬性的權重具有舉足輕重的作用,它被用來反映屬性的相對重要性。很多多屬性決策方法 如簡單加性加權法 topsis 法 多屬性效用理論等 都涉及到屬性...