You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ranger.apache.org by Lune Silver <lu...@gmail.com> on 2016/05/10 08:36:17 UTC

Installing Ranger Admin with Ambari 2.2.1 failed - SQLException : SQL state: 3F000 org.postgresql.util.PSQLException: ERROR: no schema has been selected to create in ErrorCode: 0

Hello !

I'm trying to install Ranger Admin with Ambari 2.2.1 and I got the
following exception during the installation :
###

2016-05-10 10:25:47,952 - Execute['python
/usr/hdp/current/ranger-admin/db_setup.py'] {'logoutput': True,
'environment': {'RANGER_ADMIN_HOME': '/usr/hdp/current/ranger-admin',
'JAVA_HOME': '/usr/lib/jvm/jre-1.7.0-openjdk.x86_64'}, 'user':
'ranger'}
2016-05-10 10:25:48,081  [I] DB FLAVOR :POSTGRES
2016-05-10 10:25:48,081  [I] --------- Verifying Ranger DB connection ---------
2016-05-10 10:25:48,081  [I] Checking connection
2016-05-10 10:25:48,332  [I] connection success
2016-05-10 10:25:48,332  [I] --------- Verifying Ranger DB tables ---------
2016-05-10 10:25:48,332  [I] Verifying table x_portal_user in database ranger
2016-05-10 10:25:48,583  [I] Table x_portal_user already exists in
database ranger
2016-05-10 10:25:48,583  [I] --------- Verifying upgrade history table ---------
2016-05-10 10:25:48,583  [I] Verifying table x_db_version_h in database ranger
2016-05-10 10:25:48,834  [I] Table x_db_version_h already exists in
database ranger
2016-05-10 10:25:48,834  [I] --------- Applying Ranger DB patches ---------
2016-05-10 10:25:48,834  [I] No patches to apply!
2016-05-10 10:25:48,835  [I] --------- Starting Audit Operation ---------
2016-05-10 10:25:48,835  [I] --------- Check admin user connection ---------
2016-05-10 10:25:48,835  [I] Checking connection
2016-05-10 10:25:49,080  [I] connection success
2016-05-10 10:25:49,081  [I] --------- Check audit user connection ---------
2016-05-10 10:25:49,081  [I] Checking connection
2016-05-10 10:25:49,327  [I] connection success
2016-05-10 10:25:49,327  [I] --------- Check table ---------
2016-05-10 10:25:49,327  [I] Verifying table xa_access_audit in database audit
2016-05-10 10:25:49,575  [I] Table xa_access_audit does not exist in
database audit
2016-05-10 10:25:49,576  [I] Importing db schema to database audit
from file: xa_audit_db_postgres.sql
SQLException : SQL state: 3F000 org.postgresql.util.PSQLException:
ERROR: no schema has been selected to create in ErrorCode: 0
SQLException : SQL state: 3F000 org.postgresql.util.PSQLException:
ERROR: no schema has been selected to create in ErrorCode: 0
2016-05-10 10:25:49,813  [E] xa_audit_db_postgres.sql DB schema import failed!

###

I tried to find the file xa_audit_db_postgres.sql on the future ranger host
and on the ambari-server without success.

Concerning my configuration, I specified to create DB and users to ranger.
I set up the following parameter to No.

Setup Database and Database User

No

Because I already created the database and the database users and properly
configured the connection of the users through the pg_hba.conf.

Do you know what is the problem here ?

Best regards.

Lune.

Re: Installing Ranger Admin with Ambari 2.2.1 failed - SQLException : SQL state: 3F000 org.postgresql.util.PSQLException: ERROR: no schema has been selected to create in ErrorCode: 0

Posted by Lune Silver <lu...@gmail.com>.
Re.

