toxiproxy icon indicating copy to clipboard operation
toxiproxy copied to clipboard

Unable to connect to RDS Aurora SQL DB via ToxiProxy server

Open ashish-k opened this issue 3 years ago • 10 comments

Followed steps mentioned below:

  1. I have created proxy using following command: toxiproxy-cli create -l 0.0.0.0:26379 -u {RDS Aurora DB endpoint}:3306 RDS
  2. Replaced RDS aurora endpoint in url below with IP of proxy server jdbc:mysql://{proxy_server_ip}:26379/{DB_name}
  3. When I try to access SQL server as earlier, I get following error - "ERROR: Unexpected error: Could not connect to MySQL instance. Error is: (2003, "Can't connect to MySQL server on '{Proxy ip address}' (timed out)")"

ashish-k avatar Oct 07 '22 12:10 ashish-k

jdbc:mysql://{proxy_server_ip}:3306/{DB_name}

Should be jdbc:mysql://{proxy_server_ip}:26379/{DB_name}

miry avatar Oct 07 '22 16:10 miry

@miry I did change it to "jdbc:mysql://{proxy_server_ip}:26379/{DB_name}". It was a typo. Apologies. Request you to help me here.

ashish-k avatar Oct 10 '22 11:10 ashish-k

@ashish-k I propose to check toxiproxy with simple commands:

  1. Make sure toxiproxy server and client are uptodated:
$ toxiproxy-server --version
toxiproxy-server version 2.5.0

$ toxiproxy-cli --version
toxiproxy-cli version 2.5.0
  1. Run server with debug log level.
LOG_LEVEL=debug toxiproxy-server 
  1. Create a new proxy
toxiproxy-cli create -l 0.0.0.0:26379 -u {RDS Aurora DB endpoint}:3306 rds
toxiproxy-cli inspect rds
  1. Test that port is open
curl -v 0.0.0.0:26379
curl -v 127.0.0.1:26379
  1. Check logs from toxiproxy-server.

Pls share output of commands and logs, it would help me to identify the problem.

miry avatar Oct 10 '22 12:10 miry

@miry Thank you for your inputs.

After running command "LOG_LEVEL=debug toxiproxy-server", following output is printed and nothing happens after that. Can you please suggest if there is some alternative way to change LOG_LEVEL. Thanks again!

{"level":"info","host":"localhost","port":"8474","version":"2.5.0","caller":"api.go:119","time":"2022-10-14T11:54:21Z","message":"Starting HTTP server on endpoint localhost:8474"}

ashish-k avatar Oct 14 '22 12:10 ashish-k

@ashish-k Have you done commands with curl? According the logs, it looks there were no any requests done.

Can you please suggest if there is some alternative way to change LOG_LEVEL.

It is not possible right now, sorry for this. Probably we can move log level in config later.

miry avatar Oct 14 '22 13:10 miry

@miry Please find below the output of curl commands.

curl -v 0.0.0.0:26379

Output:

  • Trying 0.0.0.0:26379...
  • Connected to 0.0.0.0 (127.0.0.1) port 26379 (#0)

GET / HTTP/1.1 Host: 0.0.0.0:26379 User-Agent: curl/7.81.0 Accept: /

  • Received HTTP/0.9 when not allowed
  • Closing connection 0 curl: (1) Received HTTP/0.9 when not allowed

curl -v 127.0.0.1:26379

Output:

  • Trying 127.0.0.1:26379...
  • Connected to 127.0.0.1 (127.0.0.1) port 26379 (#0)

GET / HTTP/1.1 Host: 127.0.0.1:26379 User-Agent: curl/7.81.0 Accept: /

  • Received HTTP/0.9 when not allowed
  • Closing connection 0 curl: (1) Received HTTP/0.9 when not allowed

ashish-k avatar Oct 17 '22 05:10 ashish-k

@miry Request you to help me here. Do let me know if any other inputs are required.

ashish-k avatar Oct 19 '22 06:10 ashish-k

Can anyone else help me here please if @miry is not available

ashish-k avatar Nov 10 '22 12:11 ashish-k

@miry Can you please help me here

ashish-k avatar Jan 11 '23 07:01 ashish-k

@ashish-k As I see toxiproxy shows the reply from Aurora DB. You did not provide logs from toxiproxy during your experiments with curl. I am not familiar with Aurora DB, I could guess that some sort Handshake verification enabled. Example SSL or encription, where server see that proxy used.

You should check Toxiproxy server logs and Aurora DB logs.

miry avatar Jan 11 '23 15:01 miry