87530399 2017-09-15
选择安装hive的节点进行安装测试:
yum install sentry* -y 以下三个组件会进行安装 sentry:sentry的基本包 sentry-hdfs-plugin:hdfs插件 sentry-store:sentry store组件
<property> <name>sentry.service.server.rpc-address</name> <value>HOSTNAME</value> </property> <property> <name>sentry.service.server.rpc-port</name> <value>8038</value> </property> <property> <name>sentry.service.admin.group</name> <value>hive,impala,hue,hdfs</value> </property> <property> <name>sentry.service.allow.connect</name> <value>hive,impala,hue,hdfs</value> </property> <property> <name>sentry.store.group.mapping</name> <value>org.apache.sentry.provider.common.HadoopGroupMappingService</value> </property> <property> <name>sentry.service.reporting</name> <value>JMX</value> </property> <property> <name>sentry.service.web.enable</name> <value>true</value> </property> <property> <name>sentry.service.web.port</name> <value>51000</value> </property> <property> <name>sentry.service.web.authentication.type</name> <value>NONE</value> </property> <property> <name>sentry.verify.schema.version</name> <value>true</value> </property>
由于未配置kerberos,添加以下配置
<property> <name>sentry.service.security.mode</name> <value>none</value> </property>
sentry store可以使用两种方式,如果使用database-backed 的方式(还有一种policy files方式),则需要设置jdbc相关的参数,本文默认为这种方式:
<property> <name>sentry.store.jdbc.url</name> <value>jdbc:<JDBC connectionURLforbackenddatabase></value> </property> <property> <name>sentry.store.jdbc.driver</name> <value><JDBCDriverclassforbackenddatabase></value> </property> <property> <name>sentry.store.jdbc.user</name> <value><UserIDforbackenddatabaseuser></value> </property> <property> <name>sentry.store.jdbc.password</name> <value><Passwordforbackenddatabaseuser></value> </property>
这里使用mysql数据库作为sentry store。进入mysql数据库后创建步骤如下:
Create Database sentry; Create User sentry Identified By 'sentry'; Grant All On sentry.* To sentry@'localhost' Identified By 'sentry'; Grant All On sentry.* To sentry@'%' Identified By 'sentry'; flush privileges;
yum install mysql-connector-java cp /usr/share/java/mysql-connector-java.jar /usr/lib/sentry/lib/
sentry --command schema-tool --conffile /etc/sentry/conf/sentry-site.xml --dbType mysql --initSchema 显示以下信息表面连接并初始化成功 ...... Initialization script completed Sentry schemaTool completed
/etc/init.d/sentry-store start
查看sentry的web界面http://hostname:51000/。