怎樣建立高可用性網(wǎng)絡(luò)-創(chuàng)新互聯(lián)

前言

創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比富民網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫(kù),直接使用。一站式富民網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋富民地區(qū)。費(fèi)用合理售后完善,10余年實(shí)體公司更值得信賴。

  隨著網(wǎng)絡(luò)的快速普及和應(yīng)用的日益深入,各種增值業(yè)務(wù)在網(wǎng)絡(luò)上得到了廣泛部署,網(wǎng)絡(luò)帶寬也以指數(shù)級(jí)增長(zhǎng),網(wǎng)絡(luò)短時(shí)間的中斷就可能影響大量業(yè)務(wù),造成重大損失。作為業(yè)務(wù)承載主體的基礎(chǔ)網(wǎng)絡(luò),其高可用性(High Availablity,HA)也因此日益成為關(guān)注的焦點(diǎn)。在這種背景下,從運(yùn)營(yíng)商到大中型企業(yè)客戶,在構(gòu)建生產(chǎn)網(wǎng)絡(luò)(production network)時(shí),5個(gè)9的網(wǎng)絡(luò)可用性(一年中不能提供服務(wù)的時(shí)間在5分鐘左右),已經(jīng)成為建網(wǎng)的追求。對(duì)于設(shè)備提供商或解決方案提供商來說,能否提供端到端的高可用性網(wǎng)絡(luò)解決方案,不但是廠商技術(shù)實(shí)力的反映,也是關(guān)乎能否在未來激烈的競(jìng)爭(zhēng)中生存的關(guān)鍵。

如何定義高可用性網(wǎng)絡(luò)

  那么,如何衡量一個(gè)網(wǎng)絡(luò)的可用性呢?首先,一個(gè)高可用性網(wǎng)絡(luò)不能頻頻出現(xiàn)故障,只要發(fā)生故障,即使是很短時(shí)間的中斷,都會(huì)影響業(yè)務(wù)運(yùn)營(yíng),特別在當(dāng)前適時(shí)性強(qiáng)、對(duì)丟包和時(shí)延敏感的業(yè)務(wù),如語(yǔ)音和視頻等業(yè)務(wù)在網(wǎng)絡(luò)上廣泛部署的情況下更是如此。其次,高可用性的網(wǎng)絡(luò),即使出現(xiàn)故障,也應(yīng)該能很快恢復(fù)。如果一個(gè)網(wǎng)絡(luò)一年不出一次故障,但一次故障需要幾個(gè)小時(shí),甚至幾天才能恢復(fù),那么這個(gè)網(wǎng)絡(luò)也算不上一個(gè)高可用的網(wǎng)絡(luò)。事實(shí)上,故障少、故障恢復(fù)時(shí)間短基本就概括了高可用性網(wǎng)絡(luò)的特點(diǎn)。在實(shí)際網(wǎng)絡(luò)中,軟、硬件的版本質(zhì)量是有極限的,并且也避免不了各種人為和非技術(shù)因素造成的網(wǎng)絡(luò)故障和服務(wù)中斷?;谶@個(gè)原因,開發(fā)能讓網(wǎng)絡(luò)迅速?gòu)墓收现谢謴?fù)的技術(shù)非常重要。事實(shí)上,如果網(wǎng)絡(luò)總是能在不中斷(絕大部分)業(yè)務(wù)的情況下恢復(fù),對(duì)多數(shù)用戶,就其業(yè)務(wù)體驗(yàn)來說,甚至可以認(rèn)為是無故障的。

總體方案(5個(gè)方面)

1.服務(wù)器 群集 (windows  linux  防火墻)

2.路由節(jié)點(diǎn)  (HSRP  VRRP)

3.線路  (lan:stp  wan:【備份技術(shù)】)

4.磁盤  (raid   raid1 raid5  raid6  raid10)

5.網(wǎng)卡 (bond)

