Atnaize
Atnaize

Reputation: 1816

Error proxy : Redirection of MySQL queries

I want to redirect MySQL queries destinated to a server (ex:192.168.1.1) to another server (ex:192.168.1.2)

I use MySQL proxy V0.8.5 on the first server (192.168.1.1) and tried the following command

mysql-proxy --proxy-address=192.168.1.1:3306 --proxy-backend-addresses=192.168.1.2:3306

But it give me those errors

2015-09-11 14:34:32: (critical) plugin proxy 0.8.5 started
2015-09-11 14:34:32: (critical) ..\..\mysql-proxy-0.8.5\src\network-socket.c:492
: bind(192.168.1.3:3306) failed: No error (0)
2015-09-11 14:34:32: (critical) ..\..\mysql-proxy-0.8.5\src\chassis-mainloop.c:2
70: applying config of plugin proxy failed
2015-09-11 14:34:32: (critical) ..\..\mysql-proxy-0.8.5\src\mysql-proxy-cli.c:59
9: Failure from chassis_mainloop. Shutting down.

But I can not figure out why this does not work. I am open to any other way to redirect queries from on server to another.

More informations

The queries are made by users, those users are in the same network of the first server (192.168.1.1). This server will not run MySQL but will redirect all the queries to another server (192.168.1.2). This other server is in another network but is visible by the server 192.168.1.1 with a VPN access.

I do not know if that can be useful but I prefear to mention it.

I am open to any other way to redirect queries from one server to another

Upvotes: 0

Views: 467

Answers (2)

andres
andres

Reputation: 143

You can use the HAPROXY solution is solid rock on mysql and it looks like it will fir perfectly for your needs.

Upvotes: 0

RandomSeed
RandomSeed

Reputation: 29749

A mysql proxy seems to be superfluous for the need you describe. A simple port forwarding may suffice. The easiest route I can think of is a SSH port forwarding:

user@front-server$ ssh -L 3306:private-server:3306 user@private-server

Anyone who can reach front-server can now connect to its port 3306, which is seamlessly forwarded to private-server.

Upvotes: 2

Related Questions