Skip to main content
ChineduLB
Silver ⭐️⭐️⭐️
August 26, 2019
Solved

Upgrade Sentry Database Tables fails after upgrade from 5.12 to 6.2

Caused by: java.net.ConnectException: Connection refused (Connection refused)

                at java.net.PlainSocketImpl.socketConnect(Native Method)

                at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

                at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

                at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

                at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

                at java.net.Socket.connect(Socket.java:589)

                at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)

                at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300)

                ... 19 more

+ NUM_TABLES='[                         main] SqlRunner                     ERROR Error connecting to db with user '\''sentry'\'' and jdbcUrl '\''jdbc:mysql://localhost:3306/sentry?useUnicode=true&characterEncoding=UTF-8'\'''

+ [[ 1 -ne 0 ]]

+ echo 'Failed to count existing tables.'

+ exit 1

 

EricL
EricLAnswer
Platinum ⭐️⭐️
August 28, 2019
@ChineduLB

If you go to CM > Sentry > Configuration > search for "database", you should be able to see those database options, the one you need is "Sentry Server Database Password".

Plus, you also need to make sure that the username and password you used here can connect to Sentry database.

Cheers
Eric

5 replies

mszurap
Platinum ⭐️
Platinum ⭐️
August 26, 2019

Hi,

The message "java.net.ConnectException: Connection refused" is quite clear, the backend database has refused the connection request. Check that your DB is is up and running and that you can connect to it from the localhost. Haven't you moved the Sentry role or the database to another host?Or do you have SSL enabled/required for the backend database?

Translate
ChineduLB
ChineduLBAuthor
Silver ⭐️⭐️⭐️
August 27, 2019

I am able to connect from the localhost as sentry, root etc. without any issues

 

does the password provided in the sentry configuration in CM need to be encrypted or something.?

 

How can I confirm that the jdbc url is correct ?

 

We just upgraded CM/CDH from 5.12 to 6.2 

 

Translate
mszurap
Platinum ⭐️
Platinum ⭐️
August 27, 2019

You can use any JDBC client to test whether the JDBC connection URL is proper, for example:

http://jdbcsql.sourceforge.net/

or

http://squirrel-sql.sourceforge.net/

 

Have you tried to use the fully qualified domain name of the host instead of localhost? (make sure to allow the connection for the sentry user for the FQDN too on MySQL side)

Translate