具體方案實(shí)施步驟及過程:

方案2.vrrp

VRRP即虛擬路由器冗余協(xié)議。虛擬路由器冗余協(xié)議(VRRP)是一種選擇協(xié)議,它可以把一個(gè)虛擬路由器的責(zé)任動(dòng)態(tài)分配到局域網(wǎng)上的 VRRP 路由器中的一臺(tái)??刂铺摂M路由器 IP 地址的 VRRP 路由器稱為主路由器,它負(fù)責(zé)轉(zhuǎn)發(fā)數(shù)據(jù)包到這些虛擬 IP 地址。一旦主路由器不可用,這種選擇過程就提供了動(dòng)態(tài)的故障轉(zhuǎn)移機(jī)制,這就允許虛擬路由器的 IP 地址可以作為終端主機(jī)的默認(rèn)第一跳路由器。使用 VRRP 的好處是有更高的默認(rèn)路徑的可用性而無需在每個(gè)終端主機(jī)上配置動(dòng)態(tài)路由或路由發(fā)現(xiàn)協(xié)議。 VRRP 包封裝在 IP 包中發(fā)送。

VRRP拓?fù)鋱D

怎樣建立高可用性網(wǎng)絡(luò)

所需設(shè)備:

quidway R2621    3臺(tái)

quidway S2403H-EI  2臺(tái)

主機(jī)  4臺(tái)

具體步驟:

SW1配置

<Quidway>system-view

System View: return to User View with Ctrl+Z.

[Quidway]sys

[Quidway]sysname SW1

[SW1]vlan 10

[SW1-vlan10]port e1/0/10

[SW1-vlan10]vlan 20

[SW1-vlan20]port e1/0/20

[SW1-vlan20]int e1/0/1

[SW1-Ethernet1/0/1]port link-type trunk

[SW1-Ethernet1/0/1]port trunk permit vlan all

Please wait........................................... Done.

[SW1-Ethernet1/0/1]dis vlan

The following VLANs exist:

 1(default), 10, 20

[SW1-Ethernet1/0/1]int e1/0/24

[SW1-Ethernet1/0/24]port link-type trunk

[SW1-Ethernet1/0/24]port trunk permit vlan all

Please wait........................................... Done.

SW2配置

<Quidway>system-view

System View: return to User View with Ctrl+Z.

[Quidway]sysname SW2

[SW2]vlan 10

[SW2-vlan10]port e1/0/10

[SW2-vlan10]vlan 20

[SW2-vlan20]port e1/0/20

[SW2-vlan20]int e1/0/1

[SW2-Ethernet1/0/1]port link-type trunk

[SW2-Ethernet1/0/1]port trunk permit vlan all

Please wait........................................... Done.

[SW2-Ethernet1/0/1]int e1/0/24

[SW2-Ethernet1/0/24]port link-type trunk

[SW2-Ethernet1/0/24]port trunk permit vlan all

Please wait........................................... Done.

R3配置

[Router]sysname R3

[R3]int e0

[R3-Ethernet0]ip add 3.3.3.3 24

[R3-Ethernet0]loopback

[R3-Ethernet0]int s0

[R3-Serial0]ip add 1.1.1.2 24

[R3-Serial0]shut

[R3-Serial0]undo shut

[R3-Serial0]int s1

[R3-Serial1]ip add 1.1.2.2 24

[R3-Serial1]shut

[R3-Serial1]undo shut

R1配置

[Router]sysname R1

[R1]int s0

[R1-Serial0]ip add 1.1.1.1 24

[R1-Serial0]shut

[R1-Serial0]undo shut

[R1-Serial0]int e0.1

[R1-Ethernet0.1]vlan-type dot1q vid 10

[R1-Ethernet0.1]ip add 192.168.10.1 24

[R1-Ethernet0.1]int e0.2

[R1-Ethernet0.2]vlan-type dot1q vid 20

