基於IntelCAS加速的Glusterfs常見運維

Intel CAS全稱是Intel cache acceleration software,
這裏是官方網站:http://www.intel.com/support/go/cas

一、IntelCAS的使用

這裏是IntelCAS 的幫助文檔。
在搭配Intel自己的閃存產品時,這個軟件沒有cache的容量限制。
如果使用其他品牌的閃存產品,則每個cache最大隻能200GB。

介紹下一個配置工具CAS   casadm
[root@node1 ~]# casadm -H
WARNING: Intel(R) CAS is running on a non-validated OS!
Intel(R) Cache Acceleration Software Linux

Usage: casadm <command> [option...]

Available commands:
   -S  --start-cache              Start new cache instance or load using metadata
   -T  --stop-cache               Stop cache instance
   -X  --set-param                Set various runtime parameters
   -G  --get-param                Get various runtime parameters
   -Q  --set-cache-mode           Set cache mode
   -A  --add-core                 Add core device to cache instance
   -R  --remove-core              Remove core device from cache instance
       --remove-detached          Remove core device from core pool
   -L  --list-caches              List all cache instances and core devices
   -P  --stats                    Print statistics for cache instance
   -Z  --reset-counters           Reset cache statistics for core device within cache instance
   -F  --flush-cache              Flush all dirty data from the caching device to core devices
   -E  --flush-core               Flush dirty data of a given core from the caching device to this core device
   -D  --flush-parameters         Change flush thread parameters (OBSOLETE)
   -C  --io-class                 Manage IO classes
   -N  --nvme                     Manage NVMe namespace
   -V  --version                  Print Intel(R) CAS version
   -H  --help                     Print help

For detailed help on the above commands use --help after the command.
e.g.
   casadm --start-cache --help
For more information, please refer to manual, Admin Guide (man casadm)
or go to support page <http://www.intel.com/support/go/cas>.
[root@node1 ~]# 

二、Intel CAS在linux下的安裝

安裝程序名一般是:

installer-Intel-CAS-xxxxxxxxxxxxxxxxxxx.run

ftp到主機,並給它執行權限,直接執行就好了。

目前最新版本是3.6,這個版本支持的OS:rhel6.86.97.37.4,centos 6.86.97.37.4,
如果用OEL,要把內核切換到rhel的兼容內核。

三、Intel CAS配置

1 、核心的配置文件是/etc/intelcas/intelcas.conf
[root@node1 intelcas]# ls
intelcas.conf  ioclass-config.csv  validated_configurations.csv
[root@node1 intelcas]# pwd
/etc/intelcas
[root@node1 intelcas]# 

在這裏插入圖片描述

2 、配置文件解析

安裝過後,會自動生成這個配置文件 ,初始時所有行都是註釋掉的,註釋中包含說明和例子。

是註釋掉的,去掉註釋,根據自己的情況修改:

## Caches configuration section
 
[caches]
 
## Cache ID Cache device Cache mode Extra fields (optional)
 
## Uncomment and edit the below line for cache configuration
 
1 /dev/disk/by-id/nvme-INTEL_SSDPEDMW012T4_CVCQ5146005Q1P2BGN WB
 
## Core devices configuration
 
[cores]
 
## Cache ID Core ID Core device
 
## Uncomment and edit the below line for core configuration
 
1 1 /dev/disk/by-id/wwn-0x5000c5008f07fcaf

這裏需要注意一下,爲了防止磁盤的飄動,磁盤應寫id:

查看ID的辦法如下:

[root@node1 intelcas]# ls -l /dev/disk/by-id/
total 0
lrwxrwxrwx 1 root root  9 Dec  3 08:56 ata-QEMU_DVD-ROM_QM00001 -> ../../sr0
lrwxrwxrwx 1 root root  9 Dec  5 16:31 virtio-49ac23b4-7bc0-4878-a -> ../../vdf
lrwxrwxrwx 1 root root  9 Dec  5 16:31 virtio-61d85d0a-6b60-4e90-9 -> ../../vdb
lrwxrwxrwx 1 root root  9 Dec  5 16:31 virtio-63623f20-e2d3-4c68-8 -> ../../vdh
lrwxrwxrwx 1 root root  9 Dec  5 16:31 virtio-7af8271a-500d-463d-8 -> ../../vdd
lrwxrwxrwx 1 root root  9 Dec  5 16:31 virtio-83930fe5-3ab3-418b-b -> ../../vdg
lrwxrwxrwx 1 root root  9 Dec  5 16:31 virtio-c3349770-d5e3-494d-b -> ../../vde
lrwxrwxrwx 1 root root  9 Dec  5 16:31 virtio-c8e6629c-d6e5-43ce-9 -> ../../vdc

