Support Questions

Find answers, ask questions, and share your expertise

CM 5.16.2 scm prepare database error with mysql 5.7.33

avatar
Explorer

use script :

 

 

/opt/module/cm/cm-5.16.2/share/cmf/schema/scm_prepare_database.sh

 

 

Error:

 

 

Mon Jul 12 17:30:10 CST 2021 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
[                          main] DbProvisioner                  ERROR Exception when creating/dropping database with user 'temp' and jdbc url 'jdbc:mysql://localhost/?useUnicode=true&characterEncoding=UTF-8'
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 287 milliseconds ago.  The last packet sent successfully to the server was 277 milliseconds ago.
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.8.0_291]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)[:1.8.0_291]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.8.0_291]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)[:1.8.0_291]
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)[mysql-connector-java.jar:5.1.40]
        at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989)[mysql-connector-java.jar:5.1.40]
        at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:164)[mysql-connector-java.jar:5.1.40]
        at com.mysql.jdbc.MysqlIO.negotiateSSLConnection(MysqlIO.java:4898)[mysql-connector-java.jar:5.1.40]
        at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1659)[mysql-connector-java.jar:5.1.40]
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1226)[m

 

 

 I guess the reason is mysql use ssl but jdbc url not set  useSSL=false,so I disabled mysql ssl option, then it works.

Has another way to solve this problem, like modify options in db.properties?

1 ACCEPTED SOLUTION

avatar
Master Guru

@flowerbirds For CM server DB you can try something like below: 

  1. In db.properties:
    com.cloudera.cmf.db.type = mysql 
    com.cloudera.cmf.orm.hibernate.connection.url=jdbc:mysql://<db_host>/scm?useSSL=true 
    com.cloudera.cmf.orm.hibernate.connection.username=scm 
    com.cloudera.cmf.orm.hibernate.connection.password=cloudera
  2. In /etc/default/cloudera-scm-server add the following to export CMF_JAVA_OPTS:
    -Djavax.net.ssl.trustStore=/opt/cloudera/security/jks/truststore.jks
  3. Restart the Cloudera Manager server.

NOTE: Just remember in some case we set ssl=true&sslmode=require so if the normal method means com.cloudera.cmf.orm.hibernate.connection.url=jdbc:mysql://<db_host>/scm?useSSL=true failed please try the `ssl=true&sslmode=require as well and see.


Cheers!
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.

View solution in original post

1 REPLY 1

avatar
Master Guru

@flowerbirds For CM server DB you can try something like below: 

  1. In db.properties:
    com.cloudera.cmf.db.type = mysql 
    com.cloudera.cmf.orm.hibernate.connection.url=jdbc:mysql://<db_host>/scm?useSSL=true 
    com.cloudera.cmf.orm.hibernate.connection.username=scm 
    com.cloudera.cmf.orm.hibernate.connection.password=cloudera
  2. In /etc/default/cloudera-scm-server add the following to export CMF_JAVA_OPTS:
    -Djavax.net.ssl.trustStore=/opt/cloudera/security/jks/truststore.jks
  3. Restart the Cloudera Manager server.

NOTE: Just remember in some case we set ssl=true&sslmode=require so if the normal method means com.cloudera.cmf.orm.hibernate.connection.url=jdbc:mysql://<db_host>/scm?useSSL=true failed please try the `ssl=true&sslmode=require as well and see.


Cheers!
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.