Nodebalanced MySQL

So I have my Noedbalancer working perfectly with http and https. Now I want it to work with my MySQL servers residing on each Linode. I have tested the MySQL server config and it is in fact listening to the internal 192.168.x.x port as I can connect to it directly from another Linode using #mysql -h 192.168.x.x -D database -u foo -p bar, Nodebalancer shows both Nodes up and is configured to the proper MySQL port for TCP connection. When I try to connect to the database using the Nodebalncer's address I get a timeout. Am I missing something?

Thanks in advance!

2 Replies

Hmm. Interesting question. Did you determine the private IP of the NodeBalancer? Is that allowed via the MySQL user's "host" field?

Also, I shared this question via social media to hopefully bring more eyes. I would love to know the answer to this too.

I just gave this a quick test this on fresh servers with loose MySQL permissions. No firewall rules were in place – if you're getting timed out errors I suspect that this is firewall related. Our Nodebalancer private range is 192.168.255.0/24, it's rare but your Nodebalancer private IP can change so we generally recommend whitelisting the whole range for dependent applications.

For my test configuration, I added a MySQL user as follows:

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON . TO 'username'@'localhost' WITH GRANT OPTION;

CREATE USER 'username'@'%' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON . TO 'username'@'%' WITH GRANT OPTION;

In my.cnf the bind address set to the respective private IPs.

From there I could connect with:

mysql -u username -h -p

The only caveat is that sometimes you'll hit one back and sometimes you'll hit the other. I used session stickiness 'none' and Nodebalancer algorithm set to Round Robin to ensure that I was hitting different backends on subsequent attempts.

Feel free to open a ticket with us if you'd like us to take a closer look at your configuration -- we can recap the solution here if needed.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct