0

I want to share data between two PostgreSQL databases sitting on two different servers/machines/hosts. My application is: I am fetching data on Modbus TCP/IP from field devices on Server-1(static IP) having PostgreSQL database running in it. I need this fetched data to be shared with other Server-2(static IP), also PostgreSQL installed in it over internet. Can someone guide me how it can be implemented?

Thanks in advance.

Gautam
  • 1
  • 1
  • 2

1 Answers1

0

You can use dblink extension to fetch data from other machine. E.g. below query is getting data from other machine hosted on 162.0.0.0 and other DB related credentials. It is simply selecting two columns

SELECT cen.* FROM
    dblink('dbname=DBname port=5432 host=162.0.0.0
       user=dbuser password=123',
      'select name, age 
    from persons where age= 15')
AS cen(name character varying, x integer)
lat long
  • 920
  • 6
  • 16