The Sqlserver2008 mirroring feature ensures high availability of the database. Database mirroring maintains two copies of the database, which must be placed in separate instances of the SQL Server database. You can use two servers or a different instance of a server to host, but the instance must have a different data mirroring port. One of the databases for client access, acting as the "principal server" role, and the other based on the configuration and status of the mirroring session, acting as a hot standby server, the "mirror server Role", when the principal server fails, you can switch to the backup server to act as the principal server function, The process of switching can either be manual or automatic, and automatic switchover must be added a "Witness server role" to monitor whether the principal service supports automatic failover of database services.
The principle of synchronization between the principal server and the mirror server is not described here, see Microsoft Official website: http://msdn.microsoft.com/zh-cn/library/ms189852.aspx.
Setup steps:
1. Environment preparation
The database service SQLSERVER2008R2 must be installed with the same version.
Open the database service and Proxy service after installation.
The firewall opens database port 1433 and service port 5022.
Primary server ip:10.172.12.106
Mirror server ip:10.171.84.74
Witness Server ip:10.172.7.185
2. Modify the server host file
Open the host file that modifies these three servers, respectively, and add the following points to:
10.173.12.106 iz25mnky5m8z
10.171.83.74 IZ254PD4SIQZ
10.173.7.185 Iz25gj54e7pz
The machine name corresponding to the server behind
3. Backup and restore the database
The target database recovery model must be full.
Backup Database and BACKUP log select the same file.
When restoring on the mirror server, restore option Select Overwrite existing database recovery status Select Do not select any action for database ....
4. Start Mirroring operation
5. Status after completion
The principal server data is: Principal, synchronized,
Mirror Machine Server database is: Mirror, synchronized, restoring ...
SQLSERVER2008R2 Database Mirroring configuration steps