Move Rundeck from H2 to MySQL - Rundeck fails to connect to MySQL

1,194 views
Skip to first unread message

Charles Pippin

unread,
Nov 23, 2020, 3:28:28 PM11/23/20
to rundeck-discuss

My Ansible/Rundeck host is an Ubuntu 20.04 LTS system. I installed Ansible to tinker and then installed Rundeck. Once I was able to get the two talking and working properly (in my mind), I thought it would be best to move Rundeck to a production level DB engine instead of H2. I installed MySQL on the same host and setup the DB and the DB user as directed in the Rundeck docs. I then modified the RD properties file as the same document instructs but I keep getting a failure to connect to the database.

First it was this error:

WARN internal.JdbcEnvironmentInitiator - HHH000341: Could not obtain connection metadata : Could not connect to address=(host=10.10.140.23)(port=3306)(type=master) : Socket fail to connect to host:10.10.140.23, port:3306. Connection refused (Connection refused)

So then I researched the issue and it suggested to validate the user account in MySQL, grants, access, etc. - It all works from a command line testing in MySQL.

I read in one of my searches that some people had luck with removing the useSSL=false or setting it to true. That led to my next error of:

WARN internal.JdbcEnvironmentInitiator - HHH000341: Could not obtain connection metadata : Could not connect to address=(host=localhost)(port=3306)(type=master) : RSA public key is not available client side (option serverRsaPublicKeyFile)

During my research on this error, I read that I needed to add a property to allow the retrieval of the RSA keys, and I did but it didn't change a thing.

I then downloaded the Oracle MySQL jdbc driver and placed it in the var/lib/rundeck/lib folder and changed the driver class name in the properties file and then I received my but that could not connect.  I was able to detect in the system.log output: ' Unable to load class: com.mysql.jc.jdbc.Driver from ClassLoader:org.springframework.boot.loader.'. Obviously the MySQL jdbc driver is not being loaded or possibly found at all. I placed the file in /var/lib/rundeck/lib. Do I need to give the file any special permissions or should it be named something specific. I used wget to download it while in Ubuntu. The file name is mysql-connector-java-8.0.22.jar and it transferred without any issue.  

It was pointed out to me that perhaps it was a password problem and I was directed to this link: github.com/gitbucket/gitbucket/issues/…. I made the change to the MySQL account to change the password to use the native password authentication method. Unfortunately that did not help.   

At this point I am back on H2 and I am too much of a Linux novice to understand what the issue may be. Can anyone kindly point me in a direction that helps as the Rundeck docks for using a MySQL DB seem to either be old or missing some content as a lot of the searches I have made on trying to resolve the issue directs me to perform things slight differently or all new commands that the Rundeck docs don't even mention.  


Thank you in advance for any assistance. 

Xavier Humbert

unread,
Nov 23, 2020, 4:05:52 PM11/23/20
to rundeck...@googlegroups.com, Charles Pippin

Hi, Charles,

Which driver do you use ? And which RD version ? There were a change between 3.2.x and 3.3.x. You probably need mariadb driver.

Cheers

Xavier

--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/93fd0876-c0c0-4d46-9612-d28ccaa77286n%40googlegroups.com.
-- 
Xavier Humbert
CRT Supervision et Exploitation de Niveau 1
Rectorat de Nancy-Metz
03 83 86 27 39
OpenPGP_0x90B78A89BCC49C10.asc
OpenPGP_signature

rac...@rundeck.com

unread,
Nov 23, 2020, 4:13:59 PM11/23/20
to rundeck-discuss

Hi Charles.

I tested on Ubuntu 20.10 and MySQL 8 (on a remote Centos 7 machine using the Oracle drive as you want) following these steps:

1- Install Rundeck.

2- Download the JDBC driver from here.

3- Create /var/lib/rundeck/lib directory and extract there the mysql-connector-java-8.0.22.jar file (from mysql-connector-java-8.0.22.tar.gz file)

4- Make sure that rundeck user owns the /var/lib/rundeck/lib directory and mysql-connector-java-8.0.22.jar file. I have the following permissions:

