Support Questions

Find answers, ask questions, and share your expertise

can't install ranger

avatar
Explorer

[I] Patch 006-createdefaultpublicgroup.sql is being applied..

2018-08-25 21:48:33,172  [JISQL] /usr/bin/java  -cp /usr/hdp/current/ranger-admin/ews/lib/mysql-connector-java-5.1.25-bin.jar:/usr/hdp/current/ranger-admin/jisql/lib/* org.apache.util.sql.Jisql -driver mysqlconj -cstring jdbc:mysql://host/ranger -u 'rangeradmin' -p '********' -noheader -trim -c \; -input /usr/hdp/current/ranger-admin/db/mysql/patches/006-createdefaultpublicgroup.sql
Error executing: call insert_public_group_in_x_group_table(); 
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`ranger`.`x_group`, CONSTRAINT `x_group_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`))
SQLException : SQL state: 23000 com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`ranger`.`x_group`, CONSTRAINT `x_group_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`)) ErrorCode: 1452
2018-08-25 21:48:33,618  [JISQL] /usr/bin/java  -cp /usr/hdp/current/ranger-admin/ews/lib/mysql-connector-java-5.1.25-bin.jar:/usr/hdp/current/ranger-admin/jisql/lib/* org.apache.util.sql.Jisql -driver mysqlconj -cstring jdbc:mysql://xxx/ranger -u 'rangeradmin' -p '********' -noheader -trim -c \; -query "select version from x_db_version_h where version = '006' and active = 'Y';"
2018-08-25 21:48:34,038  [JISQL] /usr/bin/java  -cp /usr/hdp/current/ranger-admin/ews/lib/mysql-connector-java-5.1.25-bin.jar:/usr/hdp/current/ranger-admin/jisql/lib/* org.apache.util.sql.Jisql -driver mysqlconj -cstring jdbc:mysql://xxx/ranger -u 'rangeradmin' -p '********' -noheader -trim -c \; -query "delete from x_db_version_h where version='006' and active='N' and updated_by='xxx';"
2018-08-25 21:48:34,483  [E] 006-createdefaultpublicgroup.sql import failed!
1 ACCEPTED SOLUTION

avatar
Master Mentor

@li Hao

Can you try setting up a new database for Ranger? Here the assumption is the:

Root password is test2345

Ranger user, database and password is ranger

##################################################
# Create the ranger user and database schema.
##################################################
mysql -u root -ptest2345
create user 'ranger'@'localhost' identified by 'ranger';
grant all privileges on *.* to 'ranger'@'%';
grant all privileges on *.* to 'ranger'@'localhost';
grant all privileges on *.* to 'ranger'@'fqdn';
grant all privileges on *.* to 'ranger'@'fqdn' identified by 'ranger' with grant option;
grant all privileges on *.* to 'ranger'@'localhost' identified by 'ranger' with grant option;
flush privileges;
quit; 

Log on as user ranger

##################################################
# As ranger user create the database
##################################################
mysql -u ranger -pranger
Create database ranger;
quit;

Now get back to the Ambari UI and retry installing Ranger all should be fine. Remember to drop that old database after successfully configuring ranger.

HTH

View solution in original post

5 REPLIES 5

avatar
Explorer

ranger version 1.1.0

ambaris 2.7.0

hdp 3.0.0

avatar
Master Mentor

@li Hao

Can you try setting up a new database for Ranger? Here the assumption is the:

Root password is test2345

Ranger user, database and password is ranger

##################################################
# Create the ranger user and database schema.
##################################################
mysql -u root -ptest2345
create user 'ranger'@'localhost' identified by 'ranger';
grant all privileges on *.* to 'ranger'@'%';
grant all privileges on *.* to 'ranger'@'localhost';
grant all privileges on *.* to 'ranger'@'fqdn';
grant all privileges on *.* to 'ranger'@'fqdn' identified by 'ranger' with grant option;
grant all privileges on *.* to 'ranger'@'localhost' identified by 'ranger' with grant option;
flush privileges;
quit; 

Log on as user ranger

##################################################
# As ranger user create the database
##################################################
mysql -u ranger -pranger
Create database ranger;
quit;

Now get back to the Ambari UI and retry installing Ranger all should be fine. Remember to drop that old database after successfully configuring ranger.

HTH

avatar
Explorer

Thank you very much , btw does it must be a user named ranger

avatar
Master Mentor

@li Hao

Great it worked for you... NOT really you can use any name you wish I just used it for convenience to enable identification between the component users/databases.


avatar
Explorer

Hi , I have the same problem. Do you install hdp 3.0 with ranger successfully? It seems the table in the db [my db is mysql 5.7] has foreign key constraint.