I have my Sails application on an AWS instance with all dependancies installed with no apparent issues. However, each time I try to launch the app I am getting the following error.
error: AdapterError: Connection is already registered
I have not managed to successfully lift sails yet on the instance and sails-mysql was freshly installed so no connections should be registered.
I have taken the following steps to deploy my app..
Set up a MySql RDS instance (EU-West)
Created and set up an Ubuntu AMD-64 t2.micro EC2 instance (EU-West)
Installed all prerequisites (Git, NVM, NodeJs, Sails, etc.)
Cloned my Sails project
Installed dependencies for Sails
Correctly configured my connection settings for Sails to use my RDS instance.
I know that my connection settings are correct as I have been able to run Sails on my local machine with a connection to my RDS instance and it would consistently lift without any issues.
I am also able to connect to my RDS instance using SequelPro with no problems.
I have had issues with dependencies in the past but have managed to fix those issues and have not had any of them on my local machine or with my EC2 instance.
After searching for a while I have come across a few users who have had similar issues but have managed to fix them with Waterline's teardown methods, however, I am unsure how to achieve this.
I have done my best to provide as much information as possible and any help would be massively appreciated.
Sails Version: 0.12.11
Thank you in advance.
I managed to fix the issue by carrying out the following:
Switched my environment to production in config/bootstrap.js
In connections.js add connectTimeout: 20000 to make sure the request does not time out before the connection is made.
eg. process.env.NODE_ENV = 'development'
Ensure that the security group inbounds rules for the RDS allows connections from the security group associated with my EC2 instance.
Type: MySQL/Aurora
Protocol: TCP
Port Range: 3306
Source: < Your security group ID >
Following the above points also meant I overcame the issue with handshake timeouts when communicating with the RDS.
Related
I am trying to connect to local GCloud MySQL instance from my local machine. I managed to connect to the instance from Workbench. In this answer it says to add a socketPath in extra when creating the config file. But since I'm trying to run this on local machine I tried changing that "/cloud/" path in many ways but didn't succeed.
Can someone please explain how I can connect to GCloud MySQL instance from a local NodeJS project that use TypeORM.
As per the official documentation we can establish a connection to Cloud SQL from an application running outside of Google Cloud Platform in different ways. Now, I went through the documentation and I found that you can use a Proxy if is for local test environment. I successfully reproduced this scenario and I did all the steps that the documentation said. According to my tests, there is no need to change the socket path.
Please let me know how it goes.
If you are running an application locally and want to connect to a Cloud SQL instance, I would recommend the Cloud SQL Proxy. It creates local entrypoint (Unix socket or TCP port, depending on what you tell it) that will authenticate and proxy your connections to your instance.
I am pretty new to aws stack and trying to setup a simple node-mysql app.
Node is running on AWS EC2 Ubuntu 14.04 instance, and MySQL is running on AWS RDS instance.
I am trying to connect to MySQL from my Node client using popular MySQL connector https://github.com/mysqljs/mysql but for some reason always getting 'Connection timeout'. Since node connection doesn't work, I tried to connect using a Telnet just to see if I at least can create any kind of connection.
telnet instance.12345.amazonaws.com 3306
but also unable to connect. Please note both of the connections e.g. though node app and through telnet do work when I try running them from my Windows localhost.
Things I've considered:
EC2 Ubuntu instance has Outbound rules to allow any kind of out
request.
Running app as sudo.
RDS MySQL instance has inbound
port 3306 open.
Installed MySQL client on my EC2 machine.
Basically have no idea on what exact step I've missed during setup and just trying to poke anything possible, any help/suggestion is greatly appreciated.
I've recently created a Mule application (3.7.0 CE) on a laptop. I'm connected to an AWS RDS instance when running locally in AnyPoint Studio using Maven. I started with a local MySQL DB and migrated it to AWS because my application "proofofconcept" is just that a proof of concept and I would like to show the application online (public url) instead of my laptop for a presentation. I added the database.url=... property to the application properties when I deployed to Anypoint Runtime Manager in the cloud. I'm currently getting a:
communications link failure
I've tried several things and nothing has worked. I tried a basic database connection first in the database config. And, then I created a JDBC datasource in Spring-beans. Both methods worked locally and in-communication with AWS (remote). When I deploy to Runtime Manager, the application deploys. And, I get the console that's generated runtime by the RAML. When I call a url e.g. api/v1/orders it runs and runs and after timeout provides the communication error.
Does anyone 1) know if the communication is allowed? 2) know how to fix this? I would like to demo the POC online for my client.
Thanks in advance
My issue was with Amazon VPC and the default security group assigned to my RDS instance. By default all outbound activity is set to any protocol and any port for any ip (0.0.0.0/0). Inbound routing, however was specifying only port 3306 but also a custom using-ip that was my home network public ip. I changed the ip specification to be 0.0.0.0/0. This now mean's that any ip can send a request though port 3306 to my Amazon MySQL instance.
I have deployed a Sails api to Heroku I had been using the localdiskdb for quite a while without any issues. I have recently spun up a JawsDB instance to connect with the api.
jawsDB:{
adapter: 'sails-mysql',
url: process.env.JAWSDB_URL,
schema: true
},
I have set the model in production.js to jawsDB.
We have been using a local mysql instance with no issues in development
I also have tested it on a Amazon RDS instance that I connected to locally
I have tried all the connection strings that JawsDB provides
I have tested different arguments in the sails adapter, including ssl: true
I have swapped out jawsDB for localdiskdb in the production.js file to test if it was even hitting it and it worked with no issues
I have Papertrail set up and get no errors or any strange log entries of any kind when lifting sails
I have been at this for the better part of a few days. At this point I really think I am missing something rather dumb. If anyone has any experience with setting this up the help would be greatly appreciated.
Turns out I am dumb! I didn't have enough error logging to notice my application quickly used more than the 10 available connections that JawsDB offers for their free account.
My solution, use Amazon RDS.
I'm using Amazon RDS for the first time ever and I've been following the heroku docs to get my app using the RDS instance. So far I've created an instance and I have setup the addon using the format:
$ heroku addons:add amazon_rds url=mysql://user:pass#rdshostname.amazonaws.com/databasename
After running heroku rake db:migrate I got
!!! The bundled mysql.rb driver rake
aborted! no such file to load -- mysql
So I installed the MySQL gem. Doing the same thing again I got the error:
Can't connect to MySQL server on
'myapp.cqslpaxxqrok.eu-west-1.rds.amazonaws.com'
(110)
I see there's a note about the instance being in the US-east region for Heroku's security group to control access or something. Can I not use a European instance?
No, you cannot use a European instance. Heroku is only available on the US East zone right now, and you need to be able to add Heroku to your security zone for the RDS instance to work, which I suppose require you to be in the same zone. More imporantly, you want to be in the same zone as Heroku for latency and security reasons (otherwise your database traffic will be travelling over the Internet).
Heroku changed its procedure to allow Heroku servers to connect to RDS instances. The accepted answer to this question is not true anymore.
You have to grant Heroku dynos access to your RDS instance. The recommended way to do this is to configure the RDS instance to only accept SSL-encrypted connections and configure the security group for your instance to permit ingress from all IPs.
Previously, Heroku published its AWS account ID and security group name as a way to grant access to an AWS RDS instance. This is no longer recommended.
Ref: https://devcenter.heroku.com/articles/amazon_rds