root@ubuntu2004:/var/lib/rundeck# ls -ll
total 36
drwxr-x--- 2 rundeck rundeck 4096 Nov 23 20:44 bootstrap
drwxr-x--- 2 rundeck rundeck 4096 Nov 11 20:00 data
drwxr-xr-x 2 rundeck rundeck 4096 Nov 23 20:49 lib
drwxr-x--- 3 rundeck rundeck 4096 Nov 23 20:54 libext
drwxr-s--x 2 rundeck adm     4096 Nov 11 20:00 logs
drwxrwxr-x 2 rundeck rundeck 4096 Nov 23 20:54 projects
drwxrwxr-x 4 rundeck rundeck 4096 Nov 23 20:54 repository
drwxr-x--- 3 rundeck rundeck 4096 Nov 23 20:54 var
drwxr-x--- 2 rundeck rundeck 4096 Nov 11 20:00 work

and the file inside lib directory:

root@ubuntu2004:/var/lib/rundeck/lib# ls -ll
total 2336
-rw-r--r-- 1 rundeck rundeck 2389216 Sep 10 21:42 mysql-connector-java-8.0.22.jar

5- Edit the rundeck.config properties file to reference your MySQL 8 instance in this way:

dataSource.url = jdbc:mysql://192.168.33.33/rundeck?autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true
dataSource.username=rundeckuser
dataSource.password=password
dataSource.driverClassName=com.mysql.cj.jdbc.Driver

# to store projects on backend
rundeck.projectsStorageType=db

Now save the file.

6- Start the Rundeck instance checking the service log: systemctl start rundeckd; tail -f /var/log/rundeck/service.log.

[2020-11-23T20:54:07,936] INFO  rundeckapp.Application - The following profiles are active: production

Configuring Spring Security Core ...
... finished configuring Spring Security Core

[2020-11-23T20:54:26,214] WARN  beans.GenericTypeAwarePropertyDescriptor - Invalid JavaBean property 'exceptionMappings' being accessed! Ambiguous write methods found next to actually used [public void grails.plugin.springsecurity.web.authentication.AjaxAwareAuthenticationFailureHandler.setExceptionMappings(java.util.List)]: [public void org.springframework.security.web.authentication.ExceptionMappingAuthenticationFailureHandler.setExceptionMappings(java.util.Map)]
[2020-11-23T20:54:33,063] INFO  rundeckapp.BootStrap - Starting Rundeck 3.3.6-20201111 (2020-11-11) ...
[2020-11-23T20:54:33,066] INFO  rundeckapp.BootStrap - using rdeck.base config property: /var/lib/rundeck
[2020-11-23T20:54:33,077] INFO  rundeckapp.BootStrap - loaded configuration: /etc/rundeck/framework.properties
[2020-11-23T20:54:33,159] INFO  rundeckapp.BootStrap - RSS feeds disabled
[2020-11-23T20:54:33,159] INFO  rundeckapp.BootStrap - Using jaas authentication
[2020-11-23T20:54:33,164] INFO  rundeckapp.BootStrap - Preauthentication is disabled
[2020-11-23T20:54:33,232] INFO  rundeckapp.BootStrap - Rundeck is ACTIVE: executions can be run.
[2020-11-23T20:54:33,634] INFO  rundeckapp.BootStrap - workflowConfigFix973: applying... 
[2020-11-23T20:54:33,647] INFO  rundeckapp.BootStrap - workflowConfigFix973: No fix was needed. Storing fix application state.
[2020-11-23T20:54:33,913] INFO  rundeckapp.BootStrap - Rundeck startup finished in 930ms
[2020-11-23T20:54:34,081] INFO  rundeckapp.Application - Started Application in 28.538 seconds (JVM running for 31.546)
Grails application running at http://localhost:4440 in environment: production

Also, you can check the data source from GUI.

Hope it helps!

Charles Pippin

unread,
Nov 23, 2020, 6:44:53 PM11/23/20
to rundeck-discuss
To the suggestion that I need the MariaDB driver. I did initially use the supplied MariaDB driver but it fails to connect as well to the local MySQL server on the same machine as Rundeck. When I try to connect to the database with the MariaDB driver, I receive this type of error. 

