Choosing schema in the slave host replication set Usin Slony-I - postgresql

I am using slony-I to replicate tables from one server to another. I have to databases on the master slave that have same exact tables , and i want to replicate them to a single table in the slave. I can create the same tables in different schemas in the slave table , however i cant determine the schema in the replication set in the slave host.
I want to be able to determine the schema i am replicating to on the slave host.
How can i do this in slony?
Thank you

Unfortunately you can't choose the schema on the slave host in slony.The schema name and table name should be identical on both the master and slave. A Work around for this thing is to create another schema on both databases on slave and master and use them in your slony replication

Related

PostgreSQL 10 Logical Replication - is it possible to clone tables?

I have two DB instances with postgresql 10.
First instance working with wal_level = logical, have ALL TABLE publisher. Second - have subscription to the publisher, described above.
All data from the Master DB tables are successfully sending to the replica.
There is only one issue for me - when my App add a new table on Master - I need to add the same table to the replica (and run REFRESH PUBLICATION).
My question - is there a way for replica DB to create new tables automatically?
Schema changes aren't replicated. You can see that in the documentation, at Postgresql 10 Logical Replication: Subscription
The way I handle this is to make all schema changes through a script, and to write the script so that it executes the change commands twice: once on the primary database, and once on the replica.

Is it possible to do Postgresql writable slave?

Is it possible to do writable slave in postgresql master-slave replication model?
Db contains just one unindexed table.
I managed to achieve it with BDR master-master replication, but it eventually tables become locked to writes, both master and slave, for some reason, so I was forced to remove it and try something else.
Im looking to Slony and burcado now, but not sure from docs that I can get writable slave.
Yes, you can have a writable replica using Slony; I'm doing that now at work.
However: the tables that are being replicated can't be modified. You can have other tables in the same database and schema that are writable, just not the ones being replicated.

Postgres master / slave based on table

Currently I have 1 postgres instance which is starting to receive too much load and want create a cluster of 2 postgres nodes.
From reading the documentation for postgres and pgpool, it seems like I can only write to a master and read from a slave or run parallel queries.
What I'm looking for is a simple replication of a database but with master/slave based on which table is being updated. Is this possible? Am i missing it somewhere in the documentation?
e.g.
update users will be executed on server1 and replicated to server2
update big_table will be executed on server2 and replicated back to server1
What you are looking for is called MASTER/MASTER replication. This is supported natively (without PgPool) since 9.5. Note, that it's an "eventually consistent" architecture, so your application should be aware of possible temporary differences between the two servers.
See PG documentation for more details and setup instructions.

How to create or alter database in slave in Postgresql 9.3?

I tried replication in postgres 9.3, and successfully implemented it.
After that i am unable to create new database in slave. It says "cannot execute CREATE TABLE in a read-only transaction." Does this mean i cannot create or alter database in slave?
That is correct. The slave is in read-only mode and all changes you want to make should be done on the master server that propagates it to its slaves. Making the slave read-write would defeat the purpose of the replication (if we are not considering master-master or multi-master replication)

Synchronize two postgresql databases with current data using with bucardo

I try to synchronize two databases using with bucardo. I create master to master replication and it works fine. However rows inserted before replication can not synchronize. I don't want dump one db to the other. How can I do that? Thanks for help.