<?xml version="1.0" encoding="UTF-8" ?><rdf:RDF 
  xmlns="http://purl.org/rss/1.0/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:atom="http://www.w3.org/2005/Atom"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xml:lang="ja">
  <channel rdf:about="http://w.atwiki.jp/redundancy/">
    <title>理團男子 wiki</title>
    <link>http://w.atwiki.jp/redundancy/</link>
    <atom:link href="https://w.atwiki.jp/redundancy/rss10.xml" rel="self" type="application/rss+xml" />
    <atom:link rel="hub" href="https://pubsubhubbub.appspot.com" />
    <description>理團男子 wiki</description>

    <dc:language>ja</dc:language>
    <dc:date>2008-02-06T18:06:05+09:00</dc:date>
    <utime>1202288765</utime>

    <items>
      <rdf:Seq>
                <rdf:li rdf:resource="https://w.atwiki.jp/redundancy/pages/12.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/redundancy/pages/11.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/redundancy/pages/14.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/redundancy/pages/1.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/redundancy/pages/16.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/redundancy/pages/18.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/redundancy/pages/17.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/redundancy/pages/15.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/redundancy/pages/13.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/redundancy/pages/10.html" />
              </rdf:Seq>
    </items>
	
		
    
  </channel>
    <item rdf:about="https://w.atwiki.jp/redundancy/pages/12.html">
    <title>DHCP</title>
    <link>https://w.atwiki.jp/redundancy/pages/12.html</link>
    <description>
      #contents
