硬盘有价,数据无价,如果搭建的服务器是做文件存储,而且所存储的数据很重要的话,我一般会想尽办法保证数据的安全性,并尽量多次,异地的数据备份。
备份的方式多种多样,在这里我只介绍最简单而且超级实用的方法来减少数据丢失的风险。
网上介绍raid,也就是磁盘阵列的理论很多,以下是在公司实际运维中的搭建方法。
Part 1:配置raid5
准备工作:
1)三块容量一样的硬盘,可以是三块500G,也可以是三块1T等等,切记容量要一样大,最好是同一批次的新硬盘,不要舍不得花钱在硬盘上,如果因为硬盘的原因导致数据丢失,得不偿失的。
2)CentOS 的linux操作系统,我用的Centos 6.4,只要是基于Redhat的应该都可以。
配置过程如下:
Part2:邮件提醒
当raid5磁盘阵列出问题时,我们怎么知道呢,也许这台服务器你很少去检查,因为是做数据存储用,但如果raid坏了,或者硬盘损坏,我们又怎么在第一时间知道呢。
网上有一些参考资料,又是要自己搭建邮件服务器,又是要写复杂的检查脚本,费力不讨好。
具体配置如下:
steps
vim /etc/mail.rc: allow p4proxy to send email
at the button
set from=XXXXXXX#set send email address, you can change as you like
set smtp=XXXXXX#using our real smtp server
set smtp-auth-user=XXXXXXX#using your real email account
set smtp-auth-password=your_email_password#using your real email account password
cat /proc/mdstst > /root/mdstat# take a snapshot of raid array healthy /proc/mdstat file
vim /root/raid_monitor.sh#comparing /proc/mdstat and /root/mdstat files, if different then send email to inform.
auto run
vim /etc/crondtab#run this script every 2 hours:0 */2 * * * root /root/raid_monitor.sh
转载于:https://blog.51cto.com/calvinxu/1430713