메뉴 건너뛰기

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서비스 재시작
번호 제목 글쓴이 날짜 조회 수
697 ./gradlew :composeDown 및 ./gradlew :composeUp 를 성공했을때의 메세지 gooper 2023.02.20 6
696 [ftgo_application]Unable to infer base url오류 발생시 조치방법 gooper 2023.02.20 1072
695 [Impala TLS/SSL이슈]RangerAdminRESTClient.java:151] Failed to get response, Error is: TrustManager is not specified gooper 2023.02.02 105
694 [Kerberos]병렬 kinit 호출시 cache파일이 손상되어 Bad format in credentials cache 혹은 No credentials cache found 혹은 Internal credentials cache error 오류 발생시 gooper 2023.01.20 30
693 [HA구성 이슈]oozie 2대를 L4로 HA구성했을때 발생하는 이슈 gooper 2023.01.17 15
692 [Impala 3.2버젼]compute incremental stats db명.테이블명 수행시 ERROR: AnalysisException: Incremental stats size estimate exceeds 2000.00MB. 오류 발생원인및 조치방안 gooper 2022.11.30 694
691 [oozie]oozie ssh action으로 패스워드 없이 다른 서버에 ssh로그인 하여 shellscript호출하는 설정하는 방법 gooper 2022.11.10 23
690 kudu의 내부 table명 변경하는 방법 gooper 2022.11.10 18
689 kerberos연동된 CDH 6.3.4에서 default realm값이 잘못된 상태에서 서비스 기동시 오류 gooper 2022.10.14 33
688 [impala]쿼리 수행중 발생하는 오류(due to memory pressure: the memory usage of this transaction, Failed to write to server) gooper 2022.10.05 61
687 [Kerberos인증] /var/log/krb5kdc.log파일 기준으로 인증요청(AS), 티켓확인(TGS)이 진행되는 로그 기록 gooper 2022.09.21 36
686 Oracle 12c DB의 LOB타입 컬럼이 있는 테이블을 import할 때 주의 할 사항 gooper 2022.09.14 140
685 [kerberos]Kerberos HA구성 참고 페이지 gooper 2022.08.31 15
684 [CDP7.1.7]Impala Query의 Memory Spilled 양은 ScratchFileUsedBytes값을 누적해서 구할 수 있다. gooper 2022.07.29 28
683 [Kudu]Schema별 혹은 테이블별 사용량(Replica포함) 구하는 방법 gooper 2022.07.14 110
682 [Cloudera 6.3.4, Kudu]]Service Monitor에서 사용하는 metric중에 일부를 blacklist로 설정하여 모니터링 정보 수집 제외하는 방법 gooper 2022.07.08 31
681 small file 한개 파일로 만들기(text file 혹은 parquet file의 테이블) gooper 2022.07.04 72
680 javax.net.ssl.SSLHanshakeException: SSLHandshakeException invoking https://mainCluster.gooper.com:7183/api/v1/users: sun.security.validator.ValidatorException: No trusted certificate found gooper 2022.06.29 169
679 Cloudera Manager의 Java Heap Size변경하는 방법 gooper 2022.06.27 29
678 [Sentry] sentry메타 DB를 이용하여 테이블에 매핑되어 있는 role명칭 찾는 방법. gooper 2022.06.22 16

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.

위로