메뉴 건너뛰기

Cloudera, BigData, Semantic IoT, Hadoop, NoSQL

Cloudera CDH/CDP 및 Hadoop EcoSystem, Semantic IoT등의 개발/운영 기술을 정리합니다. gooper@gooper.com로 문의 주세요.


--테이블 사용자 추가시 모든 노드에 반드시 추가해 줄것...
* 참조 : https://www.cloudera.com/documentation/enterprise/5-13-x/topics/sg_sentry_service_config.html#xd_583c10bfdbd326ba--69adf108-1492ec0ce48--7dbd

0.각노드에 사용자 추가및 패스워드 설정, hive그룹추가
useradd hadmin
passwd hadmin

0-1. hue에서 admin/admin으로 로그인후 관리자로 사용할 사용자를 등록(예, hadmin, 슈퍼어드민으로 설정)한다.
0-2. beeline으로 로그인하여
beeline
!connect jdbc:hive2://xxx.xxx.xxx.xxx:10000/
username:hive
password:hive
0-3. beeline에서 admin-role생성
create role admin_role;
grant all on server server1 to role admin_role;
grant role admin_role to group hadmin;

-----------------------------HDFS상의 권한 설정(771, hive:hive)-----------------------
hive의 default warehouse디렉토리인 /user/hive/warehouse 혹은 hive-site.xml에서 hive.metastore.warehouse.dir로 지정한 HDFS위치는 hive user와 hive group을 가져야 하며(예, hive:hive) 해당 디렉토리내의 모든 파일과 디렉토리 그리고 하위 디렉토리와 파일은 모두 hive:hive로 설정되어야한다.
 가. sudo -u hdfs hdfs dfs -chmod -R 771 /user/hive/warehouse
 나. sudo -u hdfs hdfs dfs -chown -R hive:hive /user/hive/warehosue
)
혹은 hive가 다른 디렉토리를 사용한다면 해당 디렉토리는 771로 설정하고 소유:그룹은 hive:hive로 맞춰줘야한다.


--------------------hue user추가및 role권한 부여-----
-1. YARN에서 최소 사용자 ID(min.user.id)를 1000에서 0으로 변경 (MapReduce job을 submit할 수 있게함)
 
0. Cloudera Manager에서 
가. Hue -> Sentry서비스 -> Sentry 선택
나. Hive -> Sentry서비스 -> Sentry 선택
다. Impala -> Sentry 서비스 -> Sentry 선택

1. 모든 노드에 linux user생성및 hive 그룹부여
useradd shd001
passwd shd001
usermod -aG hive,spark shd001

* SpaceQuota설정 : HDFS home및 hive영역에 대한 쿼터 설정을 수행한다.
   (150G로 설정하면 3X replica의 경우 50G까지의 파일 저장이 가능함)
 -> sudo -u hdfs kinit -kt /var/lib/keytab/hdfs.keytab hdfs   (Kerberos설정된 경우에 수행)
 -> sudo -u hdfs hdfs dfsadmin -setSpaceQuota 150G /user/shd001     (shd001 HDFS폴더에 spacequota를 지정하는 경우)
 -> sudo -u hdfs hdfs dfsadmin -setSpaceQuota 150G /user/hive/warehouse/prj001db.db   (prj001db에 spacequota를 지정하는 경우)
(참고 : prj001db에 할당된 quota를 확인하는 방법 : sudo -u hdfs hdfs dfs -count -q -v /user/hive/warehosue/prj001db.db)


* hdfs의 home위치는 group을 hdfs로 변경함 (예, shd001사용자인 경우 sudo -u hdfs hdfs dfs -chown shd001:hdfs /user/shd001를 수행한다)
  (group을 hive로 변경하면 다른 계정에서 서로 폴더를 볼수 있게되므로.. hive가 아닌 hdfs로 그룹명을 준다)

2. hue user생성
hue admin 계정으로 접속해서 사용자 추가
linux user와 똑같이 생성

3. user용DB및 HDFS경로에 대한 role생성(hive query사용)및 부여
create database prj001db;

create role shd001_role;
grant all on database prj001db to role shd001_role;
grant role shd001_role to group shd001;

create role shd001_uri_all_role;
grant all on uri 'hdfs://nameservice/user/shd001' to role shd001_uri_all_role;
grant role shd001_uri_all_role to group shd001;


-------------sentry설정시 설정해야 하는 값--------------------------------------
0. YARN서비스에서
가. 최소사용자ID(min.user.id)값을 1000에서 0으로 변경
나. allowed.system.users에 hive추가

0-1. Hive서비스에서
가. Hive Metastore Access Control and Proxy User Groups Override(hadoop.proxyuser.hive.groups)에 hive, hue, sentry추가

1. Hive서비스에서
HiveServer2 Enable Impersonation
hive.server2.enable.impersonation, hive.server2.enable.doAs 은 false로 해야함