另外:

<緩存ID>是一個介於116,384之間的數值(有效的緩存實例號)。
•<Core ID>04095之間的數值(有效的Core實例號)
•緩存和核心設備必須指向現有的HDD和SSD設備,最好通過by-id名稱引用(ls -l /dev/disk/by-id)。
核心設備應該引用WWN標識符,而緩存設備應該使用型號和序列號。
或者,可以通過設備名稱引用設備
(如。例如當運行casadm命令時。)
模式決定緩存模式,可以是寫進模式、寫回模式、寫進模式或傳遞模式。
•可選:額外的標誌允許額外的設置緩存和核心設備,逗號分隔。
•ioclass_file允許用戶加載指定該緩存的IO類策略的文件。
•cleaning_policy允許用戶指定用於此緩存的緩存清理策略,可以是acp、alru或nop

3 、內容說明

[caches]部分是主要是3列,cache id,設備名,和cache模式

Cache id1開始排列,多塊PCI SSD做cache,就依次編號,設備名建議用/dev/disk/by-id/目錄下的別名,
例子裏是使用intel PCI SSD的一個例子,cache模式是WB,write back, 也可以是WT(write through), PT(pass through)。

[cores]部分就是被加速的機械盤設備,也是3列,cache id就是告訴系統用哪個設備做cache,
例子裏就是上面剛定義的1號cache設備,core id也是從1開始依次排列,
core device即使機械硬盤設備名,也是建議用/dev/disk/by-id/目錄下的別名。

四、 初始化CAS

[root@node1 intelcas]#  intelcas init


如果閃存盤上有數據或文件系統,需要使用:

[root@node1 intelcas]#  intelcas init  -force


初始化後自動啓動CAS,然後就能看到應用了cache後的設備了。

core id和cache id構成cache後的設備名,
上面例子中加速後的機械硬盤的設備名就是/dev/intelcas1-1

如果機械硬盤太大,給oracle時要分區,就對/dev/intelcas1-1進行分區操作,
不要對底層機械硬盤進行分區,上面的例子裏,
就是不要對/dev/disk/by-id/wwn-0x5000c5008f07fcaf

進行分區,或者不要對真正的/dev/sdX進行分區。

分區後的設備就是/dev/intelcas1-1p1, /dev/intelcas1-1p2……

五、 啓動/關閉CAS

只要配置了/etc/intelcas/intelcas.conf, 系統重啓後,會自動啓動CAS, 不需要人工干預。

如果要手工停止和啓動,使用命令:
[root@node1 intelcas]#   intelcas start/stop

六 、 使用casadm工具進行配置分析:

環境準備:

主機 磁盤 HDD SSD
node1 /dev/vdb、/dev/vdc、/dev/vdd /dev/vde
node2 /dev/vdb、/dev/vdc、/dev/vdd /dev/vde
node3 /dev/vdb、/dev/vdc、/dev/vdd /dev/vde

eg:

[root@node1 intelcas]# lsblk 
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1  478K  0 rom  
vda    253:0    0   50G  0 disk 
├─vda1 253:1    0  200M  0 part /boot
└─vda2 253:2    0 49.8G  0 part /
vdb    253:16   0   50G  0 disk 
vdc    253:32   0   50G  0 disk 
vdd    253:48   0   50G  0 disk 
vde    253:64   0   20G  0 disk 

[root@node2 ~]# lsblk 
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1  478K  0 rom  
vda    253:0    0   50G  0 disk 
├─vda1 253:1    0  200M  0 part /boot
└─vda2 253:2    0 49.8G  0 part /
vdb    253:16   0   50G  0 disk 
vdc    253:32   0   50G  0 disk 
vdd    253:48   0   50G  0 disk 
vde    253:64   0   20G  0 disk


[root@node3 ~]# lsblk 
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1  478K  0 rom  
vda    253:0    0   50G  0 disk 
├─vda1 253:1    0  200M  0 part /boot
└─vda2 253:2    0 49.8G  0 part /
vdb    253:16   0   50G  0 disk 
vdc    253:32   0   50G  0 disk 
vdd    253:48   0   50G  0 disk 
vde    253:64   0   20G  0 disk