[R1-Ethernet0.2]ip add 192.168.20.1 24

[R1-Ethernet0.2]quit

[R1]ip route-static 0.0.0.0 0.0.0.0 1.1.1.2

[R1]ping 3.3.3.3

 PING 3.3.3.3: 56  data bytes, press CTRL_C to break

  Reply from 3.3.3.3: bytes=56 Sequence=0 ttl=255 time = 25 ms

  Reply from 3.3.3.3: bytes=56 Sequence=1 ttl=255 time = 26 ms

  Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=255 time = 25 ms

  Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=255 time = 25 ms

  Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=255 time = 25 ms

 --- 3.3.3.3 ping statistics ---

  5 packets transmitted

  5 packets received

  0.00% packet loss

  round-trip min/avg/max = 25/25/26 ms

[R1]acl 2000 match-order auto

[R1-acl-2000]rule permit source any

 Rule has been added to normal packet-filtering rules

[R1-acl-2000]quit

[R1]nat address-group 1.1.1.4 1.1.1.6 add

[R1]int s0

[R1-Serial0]nat outbound 2000 address-group add

[R1-Serial0]quit

[R1]vrrp ping-enable

 ping vrrp  enable

[R1]int e0.1

[R1-Ethernet0.1]vrrp vrid 10 virtual-ip 192.168.10.254

[R1-Ethernet0.1]vrrp vrid 10 priority 120

[R1-Ethernet0.1]vrrp vrid 10 track s0 reduced 30

[R1-Ethernet0.1]int e0.2

[R1-Ethernet0.2]vrrp vrid 20 virtual-ip 192.168.20.254

[R1-Ethernet0.2]quit

R2配置

[Router]sysname R2

[R2]int s1

[R2-Serial1]ip add 1.1.2.1 24

[R2-Serial1]shut

[R2-Serial1]undo shut

[R2-Serial1]int e0.1

[R2-Ethernet0.1]vlan-type dot1q vid 10

[R2-Ethernet0.1]ip add 192.168.10.2 24

[R2-Ethernet0.1]int e0.2

[R2-Ethernet0.2]vlan-type dot1q vid 20

[R2-Ethernet0.2]ip add 192.168.20.2 24

[R2-Ethernet0.2]quit

[R2]ip route-static 0.0.0.0 0.0.0.0 1.1.2.2

[R2]acl 2000 m a

[R2-acl-2000]rule permit source any

 Rule has been added to normal packet-filtering rules

[R2-acl-2000]quit

[R2]nat address-group 1.1.2.4 1.1.2.6 add

[R2]int s1

[R2-Serial1]nat outbound 2000 address-group add

[R2-Serial1]quit

[R2]vrrp ping-enable

 ping vrrp  enable

[R2]int e0.1

[R2-Ethernet0.1]vrrp vrid 10 virtual-ip 192.168.10.254

[R2-Ethernet0.1]int e0.2

[R2-Ethernet0.2]vrrp vrid 20 virtual-ip 192.168.20.254

[R2-Ethernet0.2]vrrp vrid 20 priority 120

[R2-Ethernet0.2]vrrp vrid 20 track s1 reduced 30

[R2-Ethernet0.2]quit

[R2]ping 3.3.3.3

 PING 3.3.3.3: 56  data bytes, press CTRL_C to break

  Reply from 3.3.3.3: bytes=56 Sequence=0 ttl=255 time = 25 ms

  Reply from 3.3.3.3: bytes=56 Sequence=1 ttl=255 time = 25 ms

  Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=255 time = 25 ms

  Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=255 time = 26 ms

  Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=255 time = 25 ms

 --- 3.3.3.3 ping statistics ---

  5 packets transmitted

  5 packets received

  0.00% packet loss

  round-trip min/avg/max = 25/25/26 ms

