Postgres: After importing production database (with replication) to my local machine, I notice network packets being sent and received from macbook

后端 未结 2 1421
忘掉有多难
忘掉有多难 2021-01-24 08:08

I\'ve been a MySQL guy, and now I\'m working with Postgres so I am learning. Wondering if someone can tell me why my postgres process on my macbook is sending and receiving data

相关标签:
2条回答
  • 2021-01-24 08:51

    In short, I would not expect replication to be enabled for a DB that was dumped from a server that had it if the server to which it was restored had no replication configured at all.

    More detail:

    Normally, to get a local copy of a database in Postgres, one would do a pg_dump of the remote database (this could be done from your laptop, pointing at your server), followed by a createdb on your laptop to create the database stub and then a pg_restore pointed at the dump to populate its contents. [Edit: Re-reading your post, it seems like you may perhaps have done this, but meant that the dump you used had replication enabled.)]

    That would be entirely local (assuming no connections into the DB from off-box), so long as you didn't explicitly setup any replication or anything else that would go off-box. Can you elaborate on what exactly you mean by importing with replication?

    Also, if you're concerned about remote traffic coming from Postgres, try running this command a few times over the period of a minute or two (when you are seeing the traffic):

    netstat | grep postgres
    

    In general, replication in Postgres in configured at a server level, and has to do with things such as the master server shipping WAL files to the standby server (for streaming replication). You would have almost certainly have had to setup entries in postgresql.conf and pg_hba.conf to ensure that the standby server had access (such as a replication entry in the latter conf file). Assuming you didn't do steps such as this, I think it can pretty safely be concluded that there's no replication going on (especially in conjunction with double-checking via netstat).

    You might also double-check the Postgres log to see if it's doing anything replication related. In a default install, that'd probably be in /var/log/postgresql (although I'm not 100% sure if Homebrew installs put it somewhere else).

    0 讨论(0)
  • 2021-01-24 09:14

    If it's UDP traffic, to and from a high port, it's likely to be PostgreSQL's internal statistics collector.

    These are pre-bound to prevent interference and should not be accessible outside of PostgreSQL.

    0 讨论(0)
提交回复
热议问题