(要注意配置完之後,要將配置內容寫進/etc/intelcas/intelcas.conf中)

① 首先看下Intelcas的狀態

[root@node1 intelcas]# casadm -L
WARNING: Intel(R) CAS is running on a non-validated OS!
No caches running
[root@node1 intelcas]# 


②下面進行配置(這裏僅僅是演示只在node1節點上進行操作,事實上三個節點都需要操作)
首先添加cache設備

[root@node1 intelcas]#  casadm -S -i 1 -d /dev/vde 
WARNING: Intel(R) CAS is running on a non-validated OS!
Successfully added cache instance 1
[root@node1 intelcas]# 

其次添加core設備,前提是要指定綁定的cache設備

[root@node1 intelcas]# casadm -A -i 1 -j 1 -d /dev/vdb 
WARNING: Intel(R) CAS is running on a non-validated OS!
Successfully added core 1 to cache instance 1
[root@node1 intelcas]# casadm -A -i 1 -j 2 -d /dev/vdc 
WARNING: Intel(R) CAS is running on a non-validated OS!
Successfully added core 2 to cache instance 1
[root@node1 intelcas]# casadm -A -i 1 -j 3 -d /dev/vdd 
WARNING: Intel(R) CAS is running on a non-validated OS!
Successfully added core 3 to cache instance 1
[root@node1 intelcas]# 

查看結果如下:(一拖三)

[root@node1 intelcas]# casadm -L
WARNING: Intel(R) CAS is running on a non-validated OS!
type    id   disk       status    write policy   device
cache   1    /dev/vde   Running   wt             -
+core   1    /dev/vdb   Active    -              /dev/intelcas1-1
+core   2    /dev/vdc   Active    -              /dev/intelcas1-2
+core   3    /dev/vdd   Active    -              /dev/intelcas1-3

更改一下模型策略

[root@node1 intelcas]# casadm -Q -c wb -i 1 
WARNING: Intel(R) CAS is running on a non-validated OS!
[root@node1 intelcas]# casadm -L
WARNING: Intel(R) CAS is running on a non-validated OS!
type    id   disk       status    write policy   device
cache   1    /dev/vde   Running   wb             -
+core   1    /dev/vdb   Active    -              /dev/intelcas1-1
+core   2    /dev/vdc   Active    -              /dev/intelcas1-2
+core   3    /dev/vdd   Active    -              /dev/intelcas1-3

然後通過ls - l /dev/disk/by-id/…獲取下每個設備的id,並寫進配置文件

#  |  |     '  |   |.-'   |      (      ----  '-.
#  |  |     |  |   \      |       \    (   |     )
#  '- '     '  '--  '--'  '--      '--  --' ' --'

# Intel(R) CAS configuration file - for reference on syntax
# of this file please refer to appropriate documentation

# NOTES:
# 1) It is highly recommended to specify cache/core device using path
# that is constant across reboots - e.g. disk device links in
# /dev/disk/by-id/, preferably those using device WWN if available:
#   /dev/disk/by-id/wwn-0x123456789abcdef0
# Referencing devices via /dev/sd* may result in cache misconfiguration after
# system reboot due to change(s) in drive order.

## Caches configuration section
[caches]
## Cache ID     Cache device                            Cache mode      Extra fields (optional)
## Uncomment and edit the below line for cache configuration
#1              /dev/disk/by-id/nvme-INTEL_SSDP..       WT
1               /dev/disk/by-id/virtio-c3349770-d5e3-494d-b     WB

## Core devices configuration
[cores]
## Cache ID     Core ID         Core device
## Uncomment and edit the below line for core configuration
#1              1               /dev/disk/by-id/wwn-0x123456789abcdef0
1               1               /dev/disk/by-id/virtio-61d85d0a-6b60-4e90-9
1               2               /dev/disk/by-id/virtio-c8e6629c-d6e5-43ce-9
1               3               /dev/disk/by-id/virtio-7af8271a-500d-463d-8

## To specify use of the IO Classification file, place content of the following line in the
## Caches configuration section under Extra fields (optional)
## ioclass_file=/etc/intelcas/ioclass-config.csv

③:將設備進行掛載:
先創建掛載點:

[root@node1 data]# mkdir intelcas1-{1..3}
[root@node1 data]# ls
intelcas1-1  intelcas1-2  intelcas1-3

