Home Database Mysql Tutorial 在Windows Server 2012 R2中搭建SQL Server 2012故障转移集群

在Windows Server 2012 R2中搭建SQL Server 2012故障转移集群

Jun 07, 2016 pm 04:33 PM

本文讲解下在Windows Server 2012 R2中搭建SQL Server 2012故障转移集群的详细过程。需要说明的是我们搭建的SQL Server故障转移集

本文讲解下在Windows Server 2012 R2中搭建SQL Server 2012故障转移集群的详细过程。

需要说明的是我们搭建的SQL Server故障转移集群(SQL Server Failover Cluster)是可用性集群,而不是负载均衡集群,其目的是为了保证服务的连续性和可用性,而不是为了提高服务的性能。

SQL Server始终在负载均衡集群方面都缺少自己的产品,多由第三方厂家提供,但SQL Server故障转移集群却由来已久,在SQL Server 2012还提供了一个可用性组(AlwaysOn High Availability Groups)的新特性,我们知道微软的故障转移集群(Windows Server Failover Clustering , WSFC)一般需要共享存储,SQL Server故障转移集群也是建立在WSFC的基础之上,可用性组却可以不依赖于共享存储实现SQL Server的故障转移,这为没有共享存储的环境提供了一个实现SQL Server高可用的解决方案,关于AlwaysOn特性可以参阅相关文档,这里我们实现的是仍是基于共享存储的包含两个节点的SQL Server故障转移集群。

一、搭建Windows故障转移集群(WSFC)

SQL Server故障转移集群是基于WSFC的,因而我们需要事先在两个节点中搭建一个WSFC,这里需WSFC仅是一个容器,可以放置多个角色以实现这些角色的故障转移。为搭建一个WSFC,除了需要域环境,还需要在节点,存储,网络等方面做准备。

Cluster

1、在各节点中添加Failover Clustering服务器功能。

image

2、确保各节点操作系统的更新一致,新安装的系统要么更新到最新,要么暂不更新。

3、在各节点中配置管理网络和心跳网络,虽然一个可用网络既可以搭建集群,但是最佳实践还是分开。

4、在各节点中配置共享存储磁盘,初始化并格式化磁盘,分配盘符。这里的共享存储磁盘可以是基于IP SAN和FC SAN的磁盘,也可以是基于文件服务器的虚拟磁盘,具体可以参考Windows Server 2012 虚拟化测试:存储。在节点中可见磁盘如下:

image

为搭建SQL Server故障转移集群,至少需要准备两块共享磁盘:集群见证磁盘Q、为存储SQL Server数据库和日志文件准备的集群磁盘S。另外我们需要为SQL Server的集群实例配置分布式事务协调器(Distributed Transaction Coordinator, DTC),因而需要为DTC准备磁盘M。微软建议将SQL Server各类文件分开存储,最佳实践需准备两块以上共享磁盘,分别存储User Database、Backup和User Database Log文件,这就至少需要另一个集群磁盘L。综上我们对存储做如下配置:

另外值得一提的是到SQL Server 2014才提供了对集群共享卷的支持,因而这里只能使用集群磁盘。

5、使用Failover Cluster Manager验证并创建集群。完成后的集群磁盘视图如下:

image

 

二、安装SQL Server故障转移集群

Windows故障转移集群(WSFC)搭建成功后即完成了SQL Server故障转移集群的基础,接下来我们继续完成SQL Server部分。先在一个节点上安装SQL Server Failover Cluster,然后再另一个节点安装加入集群节点。

image

SQL Server集群部分,先通过验证,这里的警告主要是搭建Windows故障转移集群存在警告的警告,升级警告以及防火墙警告,可以继续。

image

选择Database Engine Services和管理组件,注意这里只有Database Engine Services和Analysis Services支持集群,其他服务都不支持。其他组件如需要也可以随后再添加,但是添加其他组建时选择Add features to an existing installation,然后选择Perfom a new installation of SQL Server 2012,而不是Add features to an existing instance of SQL Server 2012,否则最后会出现Existing clustered or cluster-prepared instance的错误,具体参考Installing SQL Integration Services after SQL Cluster Setup has Completed。

image

配置一个网络名称,类似于计算机名称,今后将通过该名称访问数据库实例。

image

 

 

三、配置DTC和SQL Server 集群

分布式事务协调器(Distributed Transaction Coordinator, DTC)在Windows中是默认安装并运行的服务。DTC的主要目的是为了实现分布式事务,确保跨进程通信的一致性,这里的进程可以是同一计算机中的两个进程,也可以是不同计算机中的进程。因而在微软的世界里,常常看到DTC的身影。

如果只是独立安装SQL Server数据库引擎则无需配置DTC。但是在同时运行SQL Serve集成服务(SQL Server Integration Services, SSIS)或者搭建SQL Sever故障转移集群等需要分布式事务的场景中,则需要配置DTC。不配置DTC并不影响SQL Server集群的安装,但是DTC没能正确配置,SQL Server集群的功能将受到影响。

Windows Server 2008及以后版本在一个Windows集群中可以有多个DTC实例,这些DTC实例可以是集群实例也可以是本地实例(这里“实例”概念的类似于SQL Server数据库引擎实例,是作为操作系统服务运行的,是同一个可执行程序的副本,在Windows集群中运行的各类服务都是以实例的形式存在,这些实例依赖Windows集群实现故障转移),甚至可以为SQL Server集群中每个SQL Server实例配置一个专属的DTC实例。SQL Server集群实例按照如下的是顺序选择DTC实例:

  • 使用SQL Server实例专属的DTC实例,该DTC实例作为SQL Server实例以来的资源,如果DTC实例失败,将造成SQL Server实例的失败。SQL Server 2008及以后版本才有此项。

  • 使用映射给SQL Server实例的DTC实例,使用命令msdtc可以为SQL Server实例映射DTC实例。

  • Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    AI Hentai Generator

    AI Hentai Generator

    Generate AI Hentai for free.

    Hot Article

    Repo: How To Revive Teammates
    1 months ago By 尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
    2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    Hello Kitty Island Adventure: How To Get Giant Seeds
    1 months ago By 尊渡假赌尊渡假赌尊渡假赌

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    How to solve the problem of mysql cannot open shared library How to solve the problem of mysql cannot open shared library Mar 04, 2025 pm 04:01 PM

    This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

    Reduce the use of MySQL memory in Docker Reduce the use of MySQL memory in Docker Mar 04, 2025 pm 03:52 PM

    This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

    How do you alter a table in MySQL using the ALTER TABLE statement? How do you alter a table in MySQL using the ALTER TABLE statement? Mar 19, 2025 pm 03:51 PM

    The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

    Run MySQl in Linux (with/without podman container with phpmyadmin) Run MySQl in Linux (with/without podman container with phpmyadmin) Mar 04, 2025 pm 03:54 PM

    This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

    What is SQLite? Comprehensive overview What is SQLite? Comprehensive overview Mar 04, 2025 pm 03:55 PM

    This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

    How do I configure SSL/TLS encryption for MySQL connections? How do I configure SSL/TLS encryption for MySQL connections? Mar 18, 2025 pm 12:01 PM

    Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

    Running multiple MySQL versions on MacOS: A step-by-step guide Running multiple MySQL versions on MacOS: A step-by-step guide Mar 04, 2025 pm 03:49 PM

    This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

    What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? Mar 21, 2025 pm 06:28 PM

    Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

    See all articles