Mettre en place une réplication continue / CDC (bascule sans interruption)
Oracle
# CDC-based replication with Oracle GoldenGate (outline)
# 1) Enable supplemental logging on the source:
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
# 2) Extract (capture changes from redo) and Replicat (apply to the target) processes:
# GGSCI> ADD EXTRACT ext1, INTEGRATED TRANLOG, BEGIN NOW
# GGSCI> ADD REPLICAT rep1, INTEGRATED
# Alternative: initial load with Data Pump + incremental capture with GoldenGateDans Oracle, l'outil standard pour le CDC sans interruption/hétérogène est Oracle GoldenGate : le processus Extract capture les modifications dans les redo logs et Replicat les applique à la cible ; le supplemental logging doit être activé. Migration typique : le chargement initial se fait avec Data Pump, puis GoldenGate transmet en continu les modifications à la cible, ce qui permet une bascule quasi sans interruption.
PostgreSQL
-- Source (publisher): create a publication (wal_level must be logical)
CREATE PUBLICATION migration_pub FOR ALL TABLES;
-- Target (subscriber): create a subscription (initial copy + continuous stream)
CREATE SUBSCRIPTION migration_sub
CONNECTION 'host=source dbname=shop user=repl password=***'
PUBLICATION migration_pub;PostgreSQL fournit le CDC via la réplication logique intégrée : CREATE PUBLICATION sur la source, CREATE SUBSCRIPTION sur la cible. Au démarrage, la souscription copie les données existantes (copie initiale), puis transmet en continu les modifications du WAL ; wal_level=logical est requis. Pour les scénarios volumineux/complexes, pglogical ou Debezium est préférable.
MySQL
-- Source: binlog must be enabled and in ROW format (log_bin, binlog_format=ROW)
-- Grant a replication user: GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%';
-- Define the source on the target (start from the binlog position of the initial load):
CHANGE REPLICATION SOURCE TO
SOURCE_HOST='source', SOURCE_USER='repl', SOURCE_PASSWORD='***',
SOURCE_LOG_FILE='binlog.000001', SOURCE_LOG_POS=1547;
START REPLICA;Dans MySQL, une bascule sans interruption se fait par réplication basée sur le binlog. Le chargement initial se fait avec mysqldump --source-data et la position binlog/le GTID est enregistré ; sur la cible, la réplication démarre à cette position avec CHANGE REPLICATION SOURCE TO (syntaxe 8.0.23+ ; anciennement CHANGE MASTER TO). START REPLICA applique les modifications en continu. Une configuration basée sur GTID est plus sûre.
SQL Server
-- Option A: Transactional Replication (publisher->distributor->subscriber) — SSMS wizard
-- Option B: Change Data Capture (track changes as tables)
EXEC sys.sp_cdc_enable_db; -- enable CDC at database level
EXEC sys.sp_cdc_enable_table
@source_schema = N'dbo', @source_name = N'customer',
@role_name = NULL; -- enable CDC at table level
-- Changes are read from the cdc.dbo_customer_CT table and moved to the target.SQL Server offre deux voies principales pour la réplication continue : pour un flux direct vers la cible, mettez en place la Transactional Replication (publisher/subscriber) ; si vous transférez les modifications avec votre propre ETL, activez Change Data Capture (sp_cdc_enable_db + sp_cdc_enable_table) et lisez les tables _CT. Pour des cibles hétérogènes, le CDC se combine avec AWS DMS/Debezium.
MongoDB
// Watch changes live with Change Streams (requires a replica set/sharded cluster)
const cs = db.customer.watch([], { fullDocument: "updateLookup" });
while (cs.hasNext()) { printjson(cs.next()); } // apply to the target
// Official tool for managed cluster-to-cluster replication/migration: mongosync
// mongosync --cluster0 "mongodb://source" --cluster1 "mongodb://target"Dans MongoDB, les Change Streams servent au CDC : db.collection.watch() transmet en direct depuis l'oplog les événements insert/update/delete à appliquer à la cible (un replica set est requis). Pour une migration/réplication continue complète de cluster à cluster, l'outil officiel Cluster-to-Cluster Sync de MongoDB, mongosync (non spécifique à Atlas ; il fonctionne aussi avec des clusters autogérés), gère le chargement initial + la synchronisation continue.
Redis
# Make the target instance a replica of the source (live synchronization)
# On the target Redis:
REPLICAOF source_host 6379
# Monitor sync status:
INFO replication # master_link_status must be up
# Once the cutover is complete, make the target standalone:
REPLICAOF NO ONEDans Redis, une bascule sans interruption se fait par réplication native : exécutez REPLICAOF <source host port> (anciennement SLAVEOF) sur le serveur cible ; la cible reçoit d'abord le RDB complet, puis reste synchronisée en continu via le flux de commandes. Vérifiez master_link_status:up avec INFO replication et, une fois la bascule terminée, rendez la cible autonome avec REPLICAOF NO ONE.
Elasticsearch
# Incremental reindex from the old cluster to the new one within the same version family
POST _reindex?wait_for_completion=false
{ "source": { "remote": { "host": "http://old:9200" }, "index": "customer",
"query": { "range": { "updated_at": { "gt": "<last-cursor>" } } } },
"dest": { "index": "customer" } }
# Licensed feature: Cross-Cluster Replication (CCR) — continuous following
# On the target (follower) cluster: PUT /customer/_ccr/follow { "remote_cluster": "old", "leader_index": "customer" }La véritable fonctionnalité de réplication continue d'Elasticsearch est Cross-Cluster Replication (CCR) : le cluster cible suit le leader index de la source et récupère les modifications en continu (nécessite une licence commerciale/Platinum). Sans licence, une synchronisation quasi continue s'obtient par remote reindex périodique (incrémental, basé sur un champ de temps/séquence).