然後將掛載設備文件寫入 /etc/fstab文件中


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

#
# /etc/fstab
# Created by anaconda on Mon Mar 18 04:25:44 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=eb5e1ffc-7d7f-4ed3-bd90-0c7d23eeb7c2 /                       xfs     defaults        0 0
UUID=5025c7e6-262c-4930-a2be-e32ffddbdf42 /boot                   xfs     defaults        0 0
#/dev/vdb /data/brick1 xfs defaults 0 0
#/dev/vdc /data/brick2 xfs defaults 0 0
#/dev/vdd /data/brick3 xfs defaults 0 0
/dev/intelcas1-1       /data/intelcas1-1       xfs defaults 0 0
/dev/intelcas1-2       /data/intelcas1-2       xfs defaults 0 0
/dev/intelcas1-3       /data/intelcas1-3       xfs defaults 0 0

然後執行mount命令進行掛載

[root@node1 data]#  mount   -a 
[root@node1 data]# df -h
Filesystem        Size  Used Avail Use% Mounted on
/dev/vda2          50G   43G  7.2G  86% /
devtmpfs          1.9G     0  1.9G   0% /dev
tmpfs             1.9G     0  1.9G   0% /dev/shm
tmpfs             1.9G  143M  1.8G   8% /run
tmpfs             1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/vda1         197M  113M   85M  58% /boot
tmpfs             380M     0  380M   0% /run/user/0
/dev/intelcas1-1   50G   33M   50G   1% /data/intelcas1-1
/dev/intelcas1-2   50G   33M   50G   1% /data/intelcas1-2
/dev/intelcas1-3   50G   33M   50G   1% /data/intelcas1-3

---------------------- 以上操作均需要在各個節點執行------------------------------

效果如下:
Node3:(node2 一樣操作)

[root@node3 ~]# lsblk 
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1  478K  0 rom  
vda    253:0    0   50G  0 disk 
├─vda1 253:1    0  200M  0 part /boot
└─vda2 253:2    0 49.8G  0 part /
vdb    253:16   0   50G  0 disk 
vdc    253:32   0   50G  0 disk 
vdd    253:48   0   50G  0 disk 
vde    253:64   0   20G  0 disk 
vdf    253:80   0   50G  0 disk 
vdg    253:96   0   50G  0 disk 
[root@node3 ~]# casadm -S -i 1 -d  /dev/vde 
WARNING: Intel(R) CAS is running on a non-validated OS!
Successfully added cache instance 1
[root@node3 ~]# casadm -A -i 1   -j 1 -d  /dev/vdb 
WARNING: Intel(R) CAS is running on a non-validated OS!
Successfully added core 1 to cache instance 1
[root@node3 ~]# casadm -A -i 1   -j 2 -d  /dev/vdc 
WARNING: Intel(R) CAS is running on a non-validated OS!
Successfully added core 2 to cache instance 1
[root@node3 ~]# casadm -A -i 1   -j 3 -d  /dev/vdd 
WARNING: Intel(R) CAS is running on a non-validated OS!
Successfully added core 3 to cache instance 1
[root@node3 ~]# casadm -L
WARNING: Intel(R) CAS is running on a non-validated OS!
type    id   disk       status    write policy   device
cache   1    /dev/vde   Running   wt             -
+core   1    /dev/vdb   Active    -              /dev/intelcas1-1
+core   2    /dev/vdc   Active    -              /dev/intelcas1-2
+core   3    /dev/vdd   Active    -              /dev/intelcas1-3
[root@node3 ~]# 
[root@node3 ~]# df -h        
Filesystem        Size  Used Avail Use% Mounted on
/dev/vda2          50G  3.1G   47G   7% /
devtmpfs          1.9G     0  1.9G   0% /dev
tmpfs             1.9G     0  1.9G   0% /dev/shm
tmpfs             1.9G   57M  1.8G   3% /run
tmpfs             1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/vda1         197M  113M   85M  58% /boot
tmpfs             380M     0  380M   0% /run/user/0
/dev/intelcas1-1   50G   33M   50G   1% /data/intelcas1-1
/dev/intelcas1-2   50G   33M   50G   1% /data/intelcas1-2
/dev/intelcas1-3   50G   33M   50G   1% /data/intelcas1-3

七 、 啓動glusterfs進行volume的創建