[2020-11-23T23:29:22,474] WARN  internal.JdbcEnvironmentInitiator - HHH000341: Could not obtain connection metadata : Could not connect to address=(host=10.10.140.23)(port=3306)(type=master) : Socket fail to connect to host:10.10.140.23, port:3306. Connection refused (Connection refused)


I tried all of the settings all of you have given me. I set the owner and group of the /var/lib/rundeck/lib folder and the mysql driver inside of it to rundeck as recommended. 

I tested my user again using mysql, and the user was able to login and see the grants which showed the rundeckdb.

mysql> SHOW GRANTS;
+-------------------------------------------------------------+
| Grants for rduser@localhost                                 |
+-------------------------------------------------------------+
| GRANT USAGE ON *.* TO `rduser`@`localhost`                  |
| GRANT ALL PRIVILEGES ON `rundeck`.* TO `rduser`@`localhost` |
+-------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| rundeck            |
+--------------------+
2 rows in set (0.01 sec)


I changed the name of the driver from com.mysql.jdbc.Driver to com.mysql.cj.jdbc.Driver. I then started the service and watched the system log file. Unfortunately it fails to load and there is soo much scrolling on the screen I cant tell where the issue is. Below is what I was able to capture from the output.  

        at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:58) [rundeck-3.3.6-20201111.war:?]
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

and 

        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) [spring-boot-2.1.13.RELEASE.jar!/:2.1.13.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) [spring-boot-2.1.13.RELEASE.jar!/:2.1.13.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.13.RELEASE.jar!/:2.1.13.RELEASE]
        at grails.boot.GrailsApp.run(GrailsApp.groovy:96) [grails-core-4.0.3.jar!/:4.0.3]
        at grails.boot.GrailsApp.run(GrailsApp.groovy:456) [grails-core-4.0.3.jar!/:4.0.3]
        at grails.boot.GrailsApp.run(GrailsApp.groovy:443) [grails-core-4.0.3.jar!/:4.0.3]
        at grails.boot.GrailsApp$run.call(Unknown Source) [grails-core-4.0.3.jar!/:4.0.3]
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) [groovy-2.5.6.jar!/:2.5.6]
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115) [groovy-2.5.6.jar!/:2.5.6]
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:135) [groovy-2.5.6.jar!/:2.5.6]
        at rundeckapp.Application.main(Application.groovy:32) [classes!/:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_275]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_275]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_275]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_275]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [rundeck-3.3.6-20201111.war:?]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [rundeck-3.3.6-20201111.war:?]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) [rundeck-3.3.6-20201111.war:?]
        at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:58) [rundeck-3.3.6-20201111.war:?]
Caused by: com.mysql.cj.exceptions.CJException: Access denied for user 'sa'@'localhost' (using password: YES)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_275]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_275]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_275]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_275]
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:129) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:792) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:717) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:685) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:134) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:469) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:174) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1348) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.NativeSession.connect(NativeSession.java:157) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:850) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        ... 111 more
[2020-11-23T23:19:37,233] WARN  internal.JdbcEnvironmentInitiator - HHH000341: Could not obtain connection metadata : Could not create connection to database server. Attempted reconnect 3 times. Giving up.


I did change the driver name back and was able to get some information. I don't know if any of it is useful but here it is below. I was told when it loaded the driver by the com.mysql.jdbc.Driver name that this was deprecated. 

  at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [rundeck-3.3.6-20201111.war:?]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) [rundeck-3.3.6-20201111.war:?]
        at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:58) [rundeck-3.3.6-20201111.war:?]
Caused by: com.mysql.cj.exceptions.CJException: Access denied for user 'sa'@'localhost' (using password: YES)
        at sun.reflect.GeneratedConstructorAccessor84.newInstance(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_275]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_275]
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:129) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:792) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:717) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:685) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:134) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:469) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:174) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1348) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.NativeSession.connect(NativeSession.java:157) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:850) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        ... 134 more
[2020-11-23T23:10:10,126] WARN  internal.JdbcEnvironmentInitiator - HHH000341: Could not obtain connection metadata : Could not create connection to database server. Attempted reconnect 3 times. Giving up.

Russ Robinson