----
*dhcp-server
-[[MAN&gt;http://www.linux.or.jp/JM/html/dhcp2/man5/dhcpd.conf.5.html]]

**DHCPのログを分ける
-http://www.honto.info/bibouroku/dhcpd_log/node1.html    </description>
    <dc:date>2008-02-06T18:06:05+09:00</dc:date>
    <utime>1202288765</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/redundancy/pages/11.html">
    <title>Xen</title>
    <link>https://w.atwiki.jp/redundancy/pages/11.html</link>
    <description>
      #contents
----

*xmコマンド
**xm list
**xm create

 # xm create [domain config file]

 # xm create -c  [domain config file]

:-c|起動後、コンソールに繋ぎに行く


**xm console
**xm save

 # xm save [domain name] [save file]

**xm restore


*Xen0の構築
**OSインストール

Xen0はCentOS5にて構築。インストール時に仮想化を組み込んでおけば特に何もすることなくXen0として起動する。マシンはこれ。

インストールはPEXブートで行う。

パーティションはkickstartではこうなった。

 clearpart --linux --drives=sda,sdb
 part raid.20 --size=200 --ondisk=sda --asprimary 
 part raid.21 --size=200 --ondisk=sdb --asprimary
 part swap --size=8000 --ondisk=sdb
 part swap --size=8000 --ondisk=sda
 part raid.26 --size=100 --grow --ondisk=sdb
 part raid.25 --size=100 --grow --ondisk=sda
 raid /boot --fstype ext3 --level=RAID1 --device=md0 raid.20 raid.21
 raid pv.27 --fstype &quot;physical volume (LVM)&quot; --level=RAID1 --device=md1 raid.25 raid.26
 volgroup VG0 --noformat --pesize=32768 pv.27
 logvol / --fstype ext3 --name=root --vgname=VG0 --size=20000

とりあえず、Xen0には20GBもあればいいのではないか。CentOSはソフトウェアRAID1に/bootパーティションを含ませておけば、両方のHDDにブートローダを書き込んでくれるので楽ちん。
もしsdbにブートローダが書き込まれなかった場合は、grubでインストールすること。

とりあえずインストールが終わったら、zshやらscreenやらsudoやらは各自お好みで。

HDDは初期不良率が高いので、とりあえずバッドブロックが無いか調べることにする。

 # badblocks -o /tmp/badblocks_sda.txt -v /dev/sda
 # badblocks -o /tmp/badblocks_sdb.txt -v /dev/sdb


500GBもあると長い。。

 Pass completed, 0 bad blocks found.

と無事出ただろうか。

**インストール後の設定
***yum-updates
 /etc/yum/yum-updatesd.conf 

 emit_via = email

自動的に

 dbus_listener = yes

これもいらないだろう。コメントアウトしておく。

など。upadteも自動にする場合は、

 # automatically install updates
 do_update = no
 # automatically download updates
 do_download = no
 # automatically download deps of updates
 do_download_deps = no

をyesに。

pkgの役割などは[[ここ&gt;http://www.s-atu.net/centos3.html]]を参照させていただいたり。

*Xen-U
**インストール
***virt-install
コマンドラインからならvirt-installが便利。

 # virt-install \
 --paravirt \
 --name=v_disk_4 \
 --vcpus=2 \
 --ram=512 \
 --file=/opt/xen/xen-u-1.img \
 --file-size=4 \
 --location=ftp://localhost/pub/centos5 \
 --nographics \
 -x ks=ftp://localhost/pub/xen-u-ks.cfg

:--paravirt|準仮想化
:-x|Additional arguments to pass to the installer with paravirt guests とhelpにあるので、インストーラに渡す準仮想化のオプションですね。ここではkickstart用ファイルを指定。xのバーチャルマシンマネージャでも指定できます。


**インストール後設定
***必要ないサービスのストップ
Xen-Uでこれはいらないだろう、というサービスを止めたりパッケージ削除したり。
-smartd
-cpuspeed
-kudzu
-rawdevices
-cups
-IPv6も必要なければ使わないほうがよい。
 /etc/modprobe.conf
に、
 alias net-pf-10 off
を追加して再起動。
--流れでip6tablesもいらない。

など。
***必要なサービスのスタート
Xen-Uでもこれは使うな、というサービスのスタートやらインストールやら設定やら
-zsh
-screen
-ntp
-snmpd

**Masterにする際に気をつけること
-不要なサービスは自動起動設定を無効にすること
上記した、smartdとかね。
-パッケージアップデートを行うこと
-ネットワークインタフェースの設定はDHCPにしておくこと
IPアドレスを固定にしてしまうと、コピーして作った仮想マシンを同時に起動した際にIPアドレスが重複してしまいます。IPアドレスはコピーした仮想マシンの初回起動時に設定します。
-ネットワークインタフェースの設定でMACアドレスを消しておくこと
これは忘れがちなので気をつける。CentOS5.1では指定されていた。
-rootユーザの初期パスワードには捨てパスワードを使用すること
捨てパスワードを設定しておくと、第3者に対してマスターイメージをコピーして提供することが容易になります。
-rootユーザのbash履歴ファイルを消しておくこと
-/etc/ssh/ssh_host*などの鍵ファイルを消しておくこと。（次回起動時に生成される）

***Masterからコピーした後にすること。
+xen-u設定ファイルで、uuid、macアドレスの変更。
+rootパスワードの変更。
+hostnameの変更。

参考URL
-http://www.thinkit.co.jp/cert/article/0606/4/1/3.htm

**Xen-Uイメージファイルをループバックでマウント。
+losetup -f((使用されていない最初の loop デバイスを見つける))
+losetup /dev/loop0 [xen imagefile]
+ls /dev/mapper
+kpartx -a /dev/loop0
+ls /dev/mapper((imagefile中のパーティションが追加されている))
+vgscan
+lvscan
+lvchange -ay /dev/VolGroup00/LogVol00((マウントするLVをActiveに))
+mount /dev/VolGroup00/LogVol00 /mnt

マウント出来ただろうか。参考URL中にもあるが、マウントするマシンと、Xen-UでVolumeGroup名が被っていると上手くいかない。その場合はVolGroup名を変更するためのマウント用Xen-Uを新たに作成する。詳しくは[[こちら&gt;http://ken-etsu-tech.blogspot.com/2007/01/lvmxen.html]]。

解除するには、手順を逆に行う。

+umount /mnt
+lvchange -an /dev/VolGroup00/LogVol00
+lvscan((ActibeがInactiveに戻っているかチェック))
+kpartx -d /dev/loop0
+losetup -d /dev/loop0


参考URL
-http://ken-etsu-tech.blogspot.com/2007/01/dom0domu.html
-http://ken-etsu-tech.blogspot.com/2007/01/lvmxen.html
-http://www.spicebeat.net/xoops/modules/bwiki/index.php?%B4%FB%C2%B8%A5%D1%A1%BC%A5%C6%A5%A3%A5%B7%A5%E7%A5%F3%A4%F2RAID%2BLVM%A4%CB%CA%D1%B9%B9    </description>
    <dc:date>2008-02-01T11:17:25+09:00</dc:date>
    <utime>1201832245</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/redundancy/pages/14.html">
    <title>ネットワークブート</title>
    <link>https://w.atwiki.jp/redundancy/pages/14.html</link>
    <description>
      #contents
----
*PXE
**PXEでmemtest86を起動

まずはmemtest86のダウンロード
 $ wget http://www.memtest.org/download/1.70/memtest86+-1.70.bin.gz
 $ gunzip memtest86+-1.70.bin.gz
 $ mv memtest86+-1.70.bin memtest-1.70

拡張子をつけてると死ねるらしい。取ってしまおう。
あとはいつも通りに、

 # cd /tftpboot/
 # mkdir memtest
 # cd memtest

memtestフォルダでも作って、上記のmemtest-1.70とpxelinux.0をコピーしてくる。

 # mkdir pxelinux.cfg
 # vi pxelinux.cfg/default
 default memtest
   prompt 5
   timeout 30
   label memtest
     kernel memtest-1.70

dhcpd.confもチェンジ。

 filename &quot;/memtest/pxelinux.0&quot;;

無事memtestが起動しただろうか。

***参考サイト


*リンク
-[[DSASのここんとこ～ネットワークブート編～http://log.blog.klab.org/support/20071102/netboot.pdf]]    </description>
    <dc:date>2008-01-29T16:55:14+09:00</dc:date>
    <utime>1201593314</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/redundancy/pages/1.html">
    <title>トップページ</title>
    <link>https://w.atwiki.jp/redundancy/pages/1.html</link>
    <description>
      *理團男子 wiki

ブログは[[こちら&gt;http://blog.livedoor.jp/redundancy/]]。

----    </description>
    <dc:date>2008-01-26T14:50:44+09:00</dc:date>
    <utime>1201326644</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/redundancy/pages/16.html">
    <title>DRBD</title>
    <link>https://w.atwiki.jp/redundancy/pages/16.html</link>
    <description>
      #contents
----
*lvmを使った一連の流れ
モジュールなど必要な環境はできている前提。
+lvcreateで両方のサーバにLogicalVolumeを作成。
+drbd.confの作成、または修正。resourceを追加する時、port番号を変更するの忘れがちなので注意。
++drbd,confを両方のサーバで同じ物にする。
+両方のサーバでdrbdadm create-md [resource name]
+両方のサーバでdrbd再起動、または drbdadm up [resource name]
+cat /proc/drbdでSecondary/Secondary Inconsistent/Inconsistent になっているのを確認。
+primaryにしたいサーバで、drbdadm -- --overwrite-data-of-peer primary [resource name]((最初は強制的にどちらからかデータを同期させなくてはいけない。--オプションはdrbdsetupコマンドを入力する時のオプション))
+cat /proc/drbdでPrimaryになり、同期が開始されているのを確認。
+/dev/[device name]をmountしたり、なにしたり。



*参考サイト
-[[DRBDドキュメント&gt;http://www.drbd.jp/documentation.html]]
-[[第2回KLab勉強会&gt;http://dsas.blog.klab.org/archives/51047874.html]]
DRBD+Keepalivedでストレージサーバ

----
#comment
----    </description>
    <dc:date>2008-01-26T14:47:30+09:00</dc:date>
    <utime>1201326450</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/redundancy/pages/18.html">
    <title>fstab</title>
    <link>https://w.atwiki.jp/redundancy/pages/18.html</link>
    <description>
      #contents
----

-[[/etc/fstabに記述されている数字の意味&gt;http://www.google.com/search?hl=ja&amp;lr=lang_ja&amp;ie=UTF-8&amp;oe=UTF-8&amp;q=fstab&amp;num=50]]

----
#comment
----    </description>
    <dc:date>2008-01-25T20:22:12+09:00</dc:date>
    <utime>1201260132</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/redundancy/pages/17.html">
    <title>Cacti</title>
    <link>https://w.atwiki.jp/redundancy/pages/17.html</link>
    <description>
      #contents
----
*snmpd.conf
snmpd.confに追加。

 view systemview included .1
 disk / 1000000

diskはコメントアウトされているが存在するので、その行からコメントを外せばよい。

*参考URL
-[[Cactiリンク集&gt;http://shrine-bell.seesaa.net/article/60026471.html]]

----
#comment
----    </description>
    <dc:date>2008-01-24T17:51:29+09:00</dc:date>
    <utime>1201164689</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/redundancy/pages/15.html">
    <title>0雛形</title>
    <link>https://w.atwiki.jp/redundancy/pages/15.html</link>
    <description>
          </description>
    <dc:date>2008-01-23T13:41:36+09:00</dc:date>
    <utime>1201063296</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/redundancy/pages/13.html">
    <title>OpenSuse</title>
    <link>https://w.atwiki.jp/redundancy/pages/13.html</link>
    <description>
      #contents
----

*リンク
**ダウンロード
-http://software.opensuse.org/    </description>
    <dc:date>2008-01-23T13:20:00+09:00</dc:date>
    <utime>1201062000</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/redundancy/pages/10.html">
    <title>プラグイン/コメント</title>
    <link>https://w.atwiki.jp/redundancy/pages/10.html</link>
    <description>
      * コメントプラグイン
@wikiのwikiモードでは
 #comment()
と入力することでコメントフォームを簡単に作成することができます。
詳しくはこちらをご覧ください。
＝＞http://atwiki.jp/guide/17_60_ja.html


-----
たとえば、#comment() と入力すると以下のように表示されます。

#comment    </description>
    <dc:date>2008-01-23T12:02:44+09:00</dc:date>
    <utime>1201057364</utime>
  </item>
  </rdf:RDF>