GlusterFS 五種卷  

  

 - Distributed:分佈式卷,文件通過 hash 算法隨機分佈到由 bricks 組成的捲上。


 - Replicated: 複製式卷,類似 RAID 1,replica 數必須等於 volume 中 brick 所包含的存儲服務器數,可用性高。
 - Striped: 條帶式卷,類似 RAID 0,stripe 數必須等於 volume 中 brick 所包含的存儲服務器數,文件被分成數據塊,
    以 Round Robin 的方式存儲在 bricks 中,併發粒度是數據塊,大文件性能好。
 - Distributed Striped: 分佈式的條帶卷,volume中 brick 所包含的存儲服務器數必須是 stripe 的倍數(>=2倍),兼顧分佈式和條帶式的功能。
 - Distributed Replicated: 分佈式的複製卷,volume 中 brick 所包含的存儲服務器數必須是 replica 的倍數(>=2倍),兼顧分佈式和複製式的功能。
 -  分佈式複製卷的brick順序決定了文件分佈的位置,一般來說,先是兩個brick形成一個複製關係,然後兩個複製關係形成分佈。

 -  企業一般用後兩種,大部分會用分佈式複製(可用容量爲 總容量/複製份數),通過網絡傳輸的話最好用萬兆交換機,萬兆網卡來做。
     這樣就會優化一部分性能。它們的數據都是通過網絡來傳輸的。