unread,
Nov 23, 2020, 7:52:50 PM11/23/20
to rundeck...@googlegroups.com
When you are checking the grants via MySQL client, what parameters are you use?  Ex.: which port, host, server, etc.

Thanks,
Russ

On Nov 23, 2020, at 6:44 PM, Charles Pippin <cwpi...@gmail.com> wrote:



Charles Pippin

unread,
Nov 23, 2020, 8:07:49 PM11/23/20
to rundeck...@googlegroups.com
Hi Russ,

I am directly on the machine with mysql and rundeck installed. I access MySql with "mysql -u rduser -p" and  then enter my password for that user I am in the Mysql console. 

So I guess that would be the localhost. I know MySql is bound to 127.0.0.1. I have tried my server IP, 127.0.0.1, and localhost in the rundeck properties config. 

Could it be that MySql is not allowing connectivity to it from Rundeck even though they are on the same machine and local?

Thanks for your help,

Charles




- Typos and misspellings courtesy of my mobile device.

You received this message because you are subscribed to a topic in the Google Groups "rundeck-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rundeck-discuss/aqB1WADmH0I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rundeck-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/D068C6EA-61A4-42AF-BA0D-78F513C725D8%40gmail.com.

eagl...@gmail.com

unread,
Nov 23, 2020, 9:56:20 PM11/23/20
to rundeck...@googlegroups.com

Your MySQL grants show only localhost.  Typically, does your localhost resolve to 127.0.0.1 or to the server’s ip address?  Typically, there is an entry in the /etc/hosts file for localhost.

 

Since you are not specifying “-h” in the mysql client; it is defaulting to localhost as well.  If you put “localhost” in your rundeck configuration file for the mysql connect string; is it trying to use the server ip address or 127.0.0.1?

Charles Pippin

unread,
Nov 24, 2020, 5:26:35 PM11/24/20
to rundeck-discuss
I changed MySQL to listen on 0.0.0.0 and restarted the service. I also put a rule in UFW for 3306/tcp.  I created a mysql user in mysql to allow a connection to the rundeckrd database using the rduser account and password coming from my Windows PC (mypcname.mydomain.com). Using the HeidiSQL client I was able to connect to my rundeckdb with the rduser account successfully.  


However, no matter what I do in the rundeck-config-properties file.  I tried the server IP, localhost, and the hostname in the dataSource.url stringI just cannot get it to connect. 

In MySQL, my users are as follows



Below is my rundeck-config-properties file

#loglevel.default is the default log level for jobs: ERROR,WARN,INFO,VERBOSE,DEBUG
loglevel.default=INFO
rdeck.base=/var/lib/rundeck

#rss.enabled if set to true enables RSS feeds that are public (non-authenticated)
rss.enabled=false
# change hostname here
grails.serverURL=http://xx.xx.xx.xx:4440
dataSource.dbCreate = update
dataSource.url = jdbc:mysql://xx.xx.xx.xx/rundeckdb?autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true
dataSource.user=rduser
dataSource.password=password
#dataSource.driverClassName=org.mariadb.jdbc.Driver
dataSource.driverClassName=com.mysql.cj.jdbc.Driver
#dataSource.url = jdbc:h2:file:/var/lib/rundeck/data/rundeckdb;MVCC=true

# Encryption for key storage
rundeck.storage.provider.1.type=db
rundeck.storage.provider.1.path=keys

rundeck.storage.converter.1.type=jasypt-encryption
rundeck.storage.converter.1.path=keys
rundeck.storage.converter.1.config.encryptorType=custom
rundeck.storage.converter.1.config.password=xxxxxxxxxxxxxxxxxx
rundeck.storage.converter.1.config.algorithm=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
rundeck.storage.converter.1.config.provider=BC

# Encryption for project config storage
rundeck.projectsStorageType=db

rundeck.config.storage.converter.1.type=jasypt-encryption
rundeck.config.storage.converter.1.path=projects
rundeck.config.storage.converter.1.config.password=xxxxxxxxxxxxxxxx
rundeck.config.storage.converter.1.config.encryptorType=custom
rundeck.config.storage.converter.1.config.algorithm=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
rundeck.config.storage.converter.1.config.provider=BC

rundeck.feature.repository.enabled=true


