一、背景
有这样一个系统,由于之前控制成本,只购买了一台服务器,主要存放视频,服务器有16个12T的低速硬盘,做的RAID5。突然有一天,机房断电机器重启后160T的硬盘不见了,这是真的慌了,对于客户来说,最重要的就是视频,由于对硬件这一块我不太了解,也不敢随便乱动,买的是DELL服务器,打电话联系了DELL服务器售后,第二天上门维修检测,BIOS显示磁盘阵列16块磁盘,其中有2块掉盘,状态为missing,经过工程师的准确定位及处理,还好硬盘不是真的坏了,重新激活了磁盘,具体怎么操作不是很懂,处理好之后重新挂载发现数据还在。
首先,非常感谢DELL售后的工程师,真的是帮了我们大忙!
针对当前的问题,有几个问题需要检讨一下。
1、建议做RAID6,可以最多容忍2块磁盘损坏,不要做RAID5,只能容忍1块磁盘,当前如果预算够可以坐RAID1。
2、如果数据非常重要,建议做备份,有些成本是不能省的,出现问题还是得运维背锅。
出现了这个问题之后,客户决定购买备份服务器。现在就对当前环境的视频文件做异机备份。
二、操作步骤
1、编辑脚本
[root@localhost ~]# vim rsync.exp
#!/usr/bin/expect
########################################################################
if {
$argc!=6 } {
send_user "Usage: rsync.exp localfile remoteip remoteport remoteuser remotepwd remotedir\n\n"
exit 1
}
set localfile [lindex $argv 0]
set remoteip [lindex $argv 1]
set remoteport [lindex $argv 2]
set remoteuser [lindex $argv 3]
set remotepwd [lindex $argv 4]
set remotedir [lindex $argv 5]
set timeout 3600
spawn /usr/bin/rsync -arvPz -e "ssh -l$remoteuser -p$remoteport" $localfile $remoteip:$remotedir
expect {
"password:" {
send "$remotepwd\r"
exp_continue
}
"yes/no)?" {
send "yes\r"
exp_continue
}
timeout {
close
break
}
eof {
exit 0
}
}
exit
2、定时任务
# crontab -e
*/5 * * * * ~/rsync.exp ~/opt/rsync-time-backup-master.zip 192.168.1.144 22 root 123456 /opt
总结:整理不易,如果对你有帮助,可否点赞关注一下?
更多详细内容请参考:Linux运维实战总结