中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

如何配置共享存儲和進行UDEV存儲設備綁定

發布時間:2021-11-05 09:56:59 來源:億速云 閱讀:190 作者:柒染 欄目:建站服務器

這篇文章將為大家詳細講解有關如何配置共享存儲和進行UDEV存儲設備綁定,文章內容質量較高,因此小編分享給大家做個參考,希望大家閱讀完這篇文章后對相關知識有一定的了解。

配置共享存儲和UDEV存儲設備綁定

2013年7月29日,星期一


目錄:

  • 1.vrh2新建磁盤

  • 2.vrh3添加現有磁盤

  • 3.在vrh2上綁定存儲磁盤

    • 3.1把sdb 3G這個盤劃分成兩個分區

    • 3.2綁定磁盤sdb

    • 3.3把sdc、sdd、sde綁定成asm文件格式

  • 4.在vrh3上綁定存儲磁盤

    • 4.1啟動vrh3

    • 4.2復制剛才配置的vrh2上的規則文件到vrh3

    • 4.3啟動服務

  • 5.vrh2與vrh3 sshd互信配置

    • 5.1 vrh2上執行

    • 5.2 vrh3上執行

    • 5.3 創建一個授權文件保存兩臺主機的授權信息

    • 5.4檢查vrh2上主機的時間同步情況

    • 5.5檢查vrh3上主機的時間同步情況

1.vrh2新建磁盤

前提條件:vrh3主機需要是關閉狀態

共享磁盤必須使用固定大小磁盤類型,否則無法把其設置為共享類型

磁盤名稱創建類型格式磁盤類型大小說明
ocr新建VDI固定大小3G放置OCR和vodvoting Disk
dbshare1新建VDI固定大小5G放置數據文件
dbshare2新建VDI固定大小5G放置數據文件
dbshare3新建VDI固定大小5G放置數據文件

將以上四個磁盤設置為可共享的類型

點擊“管理”->“虛擬介質管理”->選擇磁盤->選擇類型為共享

在virtual Box管理器上顯示可能會有一點延遲

打開主機的I/O Cache

2.vrh3添加現有磁盤

磁盤名稱創建類型格式磁盤類型大小說明
ocr現有VDI固定大小3G放置OCR和vodvoting Disk
dbshare1現有VDI固定大小5G放置數據文件
dbshare2現有VDI固定大小5G放置數據文件
dbshare3現有VDI固定大小5G放置數據文件

添加磁盤并且打開主機的I/O Cache

3.在vrh2上綁定存儲磁盤

3.1把sdb 3G這個盤劃分成兩個分區

[root@vrh2 ~]# fdisk /dev/sdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel. Changes will remain in memory only,

until you decide to write them. After that, of course, the previous

content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/sdb: 3221 MB, 3221225472 bytes

255 heads, 63 sectors/track, 391 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-391, default 1):

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-391, default 391): +1500M

Command (m for help): p

Disk /dev/sdb: 3221 MB, 3221225472 bytes

255 heads, 63 sectors/track, 391 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1         183     1469916   83  Linux

Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 2

First cylinder (184-391, default 184):

Using default value 184

Last cylinder or +size or +sizeM or +sizeK (184-391, default 391):

Using default value 391

Command (m for help): p

Disk /dev/sdb: 3221 MB, 3221225472 bytes

255 heads, 63 sectors/track, 391 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1         183     1469916   83  Linux

/dev/sdb2             184         391     1670760   83  Linux

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

The kernel still uses the old table.

The new table will be used at the next reboot.

Syncing disks.

[root@vrh2 ~]# partprobe /dev/sdb

[root@vrh2 ~]# ls -l /dev/sdb*

brw-r----- 1 root disk 8, 16 Jul 29 07:39 /dev/sdb

b rw-r----- 1 root disk 8, 17 Jul 29 07:40 /dev/sdb1   #記住8,17  8,18 之后綁定會用到

b rw-r----- 1 root disk 8, 18 Jul 29 07:40 /dev/sdb2   #注意這里的sdb目前還是塊設備,我們之后會把它設置為raw設備

3.2綁定磁盤sdb

[root@vrh2 ~]# cd /etc/udev/rules.d/

[root@vrh2 rules.d]# vi 60-raw.rules

# Enter raw device bindings here.

#

# An example would be:

#   ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"

# to bind /dev/raw/raw1 to /dev/sda, or

#   ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"

# to bind /dev/raw/raw2 to the device with major 8, minor 1.

ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"

ACTION=="add", KERNEL=="sdb2", RUN+="/bin/raw /dev/raw/raw2 %N"

ACTION=="add", KERNEL=="raw*", OWNER=="oracle", GROUP=="oinstall", MODE=="0660"             #把權限賦予給oracle用戶和oinstall用戶組

[root@vrh2 rules.d]# start_udev

Starting udev: [  OK  ]

[root@vrh2 rules.d]# cd /dev/raw

[root@vrh2 raw]# ls -l

total 0

crw-rw---- 1 oracle oinstall 162, 1 Jul 29 07:56 raw1