All I keep getting is warning errors like this - 
[2020-11-24T22:15:26,578] WARN  internal.JdbcEnvironmentInitiator - HHH000341: Could not obtain connection metadata : Could not create connection to database server. Attempted reconnect 3 times. Giving up.


rac...@rundeck.com

unread,
Nov 24, 2020, 7:12:14 PM11/24/20
to rundeck-discuss
Hi Charles,

Take a look a this, it's seem same problem and it's related to password type on MySQL 8.

Regards.

Charles Pippin

unread,
Nov 24, 2020, 7:33:05 PM11/24/20
to rundeck-discuss
Unfortunately, that was not the fix. 

Caused by: com.mysql.cj.exceptions.CJException: Access denied for user 'sa'@'localhost' (using password: YES)
        at sun.reflect.GeneratedConstructorAccessor81.newInstance(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_275]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_275]
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:129) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:792) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:717) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:685) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:134) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:469) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:174) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1348) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.NativeSession.connect(NativeSession.java:157) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:850) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        ... 151 more
[2020-11-25T00:32:21,958] WARN  internal.JdbcEnvironmentInitiator - HHH000341: Could not obtain connection metadata : Could not create connection to database server. Attempted reconnect 3 times. Giving up.

rac...@rundeck.com

unread,
Nov 25, 2020, 7:22:22 AM11/25/20
to rundeck-discuss

Hi Charles,

I tested again putting Rundeck and MySQL 8 (server version: 8.0.22-0ubuntu0.20.04.2 (Ubuntu)) in the same Ubuntu 20.04 machine and works in this way:

1.- As a best practice update the whole system: apt-get update; apt-get upgrade.
2.- Install MySQL 8: apt-get install mysql-server.
3.- Configure it: sudo mysql_secure_installation (set the root password and follow some steps related to allowing remote root login and test databases).
4.- Enter to MySQL with: mysql -u root -p.
5.- And I following these steps to create the Rundeck database and user:

CREATE DATABASE rundeck;
CREATE USER 'rundeckuser'@'%' IDENTIFIED BY 'Myp4ssw0rd';
GRANT ALL PRIVILEGES ON rundeck.* TO 'rundeckuser'@'%';
exit;

6.- Download Rundeck .deb package: wget -c https://dl.bintray.com/rundeck/rundeck-deb/rundeck_3.3.6.20201111-1_all.deb.
7.- Install Rundeck: dpkg -i rundeck_3.3.6.20201111-1_all.deb.
8.- Create the lib directory to put the latest MySQL driver: mkdir /var/lib/rundeck/lib and change the owner from root user to rundeck user.
9.- Download the MySQL driver: wget -c https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.22.tar.gz.
10.- Uncompress mysql-connector-java-8.0.22.tar.gz file and put mysql-connector-java-8.0.22.jar file at /var/lib/rundeck/lib directory, change the file owner from root user to rundeck user.
11.- Edit the /etc/rundeck/rundeck-config.properties file to add the MySQL config and save it, here my file content (I defined as localhost):

#loglevel.default is the default log level for jobs: ERROR,WARN,INFO,VERBOSE,DEBUG
loglevel.default=INFO
rdeck.base=/var/lib/rundeck

#rss.enabled if set to true enables RSS feeds that are public (non-authenticated)
rss.enabled=false
# change hostname here
grails.serverURL=http://192.168.33.14:4440
dataSource.dbCreate = update
#dataSource.url = jdbc:h2:file:/var/lib/rundeck/data/rundeckdb;MVCC=true
dataSource.url = jdbc:mysql://localhost/rundeck?autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true
dataSource.username=rundeckuser
dataSource.password=Myp4ssw0rd
dataSource.driverClassName=com.mysql.cj.jdbc.Driver

# to store projects on backend
rundeck.projectsStorageType=db

# Encryption for key storage
rundeck.storage.provider.1.type=db
rundeck.storage.provider.1.path=keys

rundeck.storage.converter.1.type=jasypt-encryption
rundeck.storage.converter.1.path=keys
rundeck.storage.converter.1.config.encryptorType=custom
rundeck.storage.converter.1.config.password=072d452ca7f620cd
rundeck.storage.converter.1.config.algorithm=PBEWITHSHA256AND128BITAES-CBC-BC
rundeck.storage.converter.1.config.provider=BC

