NIS Server DR SOP

NIS Server DR SOP
  
NIS 服务器系统灾难恢复
方法:一
一. 确定关键的文件
l          主配置目录 (/etc)
l          DNS 域信息 (/var/bind)
l          NIS/NIS+ 文件和配置 (/var/yp)
l          Lightweight Directory Access Protocol (LDAP) 服务器数据( /var/ldap
二.  为不同的目录创建经过 tar 处理和压缩的备份
#!/bin/bash
DATE=`date +%Y%m%d.%H%M`
HOST=`sh1`
TEMP=/mnt/backup
echo "Preparing backup..."
cd /etc
tar cf - ./* |bzip2 -9 - >$TEMP/$HOST-etc.$DATE.tar.bz2
cd /var/bind
tar cf - ./* |bzip2 -9 - >$TEMP/$HOST-bind.$DATE.tar.bz2
cd /var/yp
tar cf - ./* |bzip2 -9 - >$TEMP/$HOST-nis.$DATE.tar.bz2
cd /var/ldap
tar cf - ./* |bzip2 -9 - >$TEMP/$HOST-ldap.$DATE.tar.bz2
echo "complete backup..."
    
三. 安装 nis 服务器操作系统并配置网络
  安装操作系统时 我们必须清楚 backup server sh1 的以下一些信息 :
 
OS 版本信息 : SUNOS 5.8 Generic_117350-36
Partition 信息 : /dev/dsk/c0t0d0s0   à    /         3.91G        0  --  805
           /dev/dsk/c0t0d0s1   à    swap     3.91G     806  --  1611
           /dev/dsk/c0t0d0s3   à    /home    60.53G    1612  --  14086
四. 挂载 backup server 恢复目录;
 
# cd /mnt/backup
# tar �Cjmxvf sh1-etc.date.tar.bz2 �CC /etc/
# tar �Cjmxvf sh1-bind.date.tar.bz2 �CC /var/bind/
# tar �Cjmxvf sh1- nis .date.tar.bz2 �CC /var/yp/
# tar �Cjmxvf sh1- ldap .date.tar.bz2 �CC /var/ldap/

    
五. 启动 nis server autofs
# ypinit �Cm
In order for NIS to operate successfully, we have to construct a list of
the NIS servers. Please continue to add the names for YP servers in order
of preference, one per line. When you are done with the list, type a
<control D> or a return on a line by itself.
next host to add: sh1
next host to add: ^D
The current list of yp servers looks like this:
sh1
Is this correct? [y/n: y] y
Installing the YP database will require that you answer a few questions.
Questions will all be asked at the beginning of the procedure.
Do you want this procedure to quit on non-fatal errors? [y/n: n] n
OK, please remember to go back and redo manually whatever fails. If you
don't, some part of the system (perhaps the yp itself) won't work.
# /usr/lib/netsvc/yp/ypstart
# cd /var/yp; /usr/ccs/bin/make
# /etc/init.d/autofs start
 
 
六.              验证 nis server 是否正常启动, automount 挂载目录是否正确
 
七. 完成事故报告
对事故作记录,总结事故发生原因,避免产生同样的问题。
 
方法:二
一. 准备 1 块与原使用盘相同的硬盘
Partition 信息 : /dev/dsk/c0t1d0s0   à    /        7.8G        0  --  1611
           /dev/dsk/c0t1d0s1   à    swap     3.91G     1611  --  2416
           /dev/dsk/c0t1d0s3   à    /home    56.53G    2416  --  14086
 
二. 定期运行脚本 backupfilesys
脚本 backupfilesys 内容
#!/bin/bash
 
WORKDIR=/u/sysadmin/backup/sh1
LOGFILE=${WORKDIR}/log/`date +%Y%m%d`.log
UFSDUMP=/usr/sbin/ufsdump
UFSRESTORE=/usr/sbin/ufsrestore
        
exec > $LOGFILE 2>&1
mount -F ufs /dev/dsk/c0t1d0s0 /backup/root
mount -F ufs /dev/dsk/c0t1d0s3 /backup/home
$UFSDUMP 0f - /dev/dsk/c0t0d0s0 | (cd /backup/root;$UFSRESTORE rf -)
$UFSDUMP 0f - /dev/dsk/c0t0d0s3 | (cd /backup/home;$UFSRESTORE rf -)
umount /backup/root
umount /backup/home
fsck -y /dev/rdsk/c0t1d0s0
fsck -y /dev/rdsk/c0t1d0s3
installboot /usr/platform/sun4u/lib/fs/ufs/bootblk /dev/rdsk/c0t1d0s0
exit
 
三. 更换硬盘,查看 nis server 是否正常工作
 
四. 完成事故报告
对事故作记录,总结事故发生原因,避免产生同样的问题。
 
 
Reference   

 

---- end ----

你可能感兴趣的:(server,DR,休闲,NIS,SOP)