crw-rw---- 1 oracle oinstall 162, 2 Jul 29 07:56 raw2

3.3把sdc、sdd、sde綁定成asm文件格式

使用以下腳本可以實現,注意該腳本要在/dev/raw目錄執行

for i in b c d e f g h i j k ;

do

echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id -g -u -s %p\", RESULT==\"`scsi_id -g -u -s /block/sd$i`\", NAME=\"asm-disk$i\", WNER=\"oracle\", GROUP=\"oinstall\", MODE=\"0660\""

done

我們這里只有cde三個盤,只需要將in后面寫上c d e即可,

解釋:

sbin/scsi_id -g -u   該號是唯一的,所以根據它來綁定

[root@vrh2 raw]# ls

raw1  raw2

[root@vrh2 raw]# for i in c d e;

> do

> echo "sd$i" "`scsi_id -g -u -s /block/sd$i`";

> done

sdc SATA_VBOX_HARDDISK_VBb86af276-b24615a9_

sdd SATA_VBOX_HARDDISK_VB453dbb62-ac2d0a41_

sde SATA_VBOX_HARDDISK_VB2a60d1f8-c1fd7b46_

執行腳本

[root@vrh2 raw]# for i in c d e;

> do

> echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id -g -u -s %p\", RESULT==\"`scsi_id -g -u -s /block/sd$i`\", NAME=\"asm-disk$i\", WNER=\"oracle\", GROUP=\"oinstall\", MODE=\"0660\""

> done

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VBb86af276-b24615a9_", NAME="asm-diskc", OWNER="oracle", GROUP="oinstall", MODE="0660"

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB453dbb62-ac2d0a41_", NAME="asm-diskd", OWNER="oracle", GROUP="oinstall", MODE="0660"

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB2a60d1f8-c1fd7b46_", NAME="asm-diske", OWNER="oracle", GROUP="oinstall", MODE="0660"

[root@vrh2 raw]#

[root@vrh2 ~]# cd /etc/udev/rules.d/

[root@vrh2 rules.d]# touch 99-oracle-asmdevices.rules

[root@vrh2 rules.d]# vi 99-oracle-asmdevices.rules

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VBb86af276-b24615a9_", NAME="asm-diskc", OWNER="oracle", GROUP="oinstall", MODE="0660"

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB453dbb62-ac2d0a41_", NAME="asm-diskd", OWNER="oracle", GROUP="oinstall", MODE="0660"

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB2a60d1f8-c1fd7b46_", NAME="asm-diske", OWNER="oracle", GROUP="oinstall", MODE="0660"

[root@vrh2 rules.d]# start_udev

Starting udev: [  OK  ]

[root@vrh2 rules.d]# ls -l /dev/asm*

brw-rw---- 1 oracle oinstall 8, 32 Jul 29 20:30 /dev/asm-diskc

brw-rw---- 1 oracle oinstall 8, 48 Jul 29 20:30 /dev/asm-diskd

brw-rw---- 1 oracle oinstall 8, 64 Jul 29 20:30 /dev/asm-diske

4.在vrh3上綁定存儲磁盤

4.1啟動vrh3

4.2復制剛才配置的vrh2上的規則文件到vrh3

[root@vrh2 rules.d]# scp 60-raw.rules vrh3:/etc/udev/rules.d

The authenticity of host 'vrh3 (192.168.1.103)' can't be established.

RSA key fingerprint is 92:e1:fc:a6:f8:15:37:27:7b:50:41:fa:be:4d:19:0b.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'vrh3,192.168.1.103' (RSA) to the list of known hosts.

root@vrh3's password:

60-raw.rules                                    100%  527     0.5KB/s   00:00   

[root@vrh2 rules.d]# scp 99-oracle-asmdevices.rules vrh3:/etc/udev/rules.d

root@vrh3's password:

99-oracle-asmdevices.rules                      100%  544     0.5KB/s   00:00

4.3啟動服務

[root@vrh3 rules.d]# start_udev

Starting udev: [  OK  ]

[root@vrh3 rules.d]# ll /dev/raw/raw*

crw-rw---- 1 oracle oinstall 162, 1 Jul 29 20:39 /dev/raw/raw1

crw-rw---- 1 oracle oinstall 162, 2 Jul 29 20:39 /dev/raw/raw2

[root@vrh3 rules.d]#

[root@vrh3 rules.d]# ll /dev/asm*

brw-rw---- 1 oracle oinstall 8, 32 Jul 29 20:39 /dev/asm-diskc

brw-rw---- 1 oracle oinstall 8, 48 Jul 29 20:39 /dev/asm-diskd

brw-rw---- 1 oracle oinstall 8, 64 Jul 29 20:39 /dev/asm-diske

5.vrh2與vrh3 sshd互信配置

5.1 vrh2上執行

[root@vrh2 /]# su - oracle

[oracle@vrh2 ~]$ ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/home/oracle/.ssh/id_rsa):

Created directory '/home/oracle/.ssh'.

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/oracle/.ssh/id_rsa.

Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.

The key fingerprint is:

87:0f:5e:55:8e:7a:b6:47:e7:34:ad:27:b4:63:a9:da oracle@vrh2.oracle.com

[oracle@vrh2 ~]$ ssh-keygen -t dsa

Generating public/private dsa key pair.

Enter file in which to save the key (/home/oracle/.ssh/id_dsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/oracle/.ssh/id_dsa.

Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.

The key fingerprint is:

0d:ec:9d:41:00:5d:cc:e7:c2:8a:e8:6c:30:00:90:66 oracle@vrh2.oracle.com

5.2 vrh3上執行

[root@vrh3 /]# su - oracle

[oracle@vrh3 ~]$ ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/home/oracle/.ssh/id_rsa):

Created directory '/home/oracle/.ssh'.

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/oracle/.ssh/id_rsa.

Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.

The key fingerprint is:

83:a3:22:6a:aa:cf:90:74:11:7e:48:58:86:06:7b:aa oracle@vrh3.oracle.com

[oracle@vrh3 ~]$ ssh-keygen -t dsa

Generating public/private dsa key pair.

Enter file in which to save the key (/home/oracle/.ssh/id_dsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/oracle/.ssh/id_dsa.

Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.

The key fingerprint is:

29:3b:dc:1b:49:bb:0e:90:29:a7:d6:6b:26:99:de:b7 oracle@vrh3.oracle.com

5.3 創建一個授權文件保存兩臺主機的授權信息

[oracle@vrh2 .ssh]$ touch authorized_keys

[oracle@vrh2 .ssh]$ cat id_dsa.pub  >> authorized_keys                #將本機vrh2上的dsa保存到授權文件中

[oracle@vrh2 .ssh]$ cat id_rsa.pub  >> authorized_keys                #將本機vrh2上的rsa保存到授權文件中

[oracle@vrh2 .ssh]$ ssh vrh3 cat ~/.ssh/id_dsa.pub >> authorized_keys #將vrh3上的dsa保存到授權文件中

The authenticity of host 'vrh3 (192.168.1.103)' can't be established. #將vrh3上的rsa保存到授權文件中

RSA key fingerprint is 92:e1:fc:a6:f8:15:37:27:7b:50:41:fa:be:4d:19:0b.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'vrh3,192.168.1.103' (RSA) to the list of known hosts.

oracle@vrh3's password:

[oracle@vrh2 .ssh]$ ssh vrh3 cat ~/.ssh/id_rsa.pub >> authorized_keys #將授權文件拷貝到vrh3主機上

oracle@vrh3's password:

[oracle@vrh2 .ssh]$ scp authorized_keys vrh3:~/.ssh

oracle@vrh3's password:

authorized_keys                                 100% 2032     2.0KB/s   00:00

5.4檢查vrh2上主機的時間同步情況

[oracle@vrh2 .ssh]$ date;ssh vrh3 date

Mon Jul 29 20:53:44 CST 2013

Mon Jul 29 20:53:44 CST 2013

[oracle@vrh2 .ssh]$ date;ssh vrh3-priv date

Mon Jul 29 20:54:15 CST 2013

Mon Jul 29 20:54:15 CST 2013

[oracle@vrh2 .ssh]$ date;ssh vrh2 date

Mon Jul 29 20:55:36 CST 2013

Mon Jul 29 20:55:36 CST 2013

[oracle@vrh2 .ssh]$ date;ssh vrh2-priv date

Mon Jul 29 20:55:45 CST 2013

Mon Jul 29 20:55:45 CST 2013

5.5檢查vrh3上主機的時間同步情況

[oracle@vrh3 ~]$ date;ssh vrh2 date

Mon Jul 29 20:56:50 CST 2013

Mon Jul 29 20:56:50 CST 2013

[oracle@vrh3 ~]$ date;ssh vrh2-priv date

Mon Jul 29 20:56:59 CST 2013

Mon Jul 29 20:56:59 CST 2013

[oracle@vrh3 ~]$ date;ssh vrh3 date

Mon Jul 29 20:57:54 CST 2013

Mon Jul 29 20:57:54 CST 2013

[oracle@vrh3 ~]$ date;ssh vrh3-priv date

Mon Jul 29 20:57:45 CST 2013

Mon Jul 29 20:57:46 CST 2013

關于如何配置共享存儲和進行UDEV存儲設備綁定就分享到這里了,希望以上內容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

吉木萨尔县| 揭东县| 永靖县| 乐清市| 徐闻县| 丹阳市| 乌拉特中旗| 大洼县| 西昌市| 北碚区| 南陵县| 西盟| 平顶山市| 云浮市| 阿勒泰市| 武夷山市| 青河县| 南开区| 乌兰察布市| 当阳市| 保靖县| 凯里市| 灵寿县| 无为县| 涞源县| 乌拉特前旗| 新兴县| 安乡县| 翼城县| 郓城县| 湘乡市| 蓬莱市| 吉林市| 乌鲁木齐县| 雅安市| 上蔡县| 鸡东县| 凤庆县| 广德县| 甘肃省| 惠州市|