前言
Apache Ranger是什么,它是一个为Hadoop平台提供了全面的数据安全访问控制及监控的集中式管理框架,Apache顶级项目。不废话了,其实本篇没那么高大上,就是一步步教你如何将Ranger源码导入到IDEA,并运行调试其web模块。
导入源码
- 第一步当然是下载源码,这里选用了最新版1.1.0
git clone https://github.com/apache/ranger.gitgit checkout release-ranger-1.1.0
- 编译,这里选择编译全部,当然也可以选择具体模块进行编译,耗时会比较长
mvn clean compile package install assembly:assembly
- 添加idea相关配置及依赖
mvn idea:idea
- 直接导入就行了,what?你不会连导入都不会吧
运行调试security-admin web模块
先初始化数据库,这里推荐选用MySQL,PostgreSQL我初始化的时候报了N多错,直接放弃了。
更改security-admin/src/main/resources/conf.dist/ranger-admin-site.xml
配置审计日志,没有装solr可以不用管
???<property> ???????<name>ranger.audit.solr.urls</name> ???????<value>http://localhost:6083/solr/ranger_audits</value> ???????<description></description> ???</property> ???<property> ???????<name>ranger.audit.source.type</name> ???????<value>solr</value> ???????<description></description> ???</property>
配置Ranger数据库及用户名密码
???<property> ???????<name>ranger.jpa.jdbc.url</name> ???????<value>jdbc:log4jdbc:mysql://localhost:3306/pranger3</value> ???????<description></description> ???</property> ???<property> ???????<name>ranger.jpa.jdbc.user</name> ???????<value>admin</value> ???????<description></description> ???</property> ???<property> ???????<name>ranger.jpa.jdbc.password</name> ???????<value>admin</value> ???????<description></description> ???</property>
配置web.xml
这里有二种方式:
第一种
security-admin/src/main/resources/conf.dist 设置为resources
目录
修改security-admin/src/main/webapp/WEB-INF/web.xml
?<context-param> ???<param-name>contextConfigLocation</param-name> ???<param-value>META-INF/applicationContext.xml ???????????WEB-INF/classes/security-applicationContext.xml ???????????META-INF/scheduler-applicationContext.xml</param-value> ?</context-param>
修改security-admin/src/main/webapp/META-INF/applicationContext.xml
???????<property name="locations"> ???????????<list> ???????????????<!-- <value>classpath:xa_default.properties</value> --> ???????????????<!-- <value>classpath:xa_system.properties</value> --> ???????????????<!-- <value>classpath:xa_custom.properties</value> --> ???????????????<!-- <value>classpath:xa_ldap.properties</value> --> ???????????????<value>classpath:core-site.xml</value> ???????????????<value>classpath:ranger-admin-default-site.xml</value> ???????????????<value>classpath:ranger-admin-site.xml</value> ???????????</list> ???????</property>
第二种只改配置文件
修改security-admin/src/main/webapp/WEB-INF/web.xml
?<context-param> ???<param-name>contextConfigLocation</param-name> ???<param-value>META-INF/applicationContext.xml ???????????WEB-INF/classes/conf.dist/security-applicationContext.xml ???????????META-INF/scheduler-applicationContext.xml</param-value> ?</context-param>
修改security-admin/src/main/webapp/META-INF/applicationContext.xml
???????<property name="locations"> ???????????<list> ???????????????<!-- <value>classpath:xa_default.properties</value> --> ???????????????<!-- <value>classpath:xa_system.properties</value> --> ???????????????<!-- <value>classpath:xa_custom.properties</value> --> ???????????????<!-- <value>classpath:xa_ldap.properties</value> --> ???????????????<value>classpath:conf.dist/core-site.xml</value> ???????????????<value>classpath:conf.dist/ranger-admin-default-site.xml</value> ???????????????<value>classpath:conf.dist/ranger-admin-site.xml</value> ???????????</list> ???????</property>
添加tomcat
然后就可以运行调试了,尽情的debug调试吧。
Apache Ranger 1.1.0源码导入IDEA并运行调试security-admin web模块
原文地址:https://www.cnblogs.com/d-homme/p/9433680.html