2. Sentry서비스에서
Sentry Service Advanced Configuration Snippet (Safety Valve) for sentry-site.xml 
sentry.hive.testing.mode 를 true로 등록

2-1. sentry-site.xml에 대한 Sentry 클라이언트 고급 구성 스니펫(안전 밸브)에 
(Sentry Client Advanced Configuration Snippet(Safety Valve) for sentry-site.xml
sentry.hive.testing.mode 를 true로 등록

2-1. Sentry서비스에서
Admin Groups(sentry.service.admin.group)에 관리자 id(예, hadmin)을 추가함
Allowed Conneting Users(sentry.service.allow.connect)에 관리자 id(예, hadmin)을 추가하고
hive, impala,hue,spark그룹이 지정되어 있는지 확인후 지정되지 않았으면 추가해준다.


3. Hive서비스에서
Hive Service Advanced Configuration Snippet (Safety Valve) for hive-site.xml
- sentry.hive.testing.mode 를 true로 설정
- hive.server2.authorization.external.exec를 true로 설정
- hive.security.authorization.enabled를 false로 설정

4. Hive서비스의 HiveServer2인스턴스에서
HiveServer2 Advanced Configuration Snippet (Safety Valve) for hive-site.xml
sentry.hive.testing.mode 를 true로 설정

5. Hive서비스에서
- Hive Service Advanced Configuration Snippet (Safety Valve) for sentry-site.xml
sentry.hive.testing.mode 를 true로 설정

- Hive Warehouse Subdirectories Inherit Permissions(hive.warehouse.subdir.inerit.perms)에 체크하여 활성화

6. Hive서비스에서 
Enable Stored Notifications in Database을 체크하여 활성화

6-1. Hive Metastore Server에서
Enable Stored Notifications in Database를 체크하여 활성화

7. HDFS에서 
 - Enable Sentry Synchronization에서 HDFS체크하여 활성화
 - Enable Access Control Lists에서 HDFS를 체크하여 활성화 (체크하지 않으면 : HDFS Access Control lists must be enabled(dfs.namenode.acls.enabled이라는 메세지 발생)

 - Check HDFS Permissions을 체크하여 enable시킴
 - Select Enable Sentry Synchronization을 체크하여 enable시킴
 - Sentry Synchronization Path Prefixes(sentry.hdfs.integration.path.prefixes)에 /user/hive/warehouse에 추가하여 /user경로도 추가해준다.(그래야 두군데다 권한통제가됨)


8. hdfs, hive및 sentry서비스 재시작
번호 제목 날짜 조회 수
181 [DBeaver 4.3.0]import/export시 "Client home is not specified for connection" 오류발생시 조치사항 2017.12.21 884
» sentry설정 방법및 활성화시 설정이 필요한 파일및 설정값, 계정생성 방법 2018.08.16 891
179 hive테이블의 물리적인 위치인 HDFS에 여러개의 데이터 파일이 존재할때 한개의 파일로 merge하여 동일한 테이블에 입력하는 방법 2019.05.23 896
178 hive query에서 mapreduce돌리지 않고 select하는 방법 2014.05.23 897
177 [shellscript]엑셀파일에서 여러줄에 존재하는 단어를 한줄의 문자열로 합치는 방법(comma로 구분) 2019.07.15 897
176 [Mybatis]Spring과 연동하지 않고 Java+Mybatis 형태의 프로그램 샘플소스 2016.09.01 935
175 oozie job 구동시 JA009: User: hadoop is not allowed to impersonate hadoop 오류나는 경우 2014.06.02 939
174 oracle to hive data type정리표 2018.08.22 939
173 sqoop export/import등을 할때 driver를 못찾는 오류가 발생하면... 2014.05.15 940
172 ubuntu에 maven 3.6.1설치 및 환경변수 설정 2019.06.02 947
171 mongodb aggregation query를 Java code로 변환한 샘플 2016.12.15 958
170 [SBT] SBT 사용법 정리(링크) 2016.08.04 959
169 원격 리포지토리에서 최초 clone시 Permission denied (publickey). 오류발생시 조치사항 2017.06.20 961
168 Hive JDBC Connection과 유형별 에러및 필요한 jar파일 2021.05.24 961
167 [Kerberos]Kerberos상태의 클러스터에 JDBC로 접근할때 케이스별 오류내용 2020.02.14 973
166 hadoop cluster에 포함된 노드중에서 문제있는 decommission하는 방법및 절차 file 2017.12.28 996
165 solr 6.2에 한글 형태소 분석기(arirang 6.x) 적용 및 테스트 file 2017.06.27 1008
164 하둡 분산 파일 시스템을 기반으로 색인하고 검색하기 2014.09.25 1016
163 update 샘플 2018.03.12 1030
162 column family삭제시 Column family 'delete' does not exist오류 발생하는 경우 2014.04.14 1032
위로