0

In my (simplified) setup, I have 2 Servers, A and B (and others, which behave like B), and my local machine. On each of the servers, a mysql-database and a mysqld-exporter prometheus-exporter should be running as docker containers. The containers are not linked, but communicate via the network over the opened port.

The servers are managed by a tool, and therefore contain the same versions of the programs with the same configs, like ports, docker network name. The difference are hostnames, ip addresses and other server-specific stuff.

The problem is, that the mysqld-exporter on server A produces the log message: level=error msg="Error pinging mysqld: dial tcp SERVER_IP_ADDRESS:3306: getsockopt: connection timed out" source="mysqld_exporter.go:268" (where SERVER_IP_ADDRESS is the server's ip), while the exporter on B works fine.

I also tried to create the container "by hand", with docker run, and set the DATA_SOURCE_NAME as environment variable, on server A, B and locally to connect to server A. Now, the container works and connects to server A as expected from my local machine and from server B, but still not from A. Therefore, I assume the database works fine (not overloaded).

What are reasons why the docker-container doesn't work on machine A? I run out of ideas what to look for.

If any necessary information is missing, please let me know!

EDIT:

With "by hand", I mean the docker-command docker run -d -p 9104:9104 -e DATA_SOURCE_NAME="USERNAME:PASSWORD@(SERVER_URL:MYSQL_PORT)/" prom/mysqld-exporter:v0.10.0 executed in the console, which works to connect to A from B and localhost, but not A.

As explained, the server URL should also work on server A, since B and localhost use the same url to connect to the database.

Thomas Böhm
  • 145
  • 1
  • 8
  • How do you expose port? (Command line args, Dockerfile, docker-compose.yml? Please show your configuration.) Unless you have created a network, either manually or using a docker-compose.yml, SERVER_IP_ADDRESS will be your docker-machine‘s IP. – stoeff Mar 28 '18 at 19:35
  • @stoeff edited my question and tried to answer your questions. If other things are unclear please let me know! – Thomas Böhm Mar 29 '18 at 12:36
  • would you please edit your post and add your docker-compose file? – Mostafa Ghadimi Aug 06 '19 at 13:16
  • @MostafaGhadimi there is no docker-compose file, since I set up the whole enviroment via ansible. – Thomas Böhm Aug 06 '19 at 13:22
  • Would you want to answer your question using `docker-compose.yml` file? – Mostafa Ghadimi Aug 06 '19 at 13:23
  • @MostafaGhadimi sorry, I didn't find an answer. I did a workaround by running stuff on another server (`C`), where everything worked as expected. I don't know why it didn't work on that one specific server (`A`). – Thomas Böhm Aug 09 '19 at 08:12

0 Answers0