[root@node1 data]# systemctl status glusterd
● glusterd.service - GlusterFS, a clustered file-system server
   Loaded: loaded (/usr/lib/systemd/system/glusterd.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2019-12-04 11:54:00 CST; 4 days ago
 Main PID: 8289 (glusterd)
   CGroup: /system.slice/glusterd.service
           └─8289 /usr/sbin/glusterd -p /var/run/glusterd.pid --log-level INFO

Dec 04 11:53:59 node1 systemd[1]: Starting GlusterFS, a clustered file-system server...
Dec 04 11:54:00 node1 systemd[1]: Started GlusterFS, a clustered file-system server.
[root@node1 data]# 


查看卷的列表
[root@node1 data]# gluster volume list
No volumes present in cluster

創建卷
(這裏卷的類型有很多,根據需求來創建)


[root@node1 data]# gluster volume create 

Usage:
volume create <NEW-VOLNAME> [stripe <COUNT>] [replica <COUNT> [arbiter <COUNT>]] [disperse [<COUNT>]] [disperse-data <COUNT>] [redundancy <COUNT>] [transport <tcp|rdma|tcp,rdma>] <NEW-BRICK>?<vg_name>... [force]

[root@node1 data]# 
[root@node1 ~]# gluster volume create gv1 replica 3 node1:/data/intelcas1-1/ node2:/data/intelcas1-1 node3:/data/intelcas1-1   node1:/data/intelcas1-2 node2:/data/intelcas1-2  node3:/data/intelcas1-2  node1:/data/intelcas1-3 node2:/data/intelcas1-3 node3:/data/intelcas1-3/  force 
volume create: gv1: success: please start the volume to access data
[root@node1 ~]# gluster fs volume list
unrecognized word: fs (position 0)
[root@node1 ~]# gluster volume list
gv1
[root@node1 ~]# gluster volume start gv1 
volume start: gv1: success
[root@node1 ~]# gluster volume info gv1
 
Volume Name: gv1
Type: Distributed-Replicate
Volume ID: 4f90131d-bdc6-488e-b86a-ff77a92fedab
Status: Started
Snapshot Count: 0
Number of Bricks: 3 x 3 = 9
Transport-type: tcp
Bricks:
Brick1: node1:/data/intelcas1-1
Brick2: node2:/data/intelcas1-1
Brick3: node3:/data/intelcas1-1
Brick4: node1:/data/intelcas1-2
Brick5: node2:/data/intelcas1-2
Brick6: node3:/data/intelcas1-2
Brick7: node1:/data/intelcas1-3
Brick8: node2:/data/intelcas1-3
Brick9: node3:/data/intelcas1-3
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
performance.client-io-threads: off
[root@node1 ~]# 


這裏可以把nfs打開:
[root@node1 ~]# gluster volume set gv1  nfs.disable off
Gluster NFS is being deprecated in favor of NFS-Ganesha Enter "yes" to continue using Gluster NFS (y/n) y
volume set: success
[root@node1 ~]# 
[root@node1 dev]# gluster volume get gv1  nfs.disable  
Option                                  Value                                   
------                                  -----                                   
nfs.disable                             off                                     
[root@node1 dev]# 

[root@node1 ~]# gluster volume info gv1                
 
Volume Name: gv1
Type: Distributed-Replicate
Volume ID: 4f90131d-bdc6-488e-b86a-ff77a92fedab
Status: Started
Snapshot Count: 0
Number of Bricks: 3 x 3 = 9
Transport-type: tcp
Bricks:
Brick1: node1:/data/intelcas1-1
Brick2: node2:/data/intelcas1-1
Brick3: node3:/data/intelcas1-1
Brick4: node1:/data/intelcas1-2
Brick5: node2:/data/intelcas1-2
Brick6: node3:/data/intelcas1-2
Brick7: node1:/data/intelcas1-3
Brick8: node2:/data/intelcas1-3
Brick9: node3:/data/intelcas1-3
Options Reconfigured:
transport.address-family: inet
nfs.disable: off
performance.client-io-threads: off
[root@node1 ~]# 

掛載後就能正常使用了:

[root@node1 ~]# mount.glusterfs  node1:/gv1 /mnt/
[root@node1 mnt]# touch {1..10}.txt
[root@node1 ~]# cd /mnt/
[root@node1 mnt]# ls
10.txt  1.txt  2.txt  3.txt  4.txt  5.txt  6.txt  7.txt  8.txt  9.txt

八 、進行壞盤故障模擬

[root@node1 mnt]# gluster volume status 
Status of volume: gv1
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick node1:/data/intelcas1-1               49152     0          Y       16603
Brick node2:/data/intelcas1-1               49155     0          Y       10689
Brick node3:/data/intelcas1-1               49155     0          Y       762  
Brick node1:/data/intelcas1-2               49155     0          Y       16625
Brick node2:/data/intelcas1-2               49156     0          Y       10711
Brick node3:/data/intelcas1-2               49156     0          Y       785  
Brick node1:/data/intelcas1-3               49156     0          Y       16647
Brick node2:/data/intelcas1-3               49157     0          Y       10733
Brick node3:/data/intelcas1-3               49157     0          Y       807  
NFS Server on localhost                     N/A       N/A        N       N/A  
Self-heal Daemon on localhost               N/A       N/A        Y       16670
NFS Server on node3                         N/A       N/A        N       N/A  
Self-heal Daemon on node3                   N/A       N/A        Y       831  
NFS Server on node2                         N/A       N/A        N       N/A  
Self-heal Daemon on node2                   N/A       N/A        Y       10756
 
Task Status of Volume gv1
------------------------------------------------------------------------------
There are no active volume tasks
 
[root@node1 mnt]# 

這裏假設下面這個盤出現故障,需要更換。

Brick node1:/data/intelcas1-1               49152     0          Y       16603

① 可以使用命令殺掉進程,或者在該節點使用kill命令殺掉進程

[root@node1 mnt]#  gluster volume reset-brick glustervolume.......

當然,也可以使用kill
[root@node1 mnt]# kill -15  16603


[root@node1 mnt]# gluster volume status 
Status of volume: gv1
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick node1:/data/intelcas1-1               N/A       N/A        N       N/A   #發現磁盤已經出現故障
Brick node2:/data/intelcas1-1               49155     0          Y       10689
Brick node3:/data/intelcas1-1               49155     0          Y       762  
Brick node1:/data/intelcas1-2               49155     0          Y       16625
Brick node2:/data/intelcas1-2               49156     0          Y       10711
Brick node3:/data/intelcas1-2               49156     0          Y       785  
Brick node1:/data/intelcas1-3               49156     0          Y       16647
Brick node2:/data/intelcas1-3               49157     0          Y       10733
Brick node3:/data/intelcas1-3               49157     0          Y       807  
NFS Server on localhost                     N/A       N/A        N       N/A  
Self-heal Daemon on localhost               N/A       N/A        Y       16670
NFS Server on node2                         N/A       N/A        N       N/A  
Self-heal Daemon on node2                   N/A       N/A        Y       10756
NFS Server on node3                         N/A       N/A        N       N/A  
Self-heal Daemon on node3                   N/A       N/A        Y       831  
 
Task Status of Volume gv1
------------------------------------------------------------------------------
There are no active volume tasks
 
[root@node1 mnt]# 

② 然後重新模擬出一塊一模一樣的磁盤,並先將原壞磁盤解掛移除,在使用新盤替換。

root@node1 mnt]# casadm -L
WARNING: Intel(R) CAS is running on a non-validated OS!
type    id   disk       status    write policy   device
cache   1    /dev/vde   Running   wb             -
+core   1    /dev/vdb   Active    -              /dev/intelcas1-1
+core   2    /dev/vdc   Active    -              /dev/intelcas1-2
+core   3    /dev/vdd   Active    -              /dev/intelcas1-3
[root@node1 mnt]# umount /dev/intelcas1-1 


