Resolving remote MYSQL host name

I’m trying to connect to a remote mysql.

When I specify the host name in the connection table it does not work - it times out.

However I found that on the command line using “mysql” I can connect.

So I then got the IP of the host and put that in the connection table instead. It worked.

Therefore I conclude that whatever coronium is using to resolve the host (resty/nginx?) isn’t working - or it’s keeping a cache of host to IP addresses but the IP of my MYSQL instance has changed (it’s on AWS).

Where can I find the resty/nginx/whatever log, so I can see if it is indeed resolving to the wrong IP, or if something else is wrong.

If it is a cache issue, can I turn it off - or do I need to spend a bit of money and get an AWS static IP for my instance?

Ok, it’s impossible to get an elastic (static) ip for an AWS RDS instance.

I have got round this problem for now by resolving the dns to an ip myself using socket, like this;

sudo luarocks install luasocket

then modify mod_mysql.lua like this;

if not db then response.error = err else --START local socket = require("socket") db\_host = socket.dns.toip( db\_host ) --END db:set\_timeout( 2000 ) local ok, err = db:connect{ host = db\_host, port = db\_port, database = db\_name, user = db\_user, password = db\_password }

no idea what the performance implications are of resolving every time, but not sure there is another way, as AWS specifically say that you cannot rely on the IP staying the same.

Getting a lost-cost domain is a good idea. You can get a .info for a couple bucks. Then its easy to repoint your ip if needed.

Coronium has a local-only MySQL instance. I don’t really have any advice on how to integrate with RDS. I’m guessing the timeout is due to not having proper credentials (certs) to access AWS on the actual server itself.

As an aside, if you’re hacking on core files, you’re circumventing the concept of how Coronium works. It sounds like you are at a level where you could probably get the functionality you are looking for in other ways. Coronium is meant for folks don’t want to mess with all that stuff. :slight_smile:

Good luck.

Ok, it’s impossible to get an elastic (static) ip for an AWS RDS instance.

I have got round this problem for now by resolving the dns to an ip myself using socket, like this;

sudo luarocks install luasocket

then modify mod_mysql.lua like this;

if not db then response.error = err else --START local socket = require("socket") db\_host = socket.dns.toip( db\_host ) --END db:set\_timeout( 2000 ) local ok, err = db:connect{ host = db\_host, port = db\_port, database = db\_name, user = db\_user, password = db\_password }

no idea what the performance implications are of resolving every time, but not sure there is another way, as AWS specifically say that you cannot rely on the IP staying the same.

Getting a lost-cost domain is a good idea. You can get a .info for a couple bucks. Then its easy to repoint your ip if needed.

Coronium has a local-only MySQL instance. I don’t really have any advice on how to integrate with RDS. I’m guessing the timeout is due to not having proper credentials (certs) to access AWS on the actual server itself.

As an aside, if you’re hacking on core files, you’re circumventing the concept of how Coronium works. It sounds like you are at a level where you could probably get the functionality you are looking for in other ways. Coronium is meant for folks don’t want to mess with all that stuff. :slight_smile:

Good luck.