Page tree
Skip to end of metadata
Go to start of metadata


Since no released version of CDH supports the version of Apache Sentry that CDAP is integrating with, we cannot use Cloudera Manager to set up Sentry for testing. This page lists the steps to build Sentry from source and start the on a CDH cluster created using Coopr.


  1. git
  2. mvn

Setting up MySQL (Optional)

Create User

mysql> CREATE USER 'sentry'@'localhost' IDENTIFIED BY 'sentry';
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE DATABASE sentry_metastore;
Query OK, 1 row affected (0.00 sec)
mysql> GRANT ALL ON sentry_metastore.* TO 'sentry'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> exit


# mysql -usentry -hlocalhost -psentry
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.1.73-log Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use sentry_metastore;
Database changed


      1. Clone Apache Sentry source from
      2. There is a problem compiling the sentry-tests module right now, so comment it out temporarily from the root pom.xml until we find a fix
      3. mvn clean install -DskipTests will generate a sentry distribution under sentry-dist/target/apache-sentry-1.7.0-incubating-SNAPSHOT-bin/. Only takes a few mins.
      4. cd sentry-dist/target/apache-sentry-1.7.0-incubating-SNAPSHOT-bin/apache-sentry-1.7.0-incubating-SNAPSHOT-bin/
      5. Create a sentry-site.xml in the conf directory with the following contents. This is a bare-minimum sentry-site.xml without kerberos. 

        <?xml version="1.0"?>
        <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
      6. Set up the sentry policy store using a Derby DB

        bin/sentry --command schema-tool --conffile conf/sentry-site.xml --dbType derby --initSchema

        Or, for MySQL:

        bin/sentry --command schema-tool --conffile conf/sentry-site.xml --dbType mysql --initSchema --verbose

        Note: mysql jdbc driver jar should be in sentry/lib. Also, sentry does not accept a user without password for mysql (and perhaps postgresql etc)

      7. Start the sentry service 

        bin/sentry --command service --conffile conf/sentry-site.xml &> sentry-service.log &
      8. If you get the following error, it is because of an old metrics-core.jar in the hadoop classpath. If you see this, remove the file /usr/lib/hadoop-mapreduce/metrics-core-3.0.2.jar until we fix the error, and restart sentry using the above step. 

        Exception in thread "main" java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: com.codahale.metrics.JmxAttributeGauge.<init>(Ljavax/management/MBeanServerConnection;Ljavax/management/ObjectName;Ljava/lang/String;)V
        	at java.util.concurrent.FutureTask.get(
        	at org.apache.sentry.service.thrift.SentryService.waitOnFuture(
        	at org.apache.sentry.service.thrift.SentryService$
        	at org.apache.sentry.SentryMain.main(
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at sun.reflect.NativeMethodAccessorImpl.invoke(
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        	at java.lang.reflect.Method.invoke(
        	at org.apache.hadoop.util.RunJar.main(
        Caused by: java.lang.NoSuchMethodError: com.codahale.metrics.JmxAttributeGauge.<init>(Ljavax/management/MBeanServerConnection;Ljavax/management/ObjectName;Ljava/lang/String;)V
        	at com.codahale.metrics.jvm.BufferPoolMetricSet.getMetrics(
        	at org.apache.sentry.provider.db.service.thrift.SentryMetrics.registerMetricSet(
        	at org.apache.sentry.provider.db.service.thrift.SentryMetrics.<init>(
        	at org.apache.sentry.provider.db.service.thrift.SentryMetrics.getInstance(
        	at org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessor.initMetrics(
        	at org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessor.<init>(
        	at org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessorFactory.register(
        	at org.apache.sentry.service.thrift.SentryService.runServer(
        	at java.util.concurrent.ThreadPoolExecutor.runWorker(
        	at java.util.concurrent.ThreadPoolExecutor$

  • No labels