Queries on implementing postgres logical replication for production? - postgresql

Will there be any situation where the replication gets failed? If so
how to manage that failover?
Is there any queries to identify the no.of pending records to be replicated?
How to manage failover/DR like situation?
Can we do publication/subscription setup from a read only DB?

Related

citus: Can I add one more replica for a distributed table

I have a distributed table,but this table only has one replica,only one replica doesn't have
ha, I want and one more replica for the table,can i? how to do?
I have search online help docs,but didn't find any solution.
Replica's in Citus are not an HA solution. For HA you will need to setup any postgres tooling for every member in your cluster to stream WAL to another node. Citus specializes in distributed queries and separates that problem from HA by relying on proven technology available in the postgres ecosystem.
If you want to scale out reads adding a replica can help. However adding replica's have a significantly high impact on write throughput. Before adding replica's please thoroughly test that your database can handle your expected load. And yet again, if HA is your goal, don't add Citus replica's instead, apply postgres HA solutions to every worker and coordinator.
Increasing the replica count of an already distributed table is due to above reasoning not an operation Citus provides out of the box. Easiest would be to create a new table and use an INSERT INTO SELECT clause to reinsert the data into a table with appropriate shard_count and replica's according to your application needs.

MonogDB - Replication - can two Nodes write?

I have two Servers in action with loadbalancing. To ensure redundancy and failover security I need to implement some kind of mirroring.
However both of these Servers need to be able to write and not only one ( = not Master-Slave).
Is this possible with MongoDB?
Sharding is not a solution because I would lose half the data when a server crashes.
Replication is not a solution because one of the Servers is unable to write/update the DB on the other service.

Is logical replication using pglogical possible with timescaleDB?

I set up a fully functional logical replication of multiple masters to one slave.
As soon as I convert any of the replicated tables to timescaleDB's hypertable, the replication stops working - only the structure is replicated, but no data.
Is it possible to use timescaleDB together with pglogical? Would it be possible to use PostgreSQL 10 and its in-built logical replication abilities?
My guess is, that logical replication doesn't make sense in the context of tables consisting of virtual chunks.
No.
To our knowledge, PG10's logical replication will not work with
hypertables, because it actually doesn't replicate DDL commands, and
instead just does a pub/sub on the data.
- Mike Freedman, CTO TimescaleDB (04.04.2019)
More info: https://github.com/timescale/timescaledb/issues/1138#issuecomment-479674594

postgres streaming replication - slave only index

We have successfully deployed Postgres 9.3 with streaming replication (WAL replication). We currently have 2 slaves, the second slave being a cascaded slave from the first slave. Both slaves are hot-standby's with active read-only connections in use.
Due to load, we'd like to create a 3rd slave, with slightly different hardware specifications, and a different application using it as a read-only database in more of a Data Warehouse use-case. As it's for a different application, we'd like to optimize it specifically for that application, and improve performance by utilizing some additional indexes. For size and performances purposes, we'd rather not have those indexes on the master, or the other 2 slaves.
So my main question is, can we create different indexes on slaves for streaming replication, and if not, is there another data warehouse technique that I'm missing out on?
So my main question is, can we create different indexes on slaves for streaming replication
No, you can't. Streaming physical replication works at a lower level than that, copying disk blocks around. It doesn't really pay attention to "this is an index update," "this is an insert into a table," etc. It does not have the information it'd need to maintain standby-only indexes.
and if not, is there another data warehouse technique that I'm missing out on?
Logical replication solutions like:
Londiste
pglogical
Slony-I
can do what you want. They send row changes, so the secondary server can have additional indexes.

Replication of CouchDB like at mongoDB

Is there a way of configuring couchDB with automatic replication like it is done with mongodbs replica sets? -> without any additional frameworks?
You can replicate a database in CouchDB by sending a POST request to the _replicate URL.
http://wiki.apache.org/couchdb/Replication
If you want to continuously update the future data in the replicated version, you can use continuous replication
http://wiki.apache.org/couchdb/Replication#Continuous_replication