赞
踩
给自己24核24G内存的独服买了个120G的SSD作OS盘,然后两个1.5T的SSD组raid1作数据库盘,加上原有的3个2THDD组raid5作仓库盘。不多说了直接上干货:
先fdisk -l看看磁盘分区情况,可以看到总共有6个盘,分别是sd[a~f]:
Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes, 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 120.0 GB, 120034123776 bytes, 234441648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00007ae4
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 234440703 116170752 8e Linux LVM
Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes, 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes, 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sde: 1500.3 GB, 1500301910016 bytes, 2930277168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdf: 1500.3 GB, 1500301910016 bytes, 2930277168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
记下每个盘对应的盘号,留着备用。
然后安装centos下的软raid阵列工具mdadm:
yum -y install mdadm
安装完后即可配置阵列:
[root@hostname ~]# mdadm -C /dev/md0 -ayes -l5 -n3 /dev/sd[b,c,d]
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
[root@hostname ~]# mdadm -C /dev/md1 -ayes -l1 -n2 /dev/sd[e,f]
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md1 started.
中间如果弹出警告不管他就好,反正是作为数据盘用而不是作为启动盘。
上述步骤操作完之后系统就自动开始奇偶校验了,然后通过以下命令查看进度:
[root@hostname ~]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4] [raid1]
md1 : active raid1 sdf[1] sde[0]
1465006464 blocks super 1.2 [2/2] [UU]
[=>...................] resync = 7.5% (110671488/1465006464) finish=229.2min speed=98449K/sec
bitmap: 11/11 pages [44KB], 65536KB chunk
md0 : active raid5 sdd[3] sdc[1] sdb[0]
3906764800 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [UU_]
[>....................] recovery = 3.2% (63790592/1953382400) finish=571.6min speed=55093K/sec
bitmap: 0/15 pages [0KB], 65536KB chunk
等奇偶校验好了之后需要创建配置文件:
echo DEVICE /dev/sd{b,c,d} >> /etc/mdadm.conf
echo DEVICE /dev/sd{e,f} >> /etc/mdadm.conf
mdadm -Evs >> /etc/mdadm.conf
然后格式化、写入挂载信息、挂载
开启trim和定期指定trim:
fstrim --verbose --all
systemctl enable fstrim.timer
另外linux会划出来一部分磁盘空间做swap,会导致大量写入,因此需要做一些限制:
vi /etc/sysctl.conf
#写入系统文件,增加下面两行:
vm.swappiness=1
vm.vfs_cache_pressure=50
#保存并生效:
sysctl -p
#启动tmpfs服务
systemctl enable tmp.mount
另外关于磁盘格式的问题,数据库还是选用xfs吧,具体可以参考其他文章中对磁盘格式的对比
This article is under CC BY-NC-SA 4.0 license.
Please quote the original link:https://www.liujason.com/article/195.html
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。