[R2]dis vrrp

 Ethernet0.2 | Virtual Router 20

   state : Master

 Virtual IP : 192.168.20.254

  Priority : 120

  Preempt : YES  Delay Time : 0

   Timer : 1

 Auth Type : NO

  Track IF : Serial1  Priority reduced : 30

 Ethernet0.1 | Virtual Router 10

   state : Backup

 Virtual IP : 192.168.10.254

  Priority : 100

  Preempt : YES  Delay Time : 0

   Timer : 1

 Auth Type : NO

故障模擬1,電信網(wǎng)絡(luò)出現(xiàn)故障。

[R2]int s1

[R2-Serial1]shut   //模擬電信網(wǎng)絡(luò)故障

% Interface Serial1 is down

[R2-Serial1]dis vrrp

 Ethernet0.2 | Virtual Router 20

   state : Backup

 Virtual IP : 192.168.20.254

  Priority : 90

  Preempt : YES  Delay Time : 0

   Timer : 1

 Auth Type : NO

  Track IF : Serial1  Priority reduced : 30

 Ethernet0.1 | Virtual Router 10

   state : Backup

 Virtual IP : 192.168.10.254

  Priority : 100

  Preempt : YES  Delay Time : 0

   Timer : 1

 Auth Type : NO

[R1]dis vrrp

 Ethernet0.2 | Virtual Router 20

   state : Master

 Virtual IP : 192.168.20.254

  Priority : 100

  Preempt : YES  Delay Time : 0

   Timer : 1

 Auth Type : NO

 Ethernet0.1 | Virtual Router 10

   state : Master

 Virtual IP : 192.168.10.254

  Priority : 120

  Preempt : YES  Delay Time : 0

   Timer : 1

 Auth Type : NO

  Track IF : Serial0  Priority reduced : 30

 4個(gè)主機(jī)正常工作。

故障模擬2,網(wǎng)通網(wǎng)絡(luò)出現(xiàn)故障。

[R1]int s0

[R1-Serial0]shut   //模擬網(wǎng)絡(luò)網(wǎng)絡(luò)故障

% Interface Serial0 is shut down

[R2]int s1

[R2-Serial1]undo shut   //恢復(fù)電信網(wǎng)絡(luò)

% Interface Serial1 is reset

[R2-Serial1]

%01:41:31: Interface Serial1 is UP

[R2-Serial1]dis vrrp

 Ethernet0.2 | Virtual Router 20

   state : Master

 Virtual IP : 192.168.20.254

  Priority : 120

  Preempt : YES  Delay Time : 0

   Timer : 1

 Auth Type : NO

  Track IF : Serial1  Priority reduced : 30

 Ethernet0.1 | Virtual Router 10

   state : Master

 Virtual IP : 192.168.10.254

  Priority : 100

  Preempt : YES  Delay Time : 0

   Timer : 1

 Auth Type : NO

[R1]dis vrrp

 Ethernet0.2 | Virtual Router 20

   state : Backup

 Virtual IP : 192.168.20.254

  Priority : 100

  Preempt : YES  Delay Time : 0

   Timer : 1

 Auth Type : NO

 Ethernet0.1 | Virtual Router 10

   state : Backup

 Virtual IP : 192.168.10.254

  Priority : 90

  Preempt : YES  Delay Time : 0

   Timer : 1

 Auth Type : NO

  Track IF : Serial0  Priority reduced : 30

 4個(gè)主機(jī)正常工作。

故障模擬3,子端口出現(xiàn)故障。

[R1]int s0

[R1-Serial0]undo shut  //恢復(fù)網(wǎng)通網(wǎng)絡(luò)

% Interface Serial0 is reset

[R1-Serial0]

%01:43:07: Interface Serial0 is UP

[R1-Serial0]quit

[R1]int e0.1

[R1-Ethernet0.1]shut   //模擬子端口故障

% Interface Ethernet0.1 is shut down

[R1-Ethernet0.1]

%01:43:30: Line protocol ip on the interface Ethernet0.1 is DOWN