# Encryption for project config storage
rundeck.projectsStorageType=db

rundeck.config.storage.converter.1.type=jasypt-encryption
rundeck.config.storage.converter.1.path=projects
rundeck.config.storage.converter.1.config.password=072d452ca7f620cd
rundeck.config.storage.converter.1.config.encryptorType=custom
rundeck.config.storage.converter.1.config.algorithm=PBEWITHSHA256AND128BITAES-CBC-BC
rundeck.config.storage.converter.1.config.provider=BC

rundeck.feature.repository.enabled=true

12.- Start the Rundeck service checking the output: systemctl start rundeckd; tail -f /var/log/rundeck/service.log:

Configuring Spring Security Core ...
... finished configuring Spring Security Core

[2020-11-25T11:56:59,284] WARN  beans.GenericTypeAwarePropertyDescriptor - Invalid JavaBean property 'exceptionMappings' being accessed! Ambiguous write methods found next to actually used [public void grails.plugin.springsecurity.web.authentication.AjaxAwareAuthenticationFailureHandler.setExceptionMappings(java.util.List)]: [public void org.springframework.security.web.authentication.ExceptionMappingAuthenticationFailureHandler.setExceptionMappings(java.util.Map)]
[2020-11-25T11:57:07,868] INFO  rundeckapp.BootStrap - Starting Rundeck 3.3.6-20201111 (2020-11-11) ...
[2020-11-25T11:57:07,869] INFO  rundeckapp.BootStrap - using rdeck.base config property: /var/lib/rundeck
[2020-11-25T11:57:07,886] INFO  rundeckapp.BootStrap - loaded configuration: /etc/rundeck/framework.properties
[2020-11-25T11:57:07,934] INFO  rundeckapp.BootStrap - RSS feeds disabled
[2020-11-25T11:57:07,934] INFO  rundeckapp.BootStrap - Using jaas authentication
[2020-11-25T11:57:07,939] INFO  rundeckapp.BootStrap - Preauthentication is disabled
[2020-11-25T11:57:08,068] INFO  rundeckapp.BootStrap - Rundeck is ACTIVE: executions can be run.
[2020-11-25T11:57:08,564] INFO  rundeckapp.BootStrap - workflowConfigFix973: applying... 
[2020-11-25T11:57:08,575] INFO  rundeckapp.BootStrap - workflowConfigFix973: No fix was needed. Storing fix application state.
[2020-11-25T11:57:08,980] INFO  rundeckapp.BootStrap - Rundeck startup finished in 1204ms
[2020-11-25T11:57:09,199] INFO  rundeckapp.Application - Started Application in 32.282 seconds (JVM running for 35.209)
Grails application running at http://localhost:4440 in environment: production

13.- Check the data source on the GUI.

Hope it helps!

Charles Pippin

unread,
Nov 25, 2020, 12:42:04 PM11/25/20
to rundeck-discuss
Ok.. So I completely removed rundeck and Mysql (as described above) and also made sure there were no remnants in /var/lib or other locations. Reinstalled Mysql, set it up (again as described above), created the rundeck database and user, then granted privileges. I checked by logging into MySQL locally with the rd user and checked my grants. All was fine. 

I then reinstalled Rundeck and made the described changes above and restarted rundeck with the tail on the system log. 

Unfortunately, the result was the same - 
[2020-11-25T17:30:16,623] WARN  internal.JdbcEnvironmentInitiator - HHH000341: Could not obtain connection metadata : Could not create connection to database server. Attempted reconnect 3 times. Giving up.


Charles Pippin

unread,
Nov 25, 2020, 12:59:08 PM11/25/20
to rundeck-discuss
I found a typo in my rundeck-config.properties file. Once I corrected that, and restarted rundeck, it worked!!!!!!

Thank you everyone!  If I could buy you all a drink.. I WOULD!

Have a great holiday and stay safe. 

rac...@rundeck.com

unread,
Nov 25, 2020, 1:00:27 PM11/25/20
to rundeck-discuss
Great news Charles!

Cheers!
Reply all
Reply to author
Forward
0 new messages