Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Not able to run scm_prepare_database.sh script

avatar
Explorer

I am using PostgreSQL for the Cloudera Manager Server and other services that use databases. I'm using a RHEL 7.4 Azure VM and following the official documentation -https://docs.cloudera.com/documentation/enterprise/6/6.3/topics/prepare_cm_database.html

I have completed step 4(Install Databases). In Step 5 : Set up the Cloudera Manager Database, on executing the scm_prepare_database.sh script I'm getting the following output-

  

[root@machine1 ~]# sudo /opt/cloudera/cm/schema/scm_prepare_database.sh postgresql scm scm
Enter SCM password:
JAVA_HOME=/usr/java/jdk1.8.0_181-cloudera
Verifying that we can write to /etc/cloudera-scm-server
Creating SCM configuration file in /etc/cloudera-scm-server
Executing:  /usr/java/jdk1.8.0_181-cloudera/bin/java -cp /usr/share/java/mysql-connector-java.jar:/usr/share/java/oracle-connector-java.jar:/usr/share/java/postgresql-connector-java.jar:/opt/cloudera/cm/schema/../lib/* com.cloudera.enterprise.dbutil.DbCommandExecutor /etc/cloudera-scm-server/db.properties com.cloudera.cmf.db.
Jul 17, 2020 1:59:50 PM org.postgresql.Driver connect
SEVERE: Connection error:
org.postgresql.util.PSQLException: FATAL: Ident authentication failed for user "scm"
        at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:438)
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:222)
        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
        at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:194)
        at org.postgresql.Driver.makeConnection(Driver.java:450)
        at org.postgresql.Driver.connect(Driver.java:252)
        at java.sql.DriverManager.getConnection(DriverManager.java:664)
        at java.sql.DriverManager.getConnection(DriverManager.java:247)
        at com.cloudera.enterprise.dbutil.DbCommandExecutor.testDbConnection(DbCommandExecutor.java:263)
        at com.cloudera.enterprise.dbutil.DbCommandExecutor.main(DbCommandExecutor.java:139)

[                          main] DbCommandExecutor              INFO  Unable to login using supplied username/password.
[                          main] DbCommandExecutor              ERROR Error when connecting to database.
org.postgresql.util.PSQLException: FATAL: Ident authentication failed for user "scm"
        at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:438)[postgresql-42.1.4.jre7.89c9f79016bab67349a92c00c55907dd.jar:42.1.4.jre7]
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:222)[postgresql-42.1.4.jre7.89c9f79016bab67349a92c00c55907dd.jar:42.1.4.jre7]
        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)[postgresql-42.1.4.jre7.89c9f79016bab67349a92c00c55907dd.jar:42.1.4.jre7]
        at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:194)[postgresql-42.1.4.jre7.89c9f79016bab67349a92c00c55907dd.jar:42.1.4.jre7]
        at org.postgresql.Driver.makeConnection(Driver.java:450)[postgresql-42.1.4.jre7.89c9f79016bab67349a92c00c55907dd.jar:42.1.4.jre7]
        at org.postgresql.Driver.connect(Driver.java:252)[postgresql-42.1.4.jre7.89c9f79016bab67349a92c00c55907dd.jar:42.1.4.jre7]
        at java.sql.DriverManager.getConnection(DriverManager.java:664)[:1.8.0_181]
        at java.sql.DriverManager.getConnection(DriverManager.java:247)[:1.8.0_181]
        at com.cloudera.enterprise.dbutil.DbCommandExecutor.testDbConnection(DbCommandExecutor.java:263)[db-common-6.3.1.96818eaab0a222aa84a7854b8d22c0c7.jar:]
        at com.cloudera.enterprise.dbutil.DbCommandExecutor.main(DbCommandExecutor.java:139)[db-common-6.3.1.96818eaab0a222aa84a7854b8d22c0c7.jar:]
[                          main] DbCommandExecutor              ERROR Exiting with exit code 8
--> Error 8, giving up (use --force if you wish to ignore the error)

I had logged into postgres using # sudo -u postgres psql. 

Please help. Thanks in advance.

1 ACCEPTED SOLUTION

avatar
Explorer

@Shelton I had to install ident server, also I had changed the ip address in the line-

host all all 127.0.0.1/32 md5 so changed it back to 127.0.0.1. Thanks.

View solution in original post

8 REPLIES 8

avatar
Master Mentor

@tanishq1197 

I think your syntax is wrong  because you have initiated a connection using the below snippet

# sudo -u postgres psql

 The correct syntax is  without need of prior log on

$ sudo /opt/cloudera/cm/schema/scm_prepare_database.sh [options] <databaseType> <databaseName> <databaseUser> <password>

Substituting the correct value s the below should run successfully with the default user/password scm/scm

$ sudo /opt/cloudera/cm/schema/scm_prepare_database.sh postgresql scm scm scm 

Assuming you intend to use the derby databases postgres please see Setting up the Cloudera Manager Database

Hope that helps

avatar
Explorer

Hi @Shelton,

 

Thanks for the response. I have tried with the following syntax-

$ sudo /opt/cloudera/cm/schema/scm_prepare_database.sh [options] <databaseType> <databaseName> <databaseUser> <password>

 but the output remains the same. 

avatar
Master Mentor

@tanishq1197 

 

Please can you copy and paste here exactly the command you run?

avatar
Explorer

@Shelton 

 

sudo /opt/cloudera/cm/schema/scm_prepare_database.sh postgresql scm scm

 

And in the next line I was prompted for password. 

avatar
Master Mentor

@tanishq1197 

 

The Password should be the scm password

Enter SCM password:

The default is SCM that should progress successfully

 

 

avatar
Explorer

CREATE ROLE <user> LOGIN PASSWORD '<password>';

CREATE DATABASE <database> OWNER <user> ENCODING 'UTF8';

 

I had changed the password using the above commands for each database, I have anyways tried with the default password "scm" as well, the error still persists. 

avatar
Master Mentor

@tanishq1197 

 

I think I did a typo error  previously there was an extra scm the below should run successfully 

sudo /opt/cloudera/cm/schema/scm_prepare_database.sh postgresql scm scm

 

avatar
Explorer

@Shelton I had to install ident server, also I had changed the ip address in the line-

host all all 127.0.0.1/32 md5 so changed it back to 127.0.0.1. Thanks.