Professional Documents
Culture Documents
5.high Availability - 2
5.high Availability - 2
Replication
Replication Allows you to copy and distribute data and objects from one database to another and then
continually stream data modifications as they are made
Replication
Types of Replication
Replication types
Types of Replication
Topology
Transactional replication Components
Transactional Replication Log Reader Agent
Runs at:
Copies transactions:
From distribution database
To subscription database
Checks if Publisher and Subscriber data match if the subscription is marked for validation
Deployment: Wizard or Scripts?
sp_adddistributor
Configures the server as a distributor
sp_adddistributiondb
Creates a distribution database and associated schema
sp_adddistpublisher
Maps a publisher to a specified distribution database
Creating the Publication
sp_replicationdboption
Enable publication for a database
sp_addlogreader_agent
Adds a Log Reader Agent for a given database
sp_addpublication
Creates a snapshot or transactional publication
sp_addpublication_snapshot
Creates a Snapshot Agent
sp_addarticle
Adds an article to a publication
Creating a Push Subscription
Adds a subscription
sp_addpushsubscription_agent(at Publisher)
sp_addsubscription(at Publisher)
Adds a subscription
sp_addpullsubscription(at Subscriber)
Adds a pull subscription
sp_addpullsubscription_agent(at Subscriber)
Creates new scheduled Distribution Agent job
Factors that Affect Replication
Performance
Database volume, availability and collocation matters and contributes to the ‘local
vs. remote’ decision
Sizing can be significantly impacted by retention settings and also the
immediate_syncoption when ‘true’
sp_addpublication’simmediate_sync
The Wizard makes it easy to enable “Create a snapshot immediately and keep the snapshot
available to initialize subscriptions” vs. scheduling at a later time
Log Reader Agent and Transaction Log
Activity
The scan includes all transaction log records, including non-replicated transactions
Excessive Virtual Log File counts due to many small auto-growths increase the overhead, thus increasing transactional
latency
Concurrent I/O path overhead
Hidden Costs of a Single Command
Transactional Replication and Database Mirroring
A role can benefit from its database being mirrored if the replication Agents can connect to it
after a mirroring failover
Publisher (full support)Agent configuration specifies the failover partner so Agents automatically reconnect to the publication
database after a mirroring failover
Subscriber (limited support)No support for automatic reconnection of the Distribution Agent
Subscriptions must be recreated after mirroring failover of subscription database Limited recreation possible using ‘initialize from
LSN’ method
Distributor (no support)Server name of the Distributor cannot change, and a mirroring failover keeps the database name but
changes the server name
Log Reader will wait for log records to harden on the publication database mirror before replicating
to the distribution database
Transactional Replication and Failover Clustering
Supported for all replication roles since the virtual network name and instance name failover with the
database
This is the only mechanism that provides high availability for the distribution database
Virtualization high availability can also be used since the failover occurs at the Virtual Machine level across hypervisor nodes, and
the server and instance names remain the same
Transactional Replication and Availability Groups
New distribution database sp_validate_replica_hosts_as_publishersto verify all replica hosts can serve as
Publishers for the publication
Replication Monitor uses the original Publisher name, not the availability group listener name
Setting Warnings and Thresholds
Replication Monitor enables you to monitor the health of a specific replication topology
In Replication Monitor, when the threshold is met or exceeded, a warning is displayed in the status column for the
subscription and the publication with which it synchronizes
You can enable warnings for the following performance conditions (as applicable to transactional replication)
Imminent subscription expiration
Exceeding the specified latency
Alerts
If jobs are stopped, no alerting associated with the job One solution is to schedule periodic checks on the
agent job status , alerting and/or starting them if stopped
Always on Availability
Read-only Routing
Offloading Backups
Failover Behavior
Setup Monitoring
Always on
Always On Quorum Modes
majority establish quorum and can select a primary node
file share(s) that form a majority establish quorum and can select a primary node
server that all nodes can see. File share should be separate from other nodes
shared disk resource that form a majority establish quorum and can select a primary node
protected resource will select any node it can communicate with as the primary node
Always On AG Without a Domain