How to: Configure Peer-to-Peer Transactional Replication (Replication Transact-SQL Programming)
Configuring a peer-to-peer replication topology is very similar to configuring a series of standard transactional publications and subscriptions using replication stored procedures. The initial data must be present on each node before the topology is configured. For more information about this type of transactional replication topology, see Réplica transaccional de punto a punto.
[!NOTA] Each node in a peer-to-peer topology should already be configured as a Publisher and be associated with a local or remote Distributor. If you use a remote Distributor, we recommend you do not use the same remote Distributor for all nodes because this is potentially a single point of failure.
Procedure
To set up peer-to-peer replication among three nodes
Use Microsoft SQL Server backup and restore functionality to initialize data for the publication at each node on the topology. For more information, see Copiar bases de datos con Copia de seguridad y Restaurar.
At node A, execute sp_addpublication (Transact-SQL). Specify a value of true for @enabled_for_p2p, a value of active for @status and a value of true for @allow_initialize_from_backup.
At node A, execute sp_addsubscription (Transact-SQL). Specify the name of the publication created in step 2 as @publication, the name of node B as @subscriber, the name of the target database at node B as @destination_db, and a value of replication support only for @sync_type.
At node A, again execute sp_addsubscription (Transact-SQL). This time, specify the name of the publication created in step 2 as @publication, the name of node C as @subscriber, the name of the target database at node C as @destination_db, and a value of replication support only for @sync_type.
At node B, execute sp_addpublication (Transact-SQL). Specify the name of the publication created in step 2 for @publication, a value of true for @enabled_for_p2p, a value of active for @status and a value of true for @allow_initialize_from_backup.
At node B, execute sp_addsubscription (Transact-SQL). Specify the name of the publication created in step 2 as @publication, the name of node A as @subscriber, the name of the target database at node A as @destination_db, and a value of replication support only for @sync_type.
At node B, again execute sp_addsubscription (Transact-SQL). This time, specify the name of the publication created in step 2 as @publication, the name of node C as @subscriber, the name of the target database at node C as @destination_db, and a value of replication support only for @sync_type.
At node C, execute sp_addpublication (Transact-SQL). Specify the name of the publication created in step 2 for @publication, a value of true for @enabled_for_p2p, a value of active for @status and a value of true for @allow_initialize_from_backup.
At node C, execute sp_addsubscription (Transact-SQL). Specify the name of the publication created in step 2 as @publication, the name of node A as @subscriber, the name of the target database at node A as @destination_db, and a value of replication support only for @sync_type.
At node C, again execute sp_addsubscription (Transact-SQL). This time, specify the name of the publication created in step 2 as @publication, the name of node B as @subscriber, the name of the target database at node B as @destination_db, and a value of replication support only for @sync_type.
Vea también
Tareas
Conceptos
Programming Replication Using System Stored Procedures