使用/dev/vdf替換  /dev/vdb
[root@node1 mnt]# lsblk 
NAME          MAJ:MIN  RM  SIZE RO TYPE MOUNTPOINT
sr0            11:0     1  478K  0 rom  
vda           253:0     0   50G  0 disk 
├─vda1        253:1     0  200M  0 part /boot
└─vda2        253:2     0 49.8G  0 part /
vdb           253:16    0   50G  0 disk 
└─intelcas1-1 252:2048  0   50G  0 disk 
vdc           253:32    0   50G  0 disk 
└─intelcas1-2 252:2304  0   50G  0 disk /data/intelcas1-2
vdd           253:48    0   50G  0 disk 
└─intelcas1-3 252:2560  0   50G  0 disk /data/intelcas1-3
vde           253:64    0   20G  0 disk 
vdf           253:80    0   50G  0 disk 
vdg           253:96    0   50G  0 disk 
vdh           253:112   0   50G  0 disk 


移除brick

[root@node1 mnt]# casadm  -R -i 1 -j 1 
WARNING: Intel(R) CAS is running on a non-validated OS!
[root@node1 mnt]# casadm -L
WARNING: Intel(R) CAS is running on a non-validated OS!
type    id   disk       status    write policy   device
cache   1    /dev/vde   Running   wb             -
+core   2    /dev/vdc   Active    -              /dev/intelcas1-2
+core   3    /dev/vdd   Active    -              /dev/intelcas1-3

把新的磁盤寫系統,然後做core加速
(針對於mkfs.xfs /dev/vdf   要比mkfs.xfs /dev/intelcas1-1 快速)
[root@node1 dev]# mkfs.xfs /dev/vdf 
meta-data=/dev/vdf               isize=512    agcount=4, agsize=3276800 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=13107200, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=6400, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@node1 dev]# casadm -A -i 1 -j 1 -d /dev/vdf           
WARNING: Intel(R) CAS is running on a non-validated OS!
Successfully added core 1 to cache instance 1


[root@node1 dev]# mount /dev/intelcas1-1  /data/intelcas1-1/
[root@node1 dev]# 

[root@node1 dev]# df -h
Filesystem        Size  Used Avail Use% Mounted on
/dev/vda2          50G   43G  7.2G  86% /
devtmpfs          1.9G     0  1.9G   0% /dev
tmpfs             1.9G     0  1.9G   0% /dev/shm
tmpfs             1.9G  143M  1.8G   8% /run
tmpfs             1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/vda1         197M  113M   85M  58% /boot
tmpfs             380M     0  380M   0% /run/user/0
/dev/intelcas1-2   50G   33M   50G   1% /data/intelcas1-2
/dev/intelcas1-3   50G   33M   50G   1% /data/intelcas1-3
node1:/gv1        150G  1.6G  149G   2% /mnt
/dev/intelcas1-1   50G   33M   50G   1% /data/intelcas1-1
然後重新替換brick

[root@node1 dev]# gluster volume list
gv1

[root@node1 dev]# volume reset-brick <VOLNAME> <SOURCE-BRICK> {{start} | {<NEW-BRICK> commit}} - reset-brick operations 

[root@node1 dev]# gluster volume reset-brick gv1 node1:/data/intelcas1-1/ node1:/data/intelcas1-1/ commit force
volume reset-brick: success: reset-brick commit force operation successful
[root@node1 dev]# casadm -L
WARNING: Intel(R) CAS is running on a non-validated OS!
type    id   disk       status    write policy   device
cache   1    /dev/vde   Running   wb             -
+core   1    /dev/vdf   Active    -              /dev/intelcas1-1
+core   2    /dev/vdc   Active    -              /dev/intelcas1-2
+core   3    /dev/vdd   Active    -              /dev/intelcas1-3