[R1-Ethernet0.1]dis vrrp

 Ethernet0.2 | Virtual Router 20

   state : Backup

 Virtual IP : 192.168.20.254

  Priority : 100

  Preempt : YES  Delay Time : 0

   Timer : 1

 Auth Type : NO

 Ethernet0.1 | Virtual Router 10

   state : Initialize

 Virtual IP : 192.168.10.254

  Priority : 120

  Preempt : YES  Delay Time : 0

   Timer : 1

 Auth Type : NO

  Track IF : Serial0  Priority reduced : 30

[R2]dis vrrp

 Ethernet0.2 | Virtual Router 20

   state : Master

 Virtual IP : 192.168.20.254

  Priority : 120

  Preempt : YES  Delay Time : 0

   Timer : 1

 Auth Type : NO

  Track IF : Serial1  Priority reduced : 30

 Ethernet0.1 | Virtual Router 10

   state : Master

 Virtual IP : 192.168.10.254

  Priority : 100

  Preempt : YES  Delay Time : 0

   Timer : 1

 Auth Type : NO

4個(gè)主機(jī)依然正常工作。

方案3-1:stp和鏈路聚合

STP(Spanning Tree Protocol)是生成樹協(xié)議的英文縮寫。該協(xié)議可應(yīng)用于在網(wǎng)絡(luò)中建立樹形拓?fù)?,消除網(wǎng)絡(luò)中的環(huán)路,并且可以通過一定的方法實(shí)現(xiàn)路徑冗余,但不是一定可以實(shí)現(xiàn)路徑冗余。生成樹協(xié)議最主要的應(yīng)用是為了避免局域網(wǎng)中的單點(diǎn)故障、網(wǎng)絡(luò)回環(huán),解決成環(huán)以太網(wǎng)網(wǎng)絡(luò)的“廣播風(fēng)暴”問題,從某種意義上說是一種網(wǎng)絡(luò)保護(hù)技術(shù),可以消除由于失誤或者意外帶來的循環(huán)連接。但是,由于協(xié)議機(jī)制本身的局限,STP拓?fù)涫諗柯?,?dāng)網(wǎng)絡(luò)拓?fù)浒l(fā)生改變的時(shí)候,生成樹協(xié)議需要50-52秒的時(shí)間才能完成拓?fù)涫諗浚欢也荒芴峁┴?fù)載均衡的功能,當(dāng)網(wǎng)絡(luò)中出現(xiàn)環(huán)路的時(shí)候,生成樹協(xié)議簡(jiǎn)單的將環(huán)路進(jìn)行Block,這樣該鏈路就不能進(jìn)行數(shù)據(jù)包的轉(zhuǎn)發(fā),浪費(fèi)網(wǎng)絡(luò)資源。而鏈路聚合正好解決這兩個(gè)不足,鏈路聚合是將兩個(gè)或更多數(shù)據(jù)信道結(jié)合成一個(gè)單個(gè)的信道,該信道以一個(gè)單個(gè)的更高帶寬的邏輯鏈路出現(xiàn)。

拓?fù)鋱D

怎樣建立高可用性網(wǎng)絡(luò)

所需設(shè)備:

quidway S2403H-EI  2臺(tái)

具體步驟:

SW1配置

<Quidway>system-view

System View: return to User View with Ctrl+Z.

[Quidway]sysname SW1

[SW1]stp enable

[SW1]dis stp

-------[CIST Global Info][Mode MSTP]-------

CIST Bridge     :32768.000f-e274-4920

Bridge Times     :Hello 2s MaxAge 20s FwDly 15s MaxHop 20

CIST Root/ERPC    :32768.000f-e274-4920 / 0

CIST RegRoot/IRPC  :32768.000f-e274-4920 / 0

CIST RootPortId   :0.0

BPDU-Protection   :disabled

TC-Protection    :enabled / Threshold=6

Bridge Config

