title: Not able to perform base backup in postgres replication. Error: pg_basebackup: could not connect to server
body: <p>I am running postgresql 11.2 inside docker containers.
  While preparing the master and standBy PostgreSQL instances for streaming replication, I have enabled archiving on the master server. After this I need to run the <code>pg_basebackup</code> command on the standBy server to take a backup from master to standBy.
  No matter what I do, I am facing the same error:</p>
  <pre><code>pg_basebackup: could not connect to server: FATAL:  no pg_hba.conf entry for replication connection from host &quot;10.244.0.1&quot;, user &quot;repluser&quot;, SSL off
  </code></pre>
  <p>Commands I am running using <code>postgres</code> user, inside the docker container running standBy server, are:</p>
  <pre><code>pg_basebackup -h 10.0.0.1 -D /data/postgres -U repluser -v -P --wal-method=stream
  </code></pre>
  <p>OR</p>
  <pre><code>pg_basebackup -h 10.0.0.1 -U repluser -Ft -D /data/postgres
  </code></pre>
  <p>(Please assume 10.0.0.1 is my master server's IP and 10.0.0.2 is my standBy server's IP. They are in same subnet)</p>
  <p>The <code>pg_hba.conf</code> file on the master server looks like this:</p>
  <pre><code># TYPE  DATABASE        USER            ADDRESS                 METHOD
  
  # &quot;local&quot; is for Unix domain socket connections only
  local   all             all                                     trust
  # IPv4 local connections:
  host    all             all             127.0.0.1/32            trust
  # IPv6 local connections:
  host    all             all             ::1/128                 trust
  # Allow replication connections from localhost, by a user with the
  # replication privilege.
  local   replication     all                                     trust
  host    replication     all             127.0.0.1/32            trust
  host    replication     all             ::1/128                 trust
  
  host all all all md5
  
  # TYPE  DATABASE        USER            ADDRESS                 METHOD
  host    replication     repluser        10.0.0.2/32             trust
  </code></pre>