2

My Metabase is running on an Amazon Beanstalk instance and I have created an RDS database (MySQL) to which I have access to using the MySQL Workbench.

When I try to add my database to Metabase, I get the following error message:

Timed out after 5000 milliseconds.

I have tried to increase the timeout on the RDS instance but apparently, you should create a new parameter group. But I do not know how to mention that parameter group to Metabase (in Additional JDBC connection string options maybe?)

The MySQL RDS is publicly available.

Update: Security Group Settings on RDS Instance

Inbound: 
Custom TCP Rule  
TCP  
3306
83.219.196.40/32

Outbound: 
All traffic 
All 
All
0.0.0.0/0

Update 2: Metabase Log Message

Jun 25 12:05:13 ERROR metabase.driver :: Failed to connect to database: Timed out after 5000 milliseconds.
Jun 25 12:05:13 DEBUG metabase.middleware :: POST /api/database 400 (5 s) (0 DB calls)
{:valid false, :dbname "Timed out after 5000 milliseconds.", :message "Timed out after 5000 milliseconds."}
disasterkid
  • 6,948
  • 25
  • 94
  • 179
  • Have you ever been able to connect to RDS to run queries? What is the configuration of Security Group associated with the Amazon RDS instance? – John Rotenstein Jun 25 '18 at 11:13
  • Yes, through MySQL Workbench I am able to connect to the RDS database and run queries without a problem. I paste the security group settings as an update to the question in a short while. – disasterkid Jun 25 '18 at 11:21
  • Okay, you can successfully connect to RDS from Workbench. When you say that you "add my database to Metabase", is that also something you are doing through Workbench? How are you trying to add the database? Is that error message coming from Workbench or RDS? Can you try doing it via a different client? – John Rotenstein Jun 25 '18 at 11:47
  • No. Inside Metabase (a Web application hosted on Amazon Beanstalk) and via the admin panel you can add a database. You specify the host, port, database name, username, password, additional JDBC connection string options (as a string), whether we use SSH (not in this case) and then click on Save. This is where I get the error message `Timed out after 5000 milliseconds`. – disasterkid Jun 25 '18 at 12:00
  • @JohnRotensteinI added the log message I get on Metabase. – disasterkid Jun 25 '18 at 12:07

2 Answers2

3

Your security group is currently only permitting access from one IP address (as shown above). It is blocking access from the web application.

You will need to add a rule to the RDS security group permitting inbound access from the web application.

The best way to do this is to find the ID of the Security Group that is associated with your web application (eg sg-abcd1234). Then, add a rule to the RDS security group permitting access from this Security Group ID. This will then allow access from any EC2 instance that uses that security group (even if Beanstalk adds/removes instances they will all inherit access).

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • Genius! Thank you for detecting the issue. – disasterkid Jun 25 '18 at 12:48
  • I'm having the same problem, but my app is running on DigitalOcean. I did allow the Droplet's IP address at RDS. I didn't understand exactly how to add a rule with the secuity group ID... – lowercase00 Apr 21 '19 at 17:35
  • @lowercase00 Please create a new question rather than asking via a comment on an old question. Also, you might get better luck asking on ServerFault. – John Rotenstein Apr 21 '19 at 22:36
0
export MB_DB_CONNECTION_TIMEOUT_MS=50000
java -jar meatabase.jar

The default database connection is 5 seconds. You can make it bigger, like 50 seconds.

QiuYi
  • 125
  • 1
  • 4