在第一部分中,所有的系統安裝好Windows Server 2012 R2系統,部署好二層證書服務,打好所有系統補丁,關於證書服務搭建可以參考這裏。SQL服務器安裝好.NET Framework 3.5.1,安裝命令:
install-windowsfeature -name net-framework-core -source G:\sources\sxs\ G盤爲系統光驅所在盤符
現在我們用其中6臺裝好補丁的Windows Server 2012 R2服務器,其中FILE01.contoso.com文件服務器我們用作ISCSI Target服務器。SQL01和SQL02組成SQLDB01羣集,SQL03和SQL04組成SQLDB02羣集,SQL05作爲單臺帶有Reporting Service服務器的數據庫,作爲報表和仲裁見證服務器。
部署Lync Server 前端主數據庫羣集SQLDB01:
將SQL01和SQL02分別安裝3塊網卡,作用分別是:正常網絡,心跳網絡,ISCSI網絡。
心跳和ISCSI的網絡分開,比如我這裏使用192.168.100.0/24和192.168.200.0/24,可以自由選擇。
將網卡順序調到LAN爲主要網絡。
將菜單調出來:
選擇高級中的高級配置:
將LAN這塊網卡的優先級別放到最高,心跳最低:
啓用遠程存儲服務器:
在FILE01.contoso.com上首先安裝ISCSI服務:
創建一個ISCSI Target 和三個VHD硬盤:
Target SQLDB01,Wit.vhd 1G見證盤,DTC.vhd 2G DTC服務用,SQLDB01.vhd 100G 數據庫使用。
選擇VHD硬盤存儲位置:
輸入VHD名稱和位置:
選擇大小和硬盤類型,三種類型,一種是標準大小,這種類型讀寫速度快,但是無用空間佔用多,一種是動態,這種特點是節省空間,但是性能一把,第三種是差異硬盤,需要基於一塊母盤。我們這裏使用動態的:
爲該vhdx分配ISCSITarget,我們選擇創建新ISCSI Target:
輸入Target名稱:
爲該Target添加ISCSI連接:
將SQL01和SQL02加入:
如圖所示:
其他配置都不用啓用,可以跳過,點擊創建:
完成後,把另外兩塊VHDX也添加上後,我們登陸SQL01和SQL02,配置ISCSI連接:
在SQL01、SQL02上打開ISCSI Initiator,在目標處輸入FILE01配置的ISCSI網卡的地址,這樣可以使ISCSI不佔用普通網絡帶寬:
點擊快速連接即可:
這時在磁盤管理中我們看到多了三塊硬盤,將他們online並格式化:
在SQL01和SQL02上安裝故障轉移羣集服務:
兩臺SQL都安裝完畢後,打開故障轉移羣集管理臺,選擇評估配置:
輸入SQL01,SQL02
選擇所有測試:
點擊Next開始,等待一陣子後,測試完成看到測試全部通過:
勾選立刻創建該羣集,就會自動開始創建羣集:
輸入羣集名稱和羣集IP地址:
自動創建完成,省了很多事,勾選自動添加所有可用共享存儲到羣集,這樣我們的三塊硬盤會自動添加:
可以看到創建完成,並且把我們的1G的硬盤當做了見證盤:
之後打開羣集節點,選擇配置角色:
選擇DTC服務,這是SQL羣集必須的組件:
輸入名稱和IP地址:
選擇2G那塊硬盤:
點擊Next完成:
安裝SQL 2012 SP1:
在SQL01上打開SQL2012安裝程序,選擇羣集安裝:
通過自檢:
輸入序列號後,接受許可協議:
看到自檢一個防火牆的警告,可以忽略,後面我們人工開放防火牆端口:
選擇安裝SQL的功能:
通過自檢:
輸入數據庫羣集名稱和實例名稱:
硬盤檢測通過:
選擇數據存儲盤:
輸入SQL的服務賬號,字符集可以用默認的:
添加管理員:
自檢通過,可以開始安裝:
之後開始安裝:
安裝完成後,我們登陸SQL02繼續添加節點:
沒什麼特殊需要配置的,這裏就不再詳細描述了。
最後我們需要爲SQL服務開啓防火牆端口,當然你可以直接關閉防火牆,妥妥兒的,這裏我多花了一些功夫來鑽研到底需要哪些端口:
New-NetFirewallRule -DisplayName "Allow Inbound SQL Server (SQLServer)" -Direction Inbound -Protocol TCP -LocalPort 1433 -
RemoteAddress LocalSubnet -Action Allow
New-NetFirewallRule -DisplayName "Allow Inbound SQL Server (SQL Admin Connection)" -Direction Inbound -Protocol UDP -
LocalPort 1434 -RemoteAddress LocalSubnet -Action Allow
New-NetFirewallRule -DisplayName "Allow Inbound SQL Server (SQL Admin Connection)" -Direction Inbound -Protocol TCP -
LocalPort 1434 -RemoteAddress LocalSubnet -Action Allow
New-NetFirewallRule -DisplayName "Allow Inbound SQL Server (SQL Service Broker)" -Direction Inbound -Protocol TCP -
LocalPort 4022 -RemoteAddress LocalSubnet -Action Allow
New-NetFirewallRule -DisplayName "Allow Inbound SQL Server (SQL Debugger/RPC)" -Direction Inbound -Protocol TCP -LocalPort
135 -RemoteAddress LocalSubnet -Action Allow
New-NetFirewallRule -DisplayName "Allow Inbound SQL Server (Analysis Services)" -Direction Inbound -Protocol TCP -LocalPort
2383 -RemoteAddress LocalSubnet -Action Allow
New-NetFirewallRule -DisplayName "Allow Inbound SQL Server (SQL Browser)" -Direction Inbound -Protocol TCP -LocalPort 2382
-RemoteAddress LocalSubnet -Action Allow
New-NetFirewallRule -DisplayName "Allow Inbound SQL Server (SQL Mirroring1)" -Direction Inbound -Protocol TCP -LocalPort
5022 -RemoteAddress LocalSubnet -Action Allow
New-NetFirewallRule -DisplayName "Allow Inbound SQL Server (SQL Mirroring2)" -Direction Inbound -Protocol TCP -LocalPort
7022 -RemoteAddress LocalSubnet -Action Allow
New-NetFirewallRule -DisplayName "Allow Inbound SQL Server (http)" -Direction Inbound -Protocol TCP -LocalPort 80 -
RemoteAddress 192.168.1.0/24 -Action Allow
New-NetFirewallRule -DisplayName "Allow Inbound SQL Server (https)" -Direction Inbound -Protocol TCP -LocalPort 443 -
RemoteAddress 192.168.1.0/24 -Action Allow
New-NetFirewallRule -DisplayName "Allow Inbound SQL Server (SQL Server Dynamic)" -Direction Inbound -Program
"%ProgramFiles%Microsoft SQL ServerMSSQL11.RTCMSSQLBinnsqlservr.exe" -RemoteAddress LocalSubnet -Action Allow
Enable-NetFirewallRule -DisplayName "File and Printer Sharing (NB-Name-In)"
Enable-NetFirewallRule -DisplayName "File and Printer Sharing (NB-Datagram-In)"
Enable-NetFirewallRule -DisplayName "File and Printer Sharing (NB-Session-In)"
Enable-NetFirewallRule -DisplayName "File and Printer Sharing (SMB-In)"
Enable-NetFirewallRule -DisplayName "Inbound Rule for Remote Shutdown (RPC-EP-In)"
Enable-NetFirewallRule -DisplayName "Inbound Rule for Remote Shutdown (TCP-In)"
在所有SQL服務器跑如上代碼,注意替換網段爲自己的環境網段。
之後防火牆配置即可完成,然後我們講SQL03,SQL04組成SQLDB02羣集。作爲鏡像數據庫使用