檢查一下狀態:
[root@node1 dev]# gluster volume status
Status of volume: gv1
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick node1:/data/intelcas1-1               49152     0          Y       17584 ##已經成功替換
Brick node2:/data/intelcas1-1               49155     0          Y       10689
Brick node3:/data/intelcas1-1               49155     0          Y       762  
Brick node1:/data/intelcas1-2               49155     0          Y       16625
Brick node2:/data/intelcas1-2               49156     0          Y       10711
Brick node3:/data/intelcas1-2               49156     0          Y       785  
Brick node1:/data/intelcas1-3               49156     0          Y       16647
Brick node2:/data/intelcas1-3               49157     0          Y       10733
Brick node3:/data/intelcas1-3               49157     0          Y       807  
NFS Server on localhost                     N/A       N/A        N       N/A  
Self-heal Daemon on localhost               N/A       N/A        Y       17592
NFS Server on node3                         N/A       N/A        N       N/A  
Self-heal Daemon on node3                   N/A       N/A        Y       1591 
NFS Server on node2                         N/A       N/A        N       N/A  
Self-heal Daemon on node2                   N/A       N/A        Y       11526
 
Task Status of Volume gv1
------------------------------------------------------------------------------
There are no active volume tasks
 

[root@node1 dev]# 


[root@node1 mnt]# casadm -L
WARNING: Intel(R) CAS is running on a non-validated OS!
type    id   disk       status    write policy   device
cache   1    /dev/vde   Running   wb             -
+core   1    /dev/vdf   Active    -              /dev/intelcas1-1
+core   2    /dev/vdc   Active    -              /dev/intelcas1-2
+core   3    /dev/vdd   Active    -              /dev/intelcas1-3


然後
並將vdf的id替換掉原來壞盤的id

[root@node1 mnt]# vi /etc/intelcas/intelcas.conf 
#  '- '     '  '--  '--'  '--      '--  --' ' --'

# Intel(R) CAS configuration file - for reference on syntax
# of this file please refer to appropriate documentation

# NOTES:
# 1) It is highly recommended to specify cache/core device using path
# that is constant across reboots - e.g. disk device links in
# /dev/disk/by-id/, preferably those using device WWN if available:
#   /dev/disk/by-id/wwn-0x123456789abcdef0
# Referencing devices via /dev/sd* may result in cache misconfiguration after
# system reboot due to change(s) in drive order.

## Caches configuration section
[caches]
## Cache ID     Cache device                            Cache mode      Extra fields (optional)
## Uncomment and edit the below line for cache configuration
#1              /dev/disk/by-id/nvme-INTEL_SSDP..       WT
1               /dev/disk/by-id/virtio-c3349770-d5e3-494d-b     WB

## Core devices configuration
[cores]
## Cache ID     Core ID         Core device
## Uncomment and edit the below line for core configuration
#1              1               /dev/disk/by-id/wwn-0x123456789abcdef0
1               1               /dev/disk/by-id/virtio-49ac23b4-7bc0-4878-a###這裏替換
1               2               /dev/disk/by-id/virtio-c8e6629c-d6e5-43ce-9
1               3               /dev/disk/by-id/virtio-7af8271a-500d-463d-8

## To specify use of the IO Classification file, place content of the following line in the
## Caches configuration section under Extra fields (optional)
## ioclass_file=/etc/intelcas/ioclass-config.csv
"/etc/intelcas/intelcas.conf" 42L, 1664C written
[root@node1 mnt]# 



在這裏插入圖片描述

③ 然後重啓intelcas,觀察盤符是否飄移

[root@node1 dev]# casadm -L
WARNING: Intel(R) CAS is running on a non-validated OS!
type    id   disk       status    write policy   device
cache   1    /dev/vde   Running   wb             -
+core   1    /dev/vdf   Active    -              /dev/intelcas1-1
+core   2    /dev/vdc   Active    -              /dev/intelcas1-2
+core   3    /dev/vdd   Active    -              /dev/intelcas1-3
[root@node1 dev]# 
發現已經將/dev/vdb  成功替換爲  /dev/vdf 
[root@node1 dev]# cd /mnt/
[root@node1 mnt]# ls
10.txt  1.txt  2.txt  3.txt  4.txt  5.txt  6.txt  7.txt  8.txt  9.txt
[root@node1 mnt]# 
以上便是簡單換盤操作
發佈了158 篇原創文章 · 獲贊 293 · 訪問量 11萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章