开源大数据集群部署(十二)Ranger集成hive

云的事随心讲 2024-02-28 18:08:11

作者:櫰木

1、解压安装

在hd1.dtstack.com主机上执行(一般选择hiveserver2节点)

解压ranger-2.3.0-hive-plugin.tar.gz[root@hd1.dtstack.com software]#tar -zxvf ranger-2.3.0-hive-plugin.tar.gz修改install.properties配置[root@hd1.dtstack.com ranger-2.3.0-hive-plugin]# vim install.propertiesPOLICY_MGR_URL=http://hd1.dtstack.com:6080/REPOSITORY_NAME=hivedevCOMPONENT_INSTALL_DIR_NAME=/opt/hiveXAAUDIT.SOLR.ENABLE=trueXAAUDIT.SOLR.URL=http://hd1.dtstack.com:8983/solr/ranger_auditsXAAUDIT.SOLR.USER=NONEXAAUDIT.SOLR.PASSWORD=NONEXAAUDIT.SOLR.ZOOKEEPER=hd1:2181,hd2:2181,hd3:2181/ranger_auditsXAAUDIT.SOLR.FILE_SPOOL_DIR=/var/log/hive/audit/solr/spoolXAAUDIT.ELASTICSEARCH.ENABLE=falseXAAUDIT.ELASTICSEARCH.URL=NONEXAAUDIT.ELASTICSEARCH.USER=NONEXAAUDIT.ELASTICSEARCH.PASSWORD=NONEXAAUDIT.ELASTICSEARCH.INDEX=NONEXAAUDIT.ELASTICSEARCH.PORT=NONEXAAUDIT.ELASTICSEARCH.PROTOCOL=NONEXAAUDIT.HDFS.ENABLE=falseXAAUDIT.HDFS.HDFS_DIR=hdfs://__REPLACE__NAME_NODE_HOST:8020/ranger/auditXAAUDIT.HDFS.FILE_SPOOL_DIR=/var/log/hive/audit/hdfs/spoolXAAUDIT.HDFS.AZURE_ACCOUNTNAME=__REPLACE_AZURE_ACCOUNT_NAMEXAAUDIT.HDFS.AZURE_ACCOUNTKEY=__REPLACE_AZURE_ACCOUNT_KEYXAAUDIT.HDFS.AZURE_SHELL_KEY_PROVIDER=__REPLACE_AZURE_SHELL_KEY_PROVIDERXAAUDIT.HDFS.AZURE_ACCOUNTKEY_PROVIDER=__REPLACE_AZURE_ACCOUNT_KEY_PROVIDERXAAUDIT.LOG4J.ENABLE=falseXAAUDIT.LOG4J.IS_ASYNC=falseXAAUDIT.LOG4J.ASYNC.MAX.QUEUE.SIZE=10240XAAUDIT.LOG4J.ASYNC.MAX.FLUSH.INTERVAL.MS=30000XAAUDIT.LOG4J.DESTINATION.LOG4J=trueXAAUDIT.LOG4J.DESTINATION.LOG4J.LOGGER=xaauditXAAUDIT.AMAZON_CLOUDWATCH.ENABLE=falseXAAUDIT.AMAZON_CLOUDWATCH.LOG_GROUP=NONEXAAUDIT.AMAZON_CLOUDWATCH.LOG_STREAM_PREFIX=NONEXAAUDIT.AMAZON_CLOUDWATCH.FILE_SPOOL_DIR=NONEXAAUDIT.AMAZON_CLOUDWATCH.REGION=NONEXAAUDIT.HDFS.IS_ENABLED=falseXAAUDIT.HDFS.DESTINATION_DIRECTORY=hdfs://__REPLACE__NAME_NODE_HOST:8020/ranger/audit/%app-type%/%time:yyyyMMdd%XAAUDIT.HDFS.LOCAL_BUFFER_DIRECTORY=__REPLACE__LOG_DIR/hive/audit/%app-type%XAAUDIT.HDFS.LOCAL_ARCHIVE_DIRECTORY=__REPLACE__LOG_DIR/hive/audit/archive/%app-type%XAAUDIT.HDFS.DESTINTATION_FILE=%hostname%-audit.logXAAUDIT.HDFS.DESTINTATION_FLUSH_INTERVAL_SECONDS=900XAAUDIT.HDFS.DESTINTATION_ROLLOVER_INTERVAL_SECONDS=86400XAAUDIT.HDFS.DESTINTATION_OPEN_RETRY_INTERVAL_SECONDS=60XAAUDIT.HDFS.LOCAL_BUFFER_FILE=%time:yyyyMMdd-HHmm.ss%.logXAAUDIT.HDFS.LOCAL_BUFFER_FLUSH_INTERVAL_SECONDS=60XAAUDIT.HDFS.LOCAL_BUFFER_ROLLOVER_INTERVAL_SECONDS=600XAAUDIT.HDFS.LOCAL_ARCHIVE_MAX_FILE_COUNT=10XAAUDIT.SOLR.IS_ENABLED=falseXAAUDIT.SOLR.MAX_QUEUE_SIZE=1XAAUDIT.SOLR.MAX_FLUSH_INTERVAL_MS=1000XAAUDIT.SOLR.SOLR_URL=http://localhost:6083/solr/ranger_auditsSSL_KEYSTORE_FILE_PATH=/etc/hive/conf/ranger-plugin-keystore.jksSSL_KEYSTORE_PASSWORD=myKeyFilePasswordSSL_TRUSTSTORE_FILE_PATH=/etc/hive/conf/ranger-plugin-truststore.jksSSL_TRUSTSTORE_PASSWORD=changeitUPDATE_XAPOLICIES_ON_GRANT_REVOKE=trueCUSTOM_USER=hiveCUSTOM_GROUP=hadoop2、hive初始化[root@hd3.dtstack.com ranger-2.0.0-hive-plugin]# ./enable-hive-plugin.sh