Digest Snooping   :disabled

TC or TCN received  :0

Time since last TC  :0 days 0h:1m:20s

[SW1]dis stp brief

MSTID     Port          Role  STP State   Protection

 0     Ethernet1/0/22      DESI  FORWARDING    NONE

 0     Ethernet1/0/24      BACK  DISCARDING    NONE

[SW1]link-aggregation group 1 mode manual

[SW1]int e1/0/22

[SW1-Ethernet1/0/22]port link-aggregation group 1

[SW1-Ethernet1/0/22]dis link-aggregation summary

[SW1-Ethernet1/0/22]int e1/0/24

[SW1-Ethernet1/0/24]port link-aggregation group 1

Aggregation Group Type:D -- Dynamic, S -- Static , M -- Manual

Loadsharing Type: Shar -- Loadsharing, NonS -- Non-Loadsharing

Actor ID: 0x8000, 000f-e274-4920

 AL  AL  Partner ID       Select Unselect Share Master

 ID  Type            Ports  Ports   Type  Port

--------------------------------------------------------------------------------

 1  M   none          1    0     NonS  Ethernet1/0/22

SW2配置

<Quidway>system-view

System View: return to User View with Ctrl+Z.

[Quidway]sysname SW2

[SW2]stp enable

[SW2]dis stp

-------[CIST Global Info][Mode MSTP]-------

CIST Bridge     :32768.000f-e242-8a41

Bridge Times     :Hello 2s MaxAge 20s FwDly 15s MaxHop 20

CIST Root/ERPC    :32768.000f-e242-8a41 / 0

CIST RegRoot/IRPC  :32768.000f-e242-8a41 / 0

CIST RootPortId   :0.0

BPDU-Protection   :disabled

TC-Protection    :enabled / Threshold=6

Bridge Config

Digest Snooping   :disabled

TC or TCN received  :0

Time since last TC  :0 days 0h:4m:5s

[SW2]link-aggregation group 1 mode  manual

[SW2]int e1/0/22

[SW2-Ethernet1/0/22]port link-aggregation group 1

[SW2-Ethernet1/0/22]int e1/0/24

[SW2-Ethernet1/0/24]port link-aggregation group 1

[SW2-Ethernet1/0/24]dis link-aggregation summary

Aggregation Group Type:D -- Dynamic, S -- Static , M -- Manual

Loadsharing Type: Shar -- Loadsharing, NonS -- Non-Loadsharing

Actor ID: 0x8000, 000f-e242-8a41

 AL  AL  Partner ID       Select Unselect Share Master

 ID  Type            Ports  Ports   Type  Port

--------------------------------------------------------------------------------

 1  M   none          2    0     Shar  Ethernet1/0/22

方案4.raid (CentOS6.4下測(cè)試)

磁盤陣列(Redundant Arrays of Independent Disks,RAID),有“價(jià)格便宜具有冗余能力的磁盤陣列”之意。原理是利用數(shù)組方式來作磁盤組,配合數(shù)據(jù)分散排列的設(shè)計(jì),提升數(shù)據(jù)的安全性。磁盤陣列是由很多價(jià)格較便宜的磁盤,組合成一個(gè)容量巨大的磁盤組,利用個(gè)別磁盤提供數(shù)據(jù)所產(chǎn)生加成效果提升整個(gè)磁盤系統(tǒng)效能。利用這項(xiàng)技術(shù),將數(shù)據(jù)切割成許多區(qū)段,分別存放在各個(gè)硬盤上。磁盤陣列還能利用同位檢查(Parity Check)的觀念,在數(shù)組中任一顆硬盤故障時(shí),仍可讀出數(shù)據(jù),在數(shù)據(jù)重構(gòu)時(shí),將數(shù)據(jù)經(jīng)計(jì)算后重新置入新硬盤中。

mdadm命令使用

