Pre-creating Ranger DB Users with the DBA Setup Script
You can set up Ranger users using a Hortonworks custom database script. The purpose of this script is to set up database (DB) users in environments where there is a separate database administrator managing the databases, and you do not want to provide database admininstrator credentials to Ranger for creating the database users.
To pre-create Ranger DB users using the dba_script.py
script:
Download the Ranger rpm using the yum install command.
yum install ranger-admin
You should see one file named
dba_script.py
in the/usr/hdp/current/ranger-admin
directory.Execute the script by running the following command:
python dba_script.py
Pass all values required in the argument. These should include
db flavor
,JDBC jar
,db host
,db name
,db user
, and other parameters.Note If you would prefer not to pass runtime arguments, then simply update the
install.properties
file and then run thepython dba_script.py -q
. If you specify-q
in a given argument, then the script will read all required information from theinstall.properties
fileNote If you would prefer to review the DDL SQL statements in the
dba_script.py
before executing them, runpython dba_script.py -d <path to save sql file>
. The-d
option will save the SQL statements into the specified file. These statements can then be reviewed, customized by the DBA, and executed. If you use the-d
option, you must alter the users' default tablespace to the correct one by executing the following statements. Replace the user names and tablespace with your actual values.alter user ranger_admin_user default tablespace ranger_admin_db; alter user ranger_audit_user default tablespace ranger_audit_db;
Note | |
---|---|
If DB users are pre-created using the dba_script.py as described above, you must clear the Setup DB and DB user check box under “Advanced ranger-env” before proceeding with the installation. |