1

I'm running InluxDB on my server in docker container.

this command is ok, when executed from the same server:

curl -G http://localhost:8086/query -u my_user --data-urlencode "q=SHOW DATABASES"

authetification is ok and it prints the databases.

But when I change localhost to public IP, it doesn't work from the same server, and also from some other server (which is the main goal, it should work from another server.

curl -G http://ip_of_the_same_server:8086/query -u my_user --data-urlencode "q=SHOW DATABASES"
  • Please can you post the output of : lsof -i -n -P | grep :8086 Thanks you. – MathieuR Nov 07 '17 at 10:45
  • nothing was printed, but without -i -n -P it prints *lsof: no pwd entry for UID 1100* – Július Marko Nov 07 '17 at 10:47
  • Please can you execute this as root ? – MathieuR Nov 07 '17 at 10:49
  • **docker-pr 2276 root 4u IPv6 1211554 0t0 TCP *:8086 (LISTEN)** – Július Marko Nov 07 '17 at 10:50
  • It seem you are only listenning on IPv6, so you can't connect using IPv4. Maybe you can try setting the bind address to 0.0.0.0:8086 or your_ip:8086. – MathieuR Nov 07 '17 at 10:53
  • I'm not sure what I have to set, can you explain it in more detail? – Július Marko Nov 07 '17 at 10:54
  • locate your influxdb.conf file (/etc/influxdb/influxdb.conf). Then find the [http] section. You should see "bind-address = ":8086"". change this line to "bind-address = "0.0.0.0:8086"". Don't forget to restart influxdb. – MathieuR Nov 07 '17 at 10:58
  • okay, and how to apply changes to influxdb.conf? – Július Marko Nov 07 '17 at 11:00
  • Simply restart it. – MathieuR Nov 07 '17 at 11:05
  • doesn't working, when enter command influxd config, it prints the old config. – Július Marko Nov 07 '17 at 11:07
  • Ok, and if you restart the whole docker container ? Still the old config ? Are your modifications in the config file still there ? – MathieuR Nov 07 '17 at 11:29
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://serverfault.com/help/whats-reputation) you will be able to [comment on any post](https://serverfault.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/low-quality-posts/346668) – Khaled Nov 07 '17 at 12:04

1 Answers1

1

You can check if your container is listening on port from any ipv4(0.0.0.0)

docker ps example: 0.0.0.0:8086->3306/tcp

How is your server connected to network via firewall etc, if its connected via firewall then first check if port 8086 is open and are you able to telnet on port from another server

If telnet works then you need to confirm if you have created user in mysql for another server ip access, you need to create user with ip address of another server in order to access mysql or you can use 'user'@'%' with access to required db while creating user this will allow that user from any ip

*GRANT ALL PRIVILEGES ON dbname TO 'username'@'another-server-ip';

or *GRANT ALL PRIVILEGES ON dbname TO 'username@'%';

'%' will allow from any host or ip

use grants as per your usage ex: select, insert, update etc.

Its good to map data volumes of mysql to host folder, its easy to manage backups and managing containers

you can try docker run --name mysql-server -p 3307:3307 -v /var/mysql_data/mysql:/var/lib/mysql -v /opt/done/mysql/my.cnf:/etc/mysql/my.cnf -it mysql sh

In above example volumes are mounted on different path outside container to local host folder

Vijay Muddu
  • 436
  • 2
  • 9