--create(或其縮寫-C)參數(shù)來創(chuàng)建新的陳列并且將一些重要陣列的標(biāo)識(shí)信息作為元數(shù)據(jù)可以寫在每一個(gè)底層設(shè)備的指定區(qū)間

--level(或者其縮寫-l)表示陣列的RAID級(jí)別

--chunk(或者其縮寫-c)表示每個(gè)條帶單元的大小,以KB為單位,默認(rèn)為64KB,條帶單元的大小配置對(duì)不同負(fù)載下的陣列讀寫性能有很大影響

--raid-devices(或者其縮寫-n)表示陣列中活躍的設(shè)備個(gè)數(shù)

--spare-devices(或者其縮寫-x)表示陣列中熱備盤的個(gè)數(shù),一旦陣列中的某個(gè)磁盤失效,MD內(nèi)核驅(qū)動(dòng)程序自動(dòng)用將熱備磁盤加入到陣列,然后重構(gòu)丟失磁盤上的數(shù)據(jù)到熱備磁盤上。

--verbose(或者其縮寫-v):顯示細(xì)節(jié)過程

--fail(或者其縮寫-f): 模擬故障

raid1

RAID1通過磁盤數(shù)據(jù)鏡像實(shí)現(xiàn)數(shù)據(jù)冗余,在成對(duì)的獨(dú)立磁盤上產(chǎn)生互為備份的數(shù)據(jù)。當(dāng)原始數(shù)據(jù)繁忙時(shí),可直接從鏡像拷貝中讀取數(shù)據(jù),因此RAID1可以提高讀取性能。RAID1是磁盤陣列中單位成本最高的,但提供了很高的數(shù)據(jù)安全性和可用性。當(dāng)一個(gè)磁盤失效時(shí),系統(tǒng)可以自動(dòng)切換到鏡像磁盤上讀寫,而不需要重組失效的數(shù)據(jù)。

怎樣建立高可用性網(wǎng)絡(luò)

[root@localhost ~]# mdadm -Cv /dev/md0 -l 1 -n 2 /dev/sdb /dev/sdc -x 1 /dev/sdd

Continue creating array? y

[root@localhost ~]# mkfs -t ext3 /dev/md0

[root@localhost ~]# mkdir /mnt/raid1

[root@localhost ~]# mount /dev/md0 /mnt/raid1/

[root@localhost ~]# df -h

/dev/md0        5.0G  139M  4.6G  3% /mnt/raid1

[root@localhost ~]# cd /mnt/raid1/

[root@localhost raid1]# cp -r /usr/share/* ./

^C

[root@localhost mnt]# du -sh raid1/

97Mraid1/

[root@localhost mnt]# vi /etc/fstab

/dev/md0         /mnt/raid1        auto   defaults     0 0

[root@localhost mnt]# mount -a

[root@localhost mnt]# cd raid1/

[root@localhost raid1]# cat /proc/mdstat

Personalities : [raid1]

md0 : active raid1 sdd[2](S) sdc[1] sdb[0]

   5238720 blocks super 1.2 [2/2] [UU]

unused devices: <none>

[root@localhost ~]# mdadm --detail --scan /dev/md0

怎樣建立高可用性網(wǎng)絡(luò)

[root@localhost ~]# mdadm /dev/md0 -f /dev/sdb

mdadm: set /dev/sdb faulty in /dev/md0

[root@localhost ~]# cat /proc/mdstat

Personalities : [raid1]

md0 : active raid1 sdd[2] sdc[1] sdb[0](F)

   5238720 blocks super 1.2 [2/2] [UU]

unused devices: <none>

[root@localhost ~]# mdadm --detail --scan /dev/md0

怎樣建立高可用性網(wǎng)絡(luò)

[root@localhost ~]# mdadm --detail --scan >/etc/mdadm.conf


