一、添加 Sentry 时错误
WARNING: log4j.properties is not found. HADOOP_CONF_DIR may be incomplete.
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hive/beeline/BeeLine
at org.apache.sentry.cli.tools.SentrySchemaTool.runBeeLine(SentrySchemaTool.java:446)
at org.apache.sentry.cli.tools.SentrySchemaTool.runBeeLine(SentrySchemaTool.java:428)
at org.apache.sentry.cli.tools.SentrySchemaTool.doInit(SentrySchemaTool.java:349)
at org.apache.sentry.cli.tools.SentrySchemaTool.doInit(SentrySchemaTool.java:326)
at org.apache.sentry.cli.tools.SentrySchemaTool$CommandImpl.run(SentrySchemaTool.java:601)
at org.apache.sentry.SentryMain.main(SentryMain.java:120)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.run(RunJar.java:313)
at org.apache.hadoop.util.RunJar.main(RunJar.java:227)
Caused by: java.lang.ClassNotFoundException: org.apache.hive.beeline.BeeLine
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 12 more
二、回到主页启动 Sentry 报错
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
Exception in thread "main" java.lang.IllegalStateException: Could not create org.apache.sentry.provider.db.service.persistent.SentryStore
at org.apache.sentry.provider.db.service.persistent.SentryStoreFactory.create(SentryStoreFactory.java:61)
at org.apache.sentry.service.thrift.SentryService.<init>(SentryService.java:163)
at org.apache.sentry.service.thrift.SentryService$CommandImpl.run(SentryService.java:563)
at org.apache.sentry.SentryMain.main(SentryMain.java:120)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.run(RunJar.java:313)
at org.apache.hadoop.util.RunJar.main(RunJar.java:227)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.sentry.provider.db.service.persistent.SentryStoreFactory.create(SentryStoreFactory.java:45)
... 9 more
Caused by: org.apache.sentry.core.common.exception.SentryNoSuchObjectException: Matching Version doesn't exist
at org.apache.sentry.provider.db.service.persistent.SentryStore.lambda$getMSentryVersion$43(SentryStore.java:2712)
at org.apache.sentry.provider.db.service.persistent.TransactionManager.executeTransaction(TransactionManager.java:123)
at org.apache.sentry.provider.db.service.persistent.SentryStore.getMSentryVersion(SentryStore.java:2703)
at org.apache.sentry.provider.db.service.persistent.SentryStore.getSentryVersion(SentryStore.java:2676)
at org.apache.sentry.provider.db.service.persistent.SentryStore.verifySentryStoreSchema(SentryStore.java:310)
at org.apache.sentry.provider.db.service.persistent.SentryStore.<init>(SentryStore.java:283)
... 14 more
以上的错误看似 mysql 的 jar 包有问题,但这里并不是,因为 CDH 其他服务也会依赖这个 mysql-connector-java.jar ,所以不会是它的问题
三、修改 sentry-site.xml
3.1 加入配置
<property>
<name>sentry.verify.schema.version</name>
<value>false</value>
</property>