Ranger使用solrCloud存储审计日志
Ranger使用solrCloud存储审计日志
标签(空格分隔): Ranger
1, Zookeeper 搭建
1,忽略。默认已经搭建好zk 集群。
VECS17820:2181,VECS17821:2181,VECS17822:2181
2,SolrCloud模式安装(三台机器)
1,JDK,环境变量及 solr 用户默认已经建立,且安装包 及 log 等等目录均已赋权。
安装Solr 集群步骤:
1
solr@VECS017820:/app$ ll
total 412840
lrwxrwxrwx 1 root root 12 Oct 15 14:19 jdk -> jdk1.8.0_181
drwxr-xr-x 7 10 143 4096 Jul 7 2018 jdk1.8.0_181
drwxr-xr-x 9 root root 4096 Oct 16 17:16 ranger-2.0.0-admin
-rw-r--r-- 1 root root 250254688 Oct 17 11:05 ranger-2.0.0-admin.tar.gz
lrwxrwxrwx 1 solr solr 10 Oct 15 17:18 solr -> solr-7.7.2
drwxr-xr-x 9 solr solr 4096 May 28 23:38 solr-7.7.2
-rw-r--r-- 1 solr solr 172470530 Oct 15 17:14 solr-7.7.2.zip
lrwxrwxrwx 1 zookeeper zookeeper 16 Oct 15 14:22 zookeeper -> zookeeper-3.4.10
drwxr-xr-x 10 zookeeper zookeeper 4096 Mar 23 2017 zookeeper-3.4.10
其中solr 集群机器上(该节点)的ranger-2.0.0-admin 安装包为临时需要copy到此机器,并不是ranger-admin 节点。(后续步骤中会用到这个包的conf 目录)
2
修改每台机器的solr配置文件solr.in.sh(在solr 安装包的 bin 目录下,在修改后将solr 安装包及其所涉及的目录均赋给 solr 用户。)
SOLR_JAVA_MEM="-Xmx20g -Xms20g -Xmn5g -Xss256k -XX:MaxPermSize=384m -XX:SurvivorRatio=6 -XX:+UseParNewGC -XX:ParallelGCThreads=10 -XX:+UseConcMarkSweepGC -XX:ParallelCMSThreads=16 -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullC
ollection -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 -XX:CMSMaxAbortablePrecleanTime=500 -XX:CMSFullGCsBeforeCompaction=5 -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -verbose:gc -XX:+PrintG
CDateStamps -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:/app/solr/bin/gc-solr-`hostname`.log"
ZK_HOST="VECS17820:2181,VECS17821:2181,VECS17822:2181/ranger_audits"
3
在其中一台solr 集群节点上执行如下命令,用以在zookeeper上创建 ranger_audits 的chroot目录,该目录只需要创建一次
sudo su - solr
cd /app/solr-7.7.2
server/scripts/cloud-scripts/zkcli.sh -zkhost VECS17820:2181,VECS17821:2181,VECS17822:2181 -cmd makepath /ranger_audits
4启动三台solr集群节点(每台都执行)
sudo su - solr
cd /app/solr-7.7.2/bin
./solr start -c
5 创建名为ranger_audits的连接
注:手动解压安装包搭建solr集群模式,必须使用ranger中的solr配置项创建连接
cd /app/solr-7.7.2
bin/solr create_collection -c ranger_audits -d /app/ranger-2.0.0-admin/contrib/solr_for_audit_setup/conf -shards 3 -replicationFactor 2
上面命令执行时,会自动把默认配置集下的 conf 目录上传到zookeeper中并关联到默认的collection中。
3、Ranger-Admin配置
vim /app/ranger-2.0.0-admin/install.properties
#Source for Audit Store. Currently only solr is supported.
# * audit_store is solr
audit_store=solr
# * audit_solr_url URL to Solr. E.g. http://<solr_host>:6083/solr/ranger_audits
audit_solr_urls=http://VECS07820:8983/solr/ranger_audits
audit_solr_user=
audit_solr_password=
audit_solr_zookeepers=VECS17820:2181,VECS17821:2181,VECS17822:2181/ranger_audits
audit_solr_collection_name=ranger_audits
#solr Properties for cloud mode
audit_solr_config_name=ranger_audits
audit_solr_no_shards=3
audit_solr_no_replica=2
audit_solr_max_shards_per_node=1
audit_solr_acl_user_list_sasl=solr,infra-solr
在setup.sh 之后
/app/ranger/ews/webapp/WEB-INF/classes/conf/ranger-admin-site.xml
配置文件中将会加载 install.perproties 中的配置项。
ranger-admin-site.xml
<property>
<name>ranger.audit.solr.urls</name>
<value>http://VECS07820:8983/solr/ranger_audits</value>
<description />
</property>
<property>
<name>ranger.audit.solr.zookeepers</name>
<value>VECS07820:2181,VECS07821:2181,VECS07822:2181/ranger_audits</value>
<description />
</property>
、Ranger-Hbase-Plugin为例配置
vi ranger-2.0.0-hdfs-plugin/install.properties
XAAUDIT.SOLR.ENABLE=true
XAAUDIT.SOLR.ZOOKEEPER=VECS17820:2181,VECS17821:2181,VECS17822:2181/ranger_audits