I tried to debug a little bit and find the command which was launched :
###
java -cp
/usr/share/java/postgresql.jar:/usr/hdp/2.3.2.0-2950/ranger-admin/jisql/lib/*
org.apache.util.sql.Jisql -driver postgresql -cstring jdbc:postgresql://
inbdfrg01.rouen.francetelecom.fr/audit -u ranger_audit -p <MDP> -noheader
-trim -c \; -input
/usr/hdp/current/ranger-admin/db/postgres/xa_audit_db_postgres.sql
###

And when I launched it manually by using the ranger_audit user (the owner
of the audit database), it worked fine.
But then by beginning again the installation of ranger admin, a new error
appears :
###

2016-05-10 11:08:00,381  [I] --------- Check table ---------
2016-05-10 11:08:00,381  [I] Verifying table xa_access_audit in database audit
2016-05-10 11:08:00,633  [I] Table xa_access_audit already exists in
database audit
2016-05-10 11:08:00,633  [I] Granting permission to ranger_audit
2016-05-10 11:08:00,633  [I] Granting select and usage privileges to
Postgres audit user 'ranger_audit' on XA_ACCESS_AUDIT_SEQ
SQLException : SQL state: 42P01 org.postgresql.util.PSQLException:
ERROR: relation "xa_access_audit_seq" does not exist ErrorCode: 0
SQLException : SQL state: 42P01 org.postgresql.util.PSQLException:
ERROR: relation "xa_access_audit_seq" does not exist ErrorCode: 0
2016-05-10 11:08:00,871  [E] Granting select privileges to Postgres
user 'ranger_audit' failed

###

And when I check if this sequence exists, it exists indeed in the audit db :
###
audit=# \dp
                                         Access privileges
 Schema |        Name         |   Type   |       Access privileges       |
Column access privileges
--------+---------------------+----------+-------------------------------+--------------------------
 public | pg_stat_statements  | view     | postgres=arwdDxt/postgres    +|
        |                     |          | ranger_audit=arwdDxt/postgres  +|
        |                     |          | =r/postgres                   |
 public | xa_access_audit     | table    |
ranger_audit=arwdDxt/ranger_audit+|
 public | xa_access_audit_seq | sequence | ranger_audit=rwU/ranger_audit
+|
###

I'm wondering, which user does ranger used perform this query ? The
ranger_admin user or the ranger_audit user ?
Maybe I should make the ranger_admin the owner of the audit database ?
Maybe I should use only one user for both databases ?

Best regards.

Lune

On Tue, May 10, 2016 at 10:36 AM, Lune Silver <lu...@gmail.com>
wrote:

> Hello !
>
> I'm trying to install Ranger Admin with Ambari 2.2.1 and I got the
> following exception during the installation :
> ###
>
> 2016-05-10 10:25:47,952 - Execute['python /usr/hdp/current/ranger-admin/db_setup.py'] {'logoutput': True, 'environment': {'RANGER_ADMIN_HOME': '/usr/hdp/current/ranger-admin', 'JAVA_HOME': '/usr/lib/jvm/jre-1.7.0-openjdk.x86_64'}, 'user': 'ranger'}
> 2016-05-10 10:25:48,081  [I] DB FLAVOR :POSTGRES
> 2016-05-10 10:25:48,081  [I] --------- Verifying Ranger DB connection ---------
> 2016-05-10 10:25:48,081  [I] Checking connection
> 2016-05-10 10:25:48,332  [I] connection success
> 2016-05-10 10:25:48,332  [I] --------- Verifying Ranger DB tables ---------
> 2016-05-10 10:25:48,332  [I] Verifying table x_portal_user in database ranger
> 2016-05-10 10:25:48,583  [I] Table x_portal_user already exists in database ranger
> 2016-05-10 10:25:48,583  [I] --------- Verifying upgrade history table ---------
> 2016-05-10 10:25:48,583  [I] Verifying table x_db_version_h in database ranger
> 2016-05-10 10:25:48,834  [I] Table x_db_version_h already exists in database ranger
> 2016-05-10 10:25:48,834  [I] --------- Applying Ranger DB patches ---------
> 2016-05-10 10:25:48,834  [I] No patches to apply!
> 2016-05-10 10:25:48,835  [I] --------- Starting Audit Operation ---------
> 2016-05-10 10:25:48,835  [I] --------- Check admin user connection ---------
> 2016-05-10 10:25:48,835  [I] Checking connection
> 2016-05-10 10:25:49,080  [I] connection success
> 2016-05-10 10:25:49,081  [I] --------- Check audit user connection ---------
> 2016-05-10 10:25:49,081  [I] Checking connection
> 2016-05-10 10:25:49,327  [I] connection success
> 2016-05-10 10:25:49,327  [I] --------- Check table ---------
> 2016-05-10 10:25:49,327  [I] Verifying table xa_access_audit in database audit
> 2016-05-10 10:25:49,575  [I] Table xa_access_audit does not exist in database audit
> 2016-05-10 10:25:49,576  [I] Importing db schema to database audit from file: xa_audit_db_postgres.sql
> SQLException : SQL state: 3F000 org.postgresql.util.PSQLException: ERROR: no schema has been selected to create in ErrorCode: 0
> SQLException : SQL state: 3F000 org.postgresql.util.PSQLException: ERROR: no schema has been selected to create in ErrorCode: 0
> 2016-05-10 10:25:49,813  [E] xa_audit_db_postgres.sql DB schema import failed!
>
> ###
>
> I tried to find the file xa_audit_db_postgres.sql on the future ranger
> host and on the ambari-server without success.
>
> Concerning my configuration, I specified to create DB and users to ranger.
> I set up the following parameter to No.
>
> Setup Database and Database User
>
> No
>
> Because I already created the database and the database users and properly
> configured the connection of the users through the pg_hba.conf.
>
> Do you know what is the problem here ?
>
> Best regards.
>
> Lune.
>