raid5

  RAID 5 是一種存儲(chǔ)性能、數(shù)據(jù)安全和存儲(chǔ)成本兼顧的存儲(chǔ)解決方案。 RAID 5可以理解為是RAID 0和RAID 1的折中方案。RAID 5可以為系統(tǒng)提供數(shù)據(jù)安全保障,但保障程度要比Mirror低而磁盤空間利用率要比Mirror高。RAID 5具有和RAID 0相近似的數(shù)據(jù)讀取速度,只是多了一個(gè)奇偶校驗(yàn)信息,寫入數(shù)據(jù)的速度比對(duì)單個(gè)磁盤進(jìn)行寫入操作稍慢。同時(shí)由于多個(gè)數(shù)據(jù)對(duì)應(yīng)一個(gè)奇偶校驗(yàn)信息,RAID 5的磁盤空間利用率要比RAID 1高,存儲(chǔ)成本相對(duì)較低。

怎樣建立高可用性網(wǎng)絡(luò)

[root@localhost ~]# fdisk -l

[root@localhost ~]# mdadm -Cv /dev/md0 -l 5 -n 3 /dev/sdb /dev/sdc /dev/sdd -x 1 /dev/sde

Continue creating array? y

[root@localhost ~]# cat /proc/mdstat

Personalities : [raid6] [raid5] [raid4]

md0 : active raid5 sdd[4] sde[3](S) sdc[1] sdb[0]

   10476544 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]

unused devices: <none>

[root@localhost ~]# mdadm --detail --scan

  Number  Major  Minor  RaidDevice State

   0    8    16     0    active sync  /dev/sdb

   1    8    32     1    active sync  /dev/sdc

   4    8    48     2    active sync  /dev/sdd

   3    8    64     -    spare     /dev/sde

[root@localhost ~]# mkfs -t ext3 /dev/md0

[root@localhost ~]# mkdir /mnt/raid5

[root@localhost ~]# mount /dev/md0 /mnt/raid5

[root@localhost ~]# vi /etc/fstab

/dev/md0         /mnt/raid5       auto   defaults     0 0

[root@localhost ~]# mdadm --detail --scan >/etc/mdadm.conf

[root@localhost ~]# cat /etc/mdadm.conf

ARRAY /dev/md0 metadata=1.2 spares=1 name=localhost.localdomain:0 UUID=52a024d4:76260d6f:9eeac1e5:f4a7d0d9

[root@localhost ~]# cat /proc/mdstat

Personalities : [raid6] [raid5] [raid4]

md0 : active raid5 sdd[4] sde[3](S) sdc[1] sdb[0]

   10476544 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]

unused devices: <none>

[root@localhost ~]# mdadm --detail --scan /dev/md0

  Number  Major  Minor  RaidDevice State

   0    8    16     0    active sync  /dev/sdb

   1    8    32     1    active sync  /dev/sdc

   4    8    48     2    active sync  /dev/sdd

   3    8    64     -    spare     /dev/sde

[root@localhost ~]# mdadm /dev/md0 -f /dev/sdb

mdadm: set /dev/sdb faulty in /dev/md0

[root@localhost ~]# cat /proc/mdstat

Personalities : [raid6] [raid5] [raid4]

md0 : active raid5 sdd[4] sde[3] sdc[1] sdb[0](F)

   10476544 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]

unused devices: <none>

[root@localhost ~]# mdadm --detail --scan /dev/md0

  Number  Major  Minor  RaidDevice State

   3    8    64     0    active sync  /dev/sde

   1    8    32     1    active sync  /dev/sdc

   4    8    48     2    active sync  /dev/sdd

   0    8    16     -    faulty spare  /dev/sdb

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

文章題目:怎樣建立高可用性網(wǎng)絡(luò)-創(chuàng)新互聯(lián)
URL分享:http://muchs.cn/article0/cochoo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供營(yíng)銷型網(wǎng)站建設(shè)、Google、外貿(mào)建站、網(wǎng)站建設(shè)、定制開發(fā)、品牌網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)公司