[Memo2010][ITPASS]サーバ交換作業(DNS, gate)
[ITPASSサーバ構築ドキュメント へ戻る]
phase 0
phase0 〜 phaze2 までは new=tako, old=ika である.
new の DNS キャッシュの TTL を変更
TTL を入替え作業時間よりも十分に短い時間に変更した.
localhost.rev, localhost.zone
$TTL 3600
を
$TTL 300
に変更した.
- 各ファイルの serial を 更新した.
phase 1 (入替え開始)
サービス停止前の下準備をする.
new の DNS 設定 /etc/resolv.conf が以下のようになっていることを確認した.
nameserver 133.30.14.2 nameserver 133.30.14.3 nameserver 133.30.8.2 search scitec.kobe-u.ac.jp
上記では nameserver として神戸大・学術基盤センターの DNS サーバを指定している.
phase 2
old から new へ各種データをコピー
root のログインを許可するため, 設定を変更した.
new の /etc/ssh/sshd_config で,
PermitRootLogin no
という部分を
PermitRootLogin yes
に変更した.
その後,
new# /etc/init.d/ssh restart
として設定を反映すること. これにより, root のログインを許可することとなる.
old の /var/spool/cron/crontabs 以下の各ファイルを new へコピー
- scp コマンドで移す際には, パーミッションやグループ等の設定を変えてしまわないように注意 (オプション p の使用).
root@ika-itpass:/var/spool/cron# scp -p -r crontabs root@133.30.109.21:/var/spool/cron/crontabs
- old の /etc/shadow のユーザ部分を new へコピー (注意)
old, new に別々の仮想端末でログインする.
new の /etc/shadow を/etc/shadow~にバックアップ. old の /etc/shadow のユーザー部分 (UID が 1000 〜 29999 までのもの. UID とユーザ名の対応については /etc/passwd) を参照した.
このファイルをそのままコピーすると, new での構築作業用アカウントが消えるので, old と new を比較して, UID が new にない UID が 1000 〜 29999 までのものを目視でコピーした.
- /home ディレクトリを rsync する
- 作業については home 領域を old から new へ転送 を参照.
作業後に, old 側の new に対する通信制限の設定を行った.
先ほど, old から new に rsync でファイルを転送するために, root のログインを許可したので, 設定を変更して元に戻した.
/etc/ssh/sshd_config の
PermitRootLogin yes
という部分を
PermitRootLogin no
に変更したのち,
new# /etc/init.d/ssh restart
として設定を反映することにより元に戻した.
phase 3
これ以降、new=ika, old=tako である.
- old
bind を止めてサーバ起動時に bind が立ち上がらないように、起動スクリプトを変更する.
root@tako-itpass:/etc/init.d# /etc/init.d/bind stop root@tako-itpass:/etc/init.d# update-rc.d -f bind remove Removing any system startup links for /etc/init.d/bind ... /etc/rc0.d/K20bind /etc/rc1.d/K20bind /etc/rc2.d/S20bind /etc/rc3.d/S20bind /etc/rc4.d/S20bind /etc/rc5.d/S20bind /etc/rc6.d/K20bind
- new
これまでのファイルをバックアップする.
root@ika-itpass:/usr/local/bind/etc# cp -r namedb namedb-20101029 root@ika-itpass:/usr/local/bind/etc# update-rc.d bind defaults update-rc.d: warning: /etc/init.d/bind missing LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScripts> Adding system startup for /etc/init.d/bind ... /etc/rc0.d/K20bind -> ../init.d/bind /etc/rc1.d/K20bind -> ../init.d/bind /etc/rc6.d/K20bind -> ../init.d/bind /etc/rc2.d/S20bind -> ../init.d/bind /etc/rc3.d/S20bind -> ../init.d/bind /etc/rc4.d/S20bind -> ../init.d/bind /etc/rc5.d/S20bind -> ../init.d/bind
ここで LSB の警告が出たが, [Memo2009][ITPASS] tako 構築作業ログ(DNS)(村上(健), 古家, 井谷) で同様の警告が出ていたため, それを参照し,以下を /etc/init.d/bind の冒頭に追記した.
### BEGIN INIT INFO # Provides: bind9 # Required-Start: $remote_fs # Required-Stop: $remote_fs # Should-Start: $network $syslog # Should-Stop: $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start and stop bind9 # Description: bind9 is a Domain Name Server (DNS) # which translates ip addresses to and from internet names ### END INIT INFO
このあと, 一度 update-rc.d -f bind remove を実行し, もういちど update-rc.d bind defaults を実行すると, 警告は出なくなった.
サーバ起動時に bind が立ち上がるよう, 起動スクリプトを変更した.
# update-rc.d bind defaults
bind の起動確認
サーバ交換作業が終わったら, reboot して bind が起動することを確認する.
new (bindが起動していることを確認)
chikuwa3@ika-itpass:~$ ps ax | grep bind 2601 ? Ss 0:00 /usr/local/bind/sbin/named -c /usr/local/bind/etc/namedb/named.conf -u bind 3224 pts/3 R+ 0:00 grep bind
old (bindを起動していないことを確認)
takahasu@tako-itpass:~$ ps ax | grep bind 3897 pts/3 S+ 0:00 grep bind
phase 4
移行の最終チェック
old と new でそれぞれ問い合わせに応じるか, 正しいデータを返すかをチェックする.
$ dig itpass.scitec.kobe-u.ac.jp --> 133.30.109.22を返したので OK. $ dig old-itpass.scitec.kobe-u.ac.jp --> 133.30.109.21を返したので OK. $ dig new-itpass.scitec.kobe-u.ac.jp --> 133.30.109.22を返したので OK.
後日の作業
- ika の DNS の TTL を元に戻す.
- /usr/local/bind/etc/namedb のバックアップとして /usr/local/bind/etc/namedb-20101105 (バックアップする日付) を作成.
- /usr/local/bind/etc/namedb/{localhost.zone, localhost.rev} の$TTLを300から3600に変更. serial も更新.
bind を再起動.
/etc/init.d/bind restart
- ps ax でプロセスを確認した.
[ITPASSサーバ構築ドキュメント へ戻る]
Keyword(s):
References:[[ITPASS2010]2010年度サーバ構築ログ]