How to connect to a remote host using influxdb Python client

Hello Everyone,

I just started using influxdb and I’m trying to figure things out. I would like to access a remote host. I know I should use the following command. but I don’t know how to get the port, url or host of the remote server.

client = InfluxDBClient(host=‘10.x.x.x’, port=7086, username=‘user of host server’, password=‘p/w of host server’, database=‘test_hd’)

Could someone please help me :slight_smile:

Is the server your own local influxdb server that you installed yourself?
If so, you probably want host=‘localhost’ and port=8086

If it is someone else’s influxdb server, then you need to ask them. We couldn’t even begin to guess.

Hi @James_Paige… Thanks for your answer.
I would like to access and query some data from an Influxdb on a remote server(it’s someone else’s influxdb). I can access the remote server using the teamviewer and I got the Hostname/IP adress of the remote server. I am still getting some permission error, once I try to access influxdb. so I’m not sure how I can give myself the permission to access the influxdb remote server from my local server.
Do you have any ideas? Should I enable or change something in the influxdb configuration file?

If it is definitely a permission error, then you need to set up a username and password, or use the root username and password. Those are set up on the influxdb command line, not the config file.

If you are getting a timeout, maybe you don’t have a network connection to the influxdb server’s port. You should definitely not assume that having Teamviewer access will give you access to every port on a remote server.

We do this all the time. Your InfluxDBClient initialization looks correct. However, if an SSL connection is required, you will want to use the following information in the “constructor”:

host=<ip_addr>
port=443
username=’user_name’
password=’user_password’
database=’test_hd’
ssl=True
path=’influxdb’

I hope this info helps. (If this doesn’t work, then I’m all out of ideas…)

1 Like