1、安装ranger admin
2、源码编译Ranger
wget https://www.apache.org/dist/ranger/2.4.0/apache-ranger-2.4.0.tar.gz
tar zxvf apache-ranger-2.4.0.tar.gz
cd apache-ranger-2.4.0
mvn -Pall clean
mvn clean package -DskipTests
maven settting可以设置阿里云进行资源下载加速
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>https://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
3、创建ranger用户
groupadd -g 1025 ranger
useradd -g ranger -u 1025 -d /home/ranger ranger
echo ranger:rangerpwd | chpasswd
mkdir -p /opt/ranger
su - ranger
4、配置install.properties文件
tar -zxvf ranger-2.4.0-admin.tar.gz
提前下载mysql connector:
wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.28/mysql-connector-java-8.0.28.jar
修改如下属性:
SQL_CONNECTOR_JAR=/opt/module/ranger/ranger-2.4.0-admin/mysql-connector-java-8.0.28.jar
db_root_user=root
db_root_password=root
db_host=localhost
db_name=ranger
db_user=rangeradmin
db_password=root
rangerAdmin_password=root
rangerTagsync_password=root
rangerUsersync_password=root
keyadmin_password=root
policymgr_external_url=http://localhost:6080
hadoop_conf=/BigData/run/hadoop/etc/hadoop
5、DB 权限处理
GRANT ALL PRIVILEGES ON *.* TO 'rangeradmin'@'tv3-hadoop-01' identified by 'root';
GRANT ALL PRIVILEGES ON *.* TO 'ranger'@'%' identified by 'root';
GRANT ALL PRIVILEGES ON *.* TO 'rangeradmin'@'%' identified by 'root';
GRANT ALL PRIVILEGES ON *.* TO 'ranger'@'localhost' identified by 'root';
GRANT ALL PRIVILEGES ON *.* TO 'rangeradmin'@'localhost' identified by 'root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
flush privileges;
6、初始化ranger admin
./setup.sh
相关报错:
2024-06-30 00:00:40,823 [I] Env filename : /etc/ranger/admin/conf/ranger-admin-env-logdir.sh
Traceback (most recent call last):
File "db_setup.py", line 1451, in <module>
main(sys.argv)
File "db_setup.py", line 1418, in main
run_env_file(env_file_path)
File "db_setup.py", line 163, in run_env_file
set_env_val(command)
File "db_setup.py", line 152, in set_env_val
(key, _, value) = line.partition("=")
TypeError: a bytes-like object is required, not 'str'
解决方案:
db_setup.py 152 行做下修改
#(key, _, value) = line.partition("=")
(key, _, value) = line.decode('ascii').partition("=")
显示内容包括下面的话代表安装成功:
Installation of Ranger PolicyManager Web Application is completed
7、进行环境软连接
[root@tv3-hadoop-01 ranger-2.4.0-admin]# ./set_globals.sh
usermod: no changes
[2024/06/30 00:04:39]: [I] Soft linking /etc/ranger/admin/conf to ews/webapp/WEB-INF/classes/conf
You have new mail in /var/spool/mail/root
8、服务启动
启动服务
sudo -i -u ranger ranger-admin start