初始化完成后会在/opt/apache-hive-3.1.2-bin/conf目录下生成5个文件

hiveserver2-site.xml文件内容如下:

[root@hd3.dtstack.com conf]# cat hiveserver2-site.xml<?xml version="1.0" encoding="UTF-8" standalone="no"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!--Licensed to the Apache Software Foundation (ASF) under one or morecontributor license agreements. See the NOTICE file distributed withthis work for additional information regarding copyright ownership.The ASF licenses this file to You under the Apache License, Version 2.0(the "License"); you may not use this file except in compliance withthe License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.--><configuration><property><name>hive.security.authorization.enabled</name><value>true</value></property><property><name>hive.security.authorization.manager</name><value>org.apache.ranger.authorization.hive.authorizer.RangerHiveAuthorizerFactory</value></property><property><name>hive.security.authenticator.manager</name><value>org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator</value></property><property><name>hive.conf.restricted.list</name><value>hive.security.authorization.enabled,hive.security.authorization.manager,hive.security.authenticator.manager</value></property></configuration>3、hive 重启[root@hd3.dtstack.com apache-hive-3.1.2-bin]# sh stop.sh[root@hd3.dtstack.com apache-hive-3.1.2-bin]# sh start.sh[root@hadoop05 apache-hive-3.1.2-bin]# sh stop.sh[root@hadoop05 apache-hive-3.1.2-bin]# sh start.sh4、ranger admin页面配置

访问地址:http://hd2.dtstack.com:6080/用户密码:admin/rangerAdmin123

参数配置说明:

jdbc.driverClassName:org.apache.hive.jdbc.HiveDriverjdbc.url :jdbc:hive2://172.16.107.127:10000/default;principal=hive/hd3.dtstack.com@DTSTACK.COMAdd New Configurations:tag.download.auth.users:hive,hdfs,impala,rangerlookuppolicy.download.auth.users:hive,hdfs,impala,rangerlookuppolicy.grantrevoke.auth.users:hive,hdfs,impala,rangerlookupenable.hive.metastore.lookup:truedefault.policy.users:hive,hdfs,impala,rangerlookuphive.site.file.path:/opt/apache-hive-3.1.2-bin/conf/hive-site.xml

点击测试连接,连接成功后保存即可。

至此,ranger hive权限配置完成。

更多技术信息请查看云掣官网

0 阅读:1

云的事随心讲

简介:感谢大家的关注