Use REPL_PORT for pg_basebackup in postgresql_replication_setup.sh