메뉴 건너뛰기

Bigdata, Semantic IoT, Hadoop, NoSQL

Bigdata, 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서비스 재시작
번호 제목 글쓴이 날짜 조회 수
399 insert hbase by hive ... error occured after 5 hours..HMaster가 뜨지 않는 장애에 대한 복구 방법 총관리자 2014.04.29 7129
398 oozie가 말하는 start시간은..서버에서 확인되는 시간이 아닙니다. 총관리자 2014.05.14 699
397 sqoop export/import등을 할때 driver를 못찾는 오류가 발생하면... 총관리자 2014.05.15 865
396 sqoop에서 oracle관련 작업할때 테이블명, 사용자명, DB명은 모두 대문자로 사용할것 총관리자 2014.05.15 1528
395 dual table만들기 총관리자 2014.05.16 824
394 특정파일이 생성되어야 action이 실행되는 oozie job만들기(coordinator.xml) 총관리자 2014.05.20 984
393 source의 type을 spooldir로 하는 경우 해당 경로에 파일이 들어오면 파일단위로 전송함 총관리자 2014.05.20 687
392 hive에서 insert overwrite directory.. 로 하면 default column구분자는 'SOH'혹은 't'가 됨 총관리자 2014.05.20 999
391 import 혹은 export할때 hive파일의 default 구분자는 --input-fields-terminated-by "x01"와 같이 지정해야함 총관리자 2014.05.20 4245
390 hiverserver2기동시 connection refused가 발생하는 경우 조치방법 총관리자 2014.05.22 1471
389 hive query에서 mapreduce돌리지 않고 select하는 방법 총관리자 2014.05.23 810
388 oozie의 meta정보를 mysql에서 관리하기 총관리자 2014.05.26 1466
387 hive job실행시 meta정보를 원격의 mysql에 저장하는 경우 설정방법 총관리자 2014.05.28 1088
386 hadoop및 ecosystem에서 사용되는 명령문 정리 총관리자 2014.05.28 3455
385 oozie job 구동시 JA009: User: hadoop is not allowed to impersonate hadoop 오류나는 경우 총관리자 2014.06.02 807
384 Cannot create /var/run/oozie/oozie.pid: Directory nonexistent오류 총관리자 2014.06.03 479
383 2개 data를 join하고 마지막으로 code정보를 join하여 결과를 얻는 mr 프로그램 총관리자 2014.06.30 408
382 banana pi에(lubuntu)에 hadoop설치하고 테스트하기 - 성공 file 총관리자 2014.07.05 2760
381 org.apache.hadoop.security.AccessControlException: Permission denied: user=hadoop, access=WRITE, inode="":root:supergroup:rwxr-xr-x 오류 처리방법 총관리자 2014.07.05 2834
380 access=WRITE, inode="staging":ubuntu:supergroup:rwxr-xr-x 오류 총관리자 2014.07.05 1719

A personal place to organize information learned during the development of such Hadoop, Hive, Hbase, Semantic IoT, etc.
We are open to the required minutes. Please send inquiries to gooper@gooper.com.

위로