# # AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: 0\n" "POT-Creation-Date: 2010-12-15T23:32:37\n" "PO-Revision-Date: 2010-12-16 00:32+0800\n" "Last-Translator: Charlie Chen \n" "Language-Team: None\n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Tag: title #, no-c-format msgid "Replicated Storage with DRBD" msgstr "用DRBD同步存储" #. Tag: para #, no-c-format msgid "Even if you’re serving up static websites, having to manually synchronize the contents of that website to all the machines in the cluster is not ideal. For dynamic websites, such as a wiki, its not even an option. Not everyone care afford network-attached storage but somehow the data needs to be kept in sync. Enter DRBD which can be thought of as network based RAID-1. See http://www.drbd.org/ for more details." msgstr "就算你用的是静态站点,手工在各个节点之间同步文件也不是个好主意。如果是动态站点,那根本不会考虑这个。用NAS不是所有人都能负担得起,但是有些数据还是要同步。用用DRBD: 它被认为是网络RAID-1。访问 See http://www.drbd.org/获得更详细介绍" #. Tag: title #, no-c-format msgid "Install the DRBD Packages" msgstr "安装DRBD软件包" #. Tag: para #, no-c-format msgid "Since its inclusion in the upstream 2.6.33 kernel, everything needed to use DRBD ships with &DISTRO; &DISTRO_VERSION;. All you need to do is install it:" msgstr "在2.6.33以上的内核中,所以DRBD要的东西都在 &DISTRO; &DISTRO_VERSION;中存在了,你只要安装它就好了。" #. Tag: screen #, no-c-format msgid "" "\n" "[root@pcmk-1 ~]# yum install -y drbd-pacemaker\n" "Loaded plugins: presto, refresh-packagekit\n" "Setting up Install Process\n" "Resolving Dependencies\n" "--> Running transaction check\n" "---> Package drbd-pacemaker.x86_64 0:8.3.7-2.fc13 set to be updated\n" "--> Processing Dependency: drbd-utils = 8.3.7-2.fc13 for package: drbd-pacemaker-8.3.7-2.fc13.x86_64\n" "--> Running transaction check\n" "---> Package drbd-utils.x86_64 0:8.3.7-2.fc13 set to be updated\n" "--> Finished Dependency Resolution\n" "\n" "Dependencies Resolved\n" "\n" "=================================================================================\n" " Package Arch Version Repository Size\n" "=================================================================================\n" "Installing:\n" " drbd-pacemaker x86_64 8.3.7-2.fc13 fedora 19 k\n" "Installing for dependencies:\n" " drbd-utils x86_64 8.3.7-2.fc13 fedora 165 k\n" "\n" "Transaction Summary\n" "=================================================================================\n" "Install 2 Package(s)\n" "Upgrade 0 Package(s)\n" "\n" "Total download size: 184 k\n" "Installed size: 427 k\n" "Downloading Packages:\n" "Setting up and reading Presto delta metadata\n" "fedora/prestodelta | 1.7 kB 00:00 \n" "Processing delta metadata\n" "Package(s) data still to download: 184 k\n" "(1/2): drbd-pacemaker-8.3.7-2.fc13.x86_64.rpm | 19 kB 00:01 \n" "(2/2): drbd-utils-8.3.7-2.fc13.x86_64.rpm | 165 kB 00:02 \n" "---------------------------------------------------------------------------------\n" "Total 45 kB/s | 184 kB 00:04 \n" "Running rpm_check_debug\n" "Running Transaction Test\n" "Transaction Test Succeeded\n" "Running Transaction\n" " Installing : drbd-utils-8.3.7-2.fc13.x86_64 1/2 \n" " Installing : drbd-pacemaker-8.3.7-2.fc13.x86_64 2/2 \n" "\n" "Installed:\n" " drbd-pacemaker.x86_64 0:8.3.7-2.fc13 \n" "\n" "Dependency Installed:\n" " drbd-utils.x86_64 0:8.3.7-2.fc13 \n" "\n" "Complete!\n" "[root@pcmk-1 ~]#\n" " " msgstr "" "\n" "[root@pcmk-1 ~]# yum install -y drbd-pacemaker\n" "Loaded plugins: presto, refresh-packagekit\n" "Setting up Install Process\n" "Resolving Dependencies\n" "--> Running transaction check\n" "---> Package drbd-pacemaker.x86_64 0:8.3.7-2.fc13 set to be updated\n" "--> Processing Dependency: drbd-utils = 8.3.7-2.fc13 for package: drbd-pacemaker-8.3.7-2.fc13.x86_64\n" "--> Running transaction check\n" "---> Package drbd-utils.x86_64 0:8.3.7-2.fc13 set to be updated\n" "--> Finished Dependency Resolution\n" "\n" "Dependencies Resolved\n" "\n" "=================================================================================\n" " Package Arch Version Repository Size\n" "=================================================================================\n" "Installing:\n" " drbd-pacemaker x86_64 8.3.7-2.fc13 fedora 19 k\n" "Installing for dependencies:\n" " drbd-utils x86_64 8.3.7-2.fc13 fedora 165 k\n" "\n" "Transaction Summary\n" "=================================================================================\n" "Install 2 Package(s)\n" "Upgrade 0 Package(s)\n" "\n" "Total download size: 184 k\n" "Installed size: 427 k\n" "Downloading Packages:\n" "Setting up and reading Presto delta metadata\n" "fedora/prestodelta | 1.7 kB 00:00 \n" "Processing delta metadata\n" "Package(s) data still to download: 184 k\n" "(1/2): drbd-pacemaker-8.3.7-2.fc13.x86_64.rpm | 19 kB 00:01 \n" "(2/2): drbd-utils-8.3.7-2.fc13.x86_64.rpm | 165 kB 00:02 \n" "---------------------------------------------------------------------------------\n" "Total 45 kB/s | 184 kB 00:04 \n" "Running rpm_check_debug\n" "Running Transaction Test\n" "Transaction Test Succeeded\n" "Running Transaction\n" " Installing : drbd-utils-8.3.7-2.fc13.x86_64 1/2 \n" " Installing : drbd-pacemaker-8.3.7-2.fc13.x86_64 2/2 \n" "\n" "Installed:\n" " drbd-pacemaker.x86_64 0:8.3.7-2.fc13 \n" "\n" "Dependency Installed:\n" " drbd-utils.x86_64 0:8.3.7-2.fc13 \n" "\n" "Complete!\n" "[root@pcmk-1 ~]#\n" " " #. Tag: title #, no-c-format msgid "Configure DRBD" msgstr "配置DRBD" #. Tag: para #, no-c-format msgid "Before we configure DRBD, we need to set aside some disk for it to use." msgstr "在我们设置之前,我们要创建一些空的磁盘分区给它。" #. Tag: title #, no-c-format msgid "Create A Partition for DRBD" msgstr "为DRBD创建一个分区" #. Tag: para #, no-c-format msgid "If you have more than 1Gb free, feel free to use it. For this guide however, 1Gb is plenty of space for a single html file and sufficient for later holding the GFS2 metadata." msgstr "如果你有1Gb以上的空间,就用那么多吧, 在这个指南中根本用不到这么多空间。" #. Tag: screen #, no-c-format msgid "" "\n" "[root@pcmk-1 ~]# lvcreate -n drbd-demo -L 1G VolGroup\n" "  Logical volume \"drbd-demo\" created\n" "[root@pcmk-1 ~]# lvs\n" "  LV        VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert\n" "  drbd-demo VolGroup -wi-a- 1.00G                                      \n" "  lv_root   VolGroup -wi-ao   7.30G                                      \n" "  lv_swap   VolGroup -wi-ao 500.00M\n" " " msgstr "" "\n" "[root@pcmk-1 ~]# lvcreate -n drbd-demo -L 1G VolGroup\n" "  Logical volume \"drbd-demo\" created\n" "[root@pcmk-1 ~]# lvs\n" "  LV        VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert\n" "  drbd-demo VolGroup -wi-a- 1.00G                                      \n" "  lv_root   VolGroup -wi-ao   7.30G                                      \n" "  lv_swap   VolGroup -wi-ao 500.00M\n" " " #. Tag: para #, no-c-format msgid "Repeat this on the second node, be sure to use the same size partition." msgstr "在另外一个节点上面执行相同的操作,请确保使用了相同大小的分区。" #. Tag: screen #, no-c-format msgid "" "\n" "[root@pcmk-2 ~]# lvs\n" "  LV      VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert\n" "  lv_root VolGroup -wi-ao   7.30G                                      \n" "  lv_swap VolGroup -wi-ao 500.00M                                      \n" "[root@pcmk-2 ~]# lvcreate -n drbd-demo -L 1G VolGroup\n" "  Logical volume \"drbd-demo\" created\n" "[root@pcmk-2 ~]# lvs\n" "  LV        VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert\n" "  drbd-demo VolGroup -wi-a- 1.00G                                      \n" "  lv_root   VolGroup -wi-ao   7.30G                                      \n" "  lv_swap   VolGroup -wi-ao 500.00M\n" " " msgstr "" "\n" "[root@pcmk-2 ~]# lvs\n" "  LV      VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert\n" "  lv_root VolGroup -wi-ao   7.30G                                      \n" "  lv_swap VolGroup -wi-ao 500.00M                                      \n" "[root@pcmk-2 ~]# lvcreate -n drbd-demo -L 1G VolGroup\n" "  Logical volume \"drbd-demo\" created\n" "[root@pcmk-2 ~]# lvs\n" "  LV        VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert\n" "  drbd-demo VolGroup -wi-a- 1.00G                                      \n" "  lv_root   VolGroup -wi-ao   7.30G                                      \n" "  lv_swap   VolGroup -wi-ao 500.00M\n" " " #. Tag: title #, no-c-format msgid "Write the DRBD Config" msgstr "配置DRBD" #. Tag: para #, no-c-format msgid "There is no series of commands for build a DRBD configuration, so simply copy the configuration below to /etc/drbd.conf" msgstr "没有命令来自动生成DRBD配置文件,所以我们要简单的拷贝下面的配置文件并粘贴到/etc/drbd.conf" #. Tag: para #, no-c-format msgid "Detailed information on the directives used in this configuration (and other alternatives) is available from http://www.drbd.org/users-guide/ch-configure.html" msgstr "想知道配置文件的详细信息,请访问 http://www.drbd.org/users-guide/ch-configure.html" #. Tag: para #, no-c-format msgid "Be sure to use the names and addresses of your nodes if they differ from the ones used in this guide." msgstr "请注意要替换掉name和address选项以符合您的试验环境。" #. Tag: screen #, no-c-format msgid "" "\n" "global { \n" "  usage-count yes; \n" "}\n" "common {\n" "  protocol C;\n" "}\n" "resource wwwdata {\n" "  meta-disk internal;\n" "  device    /dev/drbd1;\n" "  syncer {\n" "    verify-alg sha1;\n" "  }\n" "  net { \n" "    allow-two-primaries; \n" "  }\n" "  on pcmk-1 {\n" "    disk      /dev/mapper/VolGroup-drbd--demo;\n" "    address   192.168.122.101:7789; \n" "  }\n" "  on \n" "pcmk-2 {\n" "    disk      /dev/mapper/VolGroup-drbd--demo;\n" "    address   192.168.122.102:7789; \n" "  }\n" "}\n" " " msgstr "" "\n" "global { \n" "  usage-count yes; \n" "}\n" "common {\n" "  protocol C;\n" "}\n" "resource wwwdata {\n" "  meta-disk internal;\n" "  device    /dev/drbd1;\n" "  syncer {\n" "    verify-alg sha1;\n" "  }\n" "  net { \n" "    allow-two-primaries; \n" "  }\n" "  on pcmk-1 {\n" "    disk      /dev/mapper/VolGroup-drbd--demo;\n" "    address   192.168.122.101:7789; \n" "  }\n" "  on \n" "pcmk-2 {\n" "    disk      /dev/mapper/VolGroup-drbd--demo;\n" "    address   192.168.122.102:7789; \n" "  }\n" "}\n" " " #. Tag: para #, no-c-format msgid "TODO: Explain the reason for the allow-two-primaries option" msgstr "TODO: Explain the reason for the allow-two-primaries option" #. Tag: title #, no-c-format msgid "Initialize and Load DRBD" msgstr "初始化并载入DRBD" #. Tag: para #, no-c-format msgid "With the configuration in place, we can now perform the DRBD initialization" msgstr "配置完成以后,我们可以来执行初始化了" #. Tag: screen #, no-c-format msgid "" "\n" "[root@pcmk-1 ~]# drbdadm create-md wwwdata\n" "md_offset 12578816\n" "al_offset 12546048\n" "bm_offset 12541952\n" "\n" "Found some data \n" " ==> This might destroy existing data! <==\n" "\n" "Do you want to proceed?\n" "[need to type 'yes' to confirm] yes\n" "\n" "Writing meta data...\n" "initializing activity log\n" "NOT initialized bitmap\n" "New drbd meta data block successfully created.\n" "success\n" " " msgstr "" "\n" "[root@pcmk-1 ~]# drbdadm create-md wwwdata\n" "md_offset 12578816\n" "al_offset 12546048\n" "bm_offset 12541952\n" "\n" "Found some data \n" " ==> This might destroy existing data! <==\n" "\n" "Do you want to proceed?\n" "[need to type 'yes' to confirm] yes\n" "\n" "Writing meta data...\n" "initializing activity log\n" "NOT initialized bitmap\n" "New drbd meta data block successfully created.\n" "success\n" " " #. Tag: para #, no-c-format msgid "Now load the DRBD kernel module and confirm that everything is sane" msgstr "现在讲DRBD的模块载入内核并检测是不是都正常" #. Tag: screen #, no-c-format msgid "" "\n" "[root@pcmk-1 ~]# modprobe drbd\n" "[root@pcmk-1 ~]# drbdadm up wwwdata\n" "[root@pcmk-1 ~]# cat /proc/drbd\n" "version: 8.3.6 (api:88/proto:86-90)\n" "GIT-hash: f3606c47cc6fcf6b3f086e425cb34af8b7a81bbf build by root@pcmk-1, 2009-12-08 11:22:57\n" "\n" " 1: cs:WFConnection ro:Secondary/Unknown ds:Inconsistent/DUnknown C r----\n" "    ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:12248\n" "[root@pcmk-1 ~]# \n" "\n" "Repeat on the second node\n" "drbdadm --force create-md wwwdata \n" "modprobe drbd\n" "drbdadm up wwwdata\n" "cat /proc/drbd\n" "[root@pcmk-2 ~]# drbdadm --force create-md wwwdata\n" "Writing meta data...\n" "initializing activity log\n" "NOT initialized bitmap\n" "New drbd meta data block successfully created.\n" "success\n" "[root@pcmk-2 ~]# modprobe drbd\n" "WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/.\n" "[root@pcmk-2 ~]# drbdadm up wwwdata\n" "[root@pcmk-2 ~]# cat /proc/drbd\n" "version: 8.3.6 (api:88/proto:86-90)\n" "GIT-hash: f3606c47cc6fcf6b3f086e425cb34af8b7a81bbf build by root@pcmk-1, 2009-12-08 11:22:57\n" "\n" " 1: cs:Connected ro:Secondary/Secondary ds:Inconsistent/Inconsistent C r----\n" "    ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:12248\n" " " msgstr "" "\n" "[root@pcmk-1 ~]# modprobe drbd\n" "[root@pcmk-1 ~]# drbdadm up wwwdata\n" "[root@pcmk-1 ~]# cat /proc/drbd\n" "version: 8.3.6 (api:88/proto:86-90)\n" "GIT-hash: f3606c47cc6fcf6b3f086e425cb34af8b7a81bbf build by root@pcmk-1, 2009-12-08 11:22:57\n" "\n" " 1: cs:WFConnection ro:Secondary/Unknown ds:Inconsistent/DUnknown C r----\n" "    ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:12248\n" "[root@pcmk-1 ~]# \n" "\n" "Repeat on the second node\n" "drbdadm --force create-md wwwdata \n" "modprobe drbd\n" "drbdadm up wwwdata\n" "cat /proc/drbd\n" "[root@pcmk-2 ~]# drbdadm --force create-md wwwdata\n" "Writing meta data...\n" "initializing activity log\n" "NOT initialized bitmap\n" "New drbd meta data block successfully created.\n" "success\n" "[root@pcmk-2 ~]# modprobe drbd\n" "WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/.\n" "[root@pcmk-2 ~]# drbdadm up wwwdata\n" "[root@pcmk-2 ~]# cat /proc/drbd\n" "version: 8.3.6 (api:88/proto:86-90)\n" "GIT-hash: f3606c47cc6fcf6b3f086e425cb34af8b7a81bbf build by root@pcmk-1, 2009-12-08 11:22:57\n" "\n" " 1: cs:Connected ro:Secondary/Secondary ds:Inconsistent/Inconsistent C r----\n" "    ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:12248\n" " " #. Tag: para #, no-c-format msgid "Now we need to tell DRBD which set of data to use. Since both sides contain garbage, we can run the following on pcmk-1:" msgstr "现在我们要告诉DRBD要用那个数据(那个节点作为主)。因为两边都有一些废数据,我们要在pcmk-1上面执行一下命令。" #. Tag: screen #, no-c-format msgid "" "\n" "[root@pcmk-1 ~]# drbdadm -- --overwrite-data-of-peer primary wwwdata\n" "[root@pcmk-1 ~]# cat /proc/drbd\n" "version: 8.3.6 (api:88/proto:86-90)\n" "GIT-hash: f3606c47cc6fcf6b3f086e425cb34af8b7a81bbf build by root@pcmk-1, 2009-12-08 11:22:57\n" " 1: cs:SyncSource ro:Primary/Secondary ds:UpToDate/Inconsistent C r----\n" "    ns:2184 nr:0 dw:0 dr:2472 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:10064\n" "        [=====>..............] sync'ed: 33.4% (10064/12248)K\n" "        finish: 0:00:37 speed: 240 (240) K/sec\n" "[root@pcmk-1 ~]# cat /proc/drbd\n" "version: 8.3.6 (api:88/proto:86-90)\n" "GIT-hash: f3606c47cc6fcf6b3f086e425cb34af8b7a81bbf build by root@pcmk-1, 2009-12-08 11:22:57\n" " 1: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r----\n" "    ns:12248 nr:0 dw:0 dr:12536 al:0 bm:1 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0\n" " " msgstr "" "\n" "[root@pcmk-1 ~]# drbdadm -- --overwrite-data-of-peer primary wwwdata\n" "[root@pcmk-1 ~]# cat /proc/drbd\n" "version: 8.3.6 (api:88/proto:86-90)\n" "GIT-hash: f3606c47cc6fcf6b3f086e425cb34af8b7a81bbf build by root@pcmk-1, 2009-12-08 11:22:57\n" " 1: cs:SyncSource ro:Primary/Secondary ds:UpToDate/Inconsistent C r----\n" "    ns:2184 nr:0 dw:0 dr:2472 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:10064\n" "        [=====>..............] sync'ed: 33.4% (10064/12248)K\n" "        finish: 0:00:37 speed: 240 (240) K/sec\n" "[root@pcmk-1 ~]# cat /proc/drbd\n" "version: 8.3.6 (api:88/proto:86-90)\n" "GIT-hash: f3606c47cc6fcf6b3f086e425cb34af8b7a81bbf build by root@pcmk-1, 2009-12-08 11:22:57\n" " 1: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r----\n" "    ns:12248 nr:0 dw:0 dr:12536 al:0 bm:1 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0\n" " " #. Tag: para #, no-c-format msgid "pcmk-1 is now in the Primary state which allows it to be written to. Which means its a good point at which to create a filesystem and populate it with some data to serve up via our WebSite resource." msgstr "pcmk-1现在是处于Primary(主)状态了,它允许写入了。这意味着可以在上面创建文件系统并把一些数据放进去,并且用WebSite这个资源来展现。" #. Tag: title #, no-c-format msgid "Populate DRBD with Data" msgstr "向DRBD中添加数据" #. Tag: screen #, no-c-format msgid "" "\n" "[root@pcmk-1 ~]# mkfs.ext4 /dev/drbd1\n" "mke2fs 1.41.4 (27-Jan-2009)\n" "Filesystem label=\n" "OS type: Linux\n" "Block size=1024 (log=0)\n" "Fragment size=1024 (log=0)\n" "3072 inodes, 12248 blocks\n" "612 blocks (5.00%) reserved for the super user\n" "First data block=1\n" "Maximum filesystem blocks=12582912\n" "2 block groups\n" "8192 blocks per group, 8192 fragments per group\n" "1536 inodes per group\n" "Superblock backups stored on blocks: \n" "        8193\n" "\n" "Writing inode tables: done                            \n" "Creating journal (1024 blocks): done\n" "Writing superblocks and filesystem accounting information: done\n" "\n" "This filesystem will be automatically checked every 26 mounts or\n" "180 days, whichever comes first.  Use tune2fs -c or -i to override.\n" "\n" "Now mount the newly created filesystem so we can create our index file\n" "mount /dev/drbd1 /mnt/\n" "cat <<-END >/mnt/index.html\n" "<html>\n" "<body>My Test Site - drbd</body>\n" "</html>\n" "END\n" "umount /dev/drbd1\n" "[root@pcmk-1 ~]# mount /dev/drbd1 /mnt/\n" "[root@pcmk-1 ~]# cat <<-END >/mnt/index.html\n" "> <html>\n" "> <body>My Test Site - drbd</body>\n" "> </html>\n" "> END\n" "[root@pcmk-1 ~]# umount /dev/drbd1\n" " " msgstr "" "\n" "[root@pcmk-1 ~]# mkfs.ext4 /dev/drbd1\n" "mke2fs 1.41.4 (27-Jan-2009)\n" "Filesystem label=\n" "OS type: Linux\n" "Block size=1024 (log=0)\n" "Fragment size=1024 (log=0)\n" "3072 inodes, 12248 blocks\n" "612 blocks (5.00%) reserved for the super user\n" "First data block=1\n" "Maximum filesystem blocks=12582912\n" "2 block groups\n" "8192 blocks per group, 8192 fragments per group\n" "1536 inodes per group\n" "Superblock backups stored on blocks: \n" "        8193\n" "\n" "Writing inode tables: done                            \n" "Creating journal (1024 blocks): done\n" "Writing superblocks and filesystem accounting information: done\n" "\n" "This filesystem will be automatically checked every 26 mounts or\n" "180 days, whichever comes first.  Use tune2fs -c or -i to override.\n" "\n" "Now mount the newly created filesystem so we can create our index file\n" "mount /dev/drbd1 /mnt/\n" "cat <<-END >/mnt/index.html\n" "<html>\n" "<body>My Test Site - drbd</body>\n" "</html>\n" "END\n" "umount /dev/drbd1\n" "[root@pcmk-1 ~]# mount /dev/drbd1 /mnt/\n" "[root@pcmk-1 ~]# cat <<-END >/mnt/index.html\n" "> <html>\n" "> <body>My Test Site - drbd</body>\n" "> </html>\n" "> END\n" "[root@pcmk-1 ~]# umount /dev/drbd1\n" " " #. Tag: title #, no-c-format msgid "Configure the Cluster for DRBD" msgstr "在集群中配置DRBD" #. Tag: para #, no-c-format msgid "One handy feature of the crm shell is that you can use it in interactive mode to make several changes atomically." msgstr "crm shell一个便捷的特性是可以工作在交互模式下并自动的变更配置中的相关部分。" #. Tag: para #, no-c-format msgid "First we launch the shell. The prompt will change to indicate you’re in interactive mode." msgstr "首先我们打开shell。提示会指出你现在是在交互模式下。" #. Tag: screen #, no-c-format msgid "" "\n" "[root@pcmk-1 ~]# crm\n" "cib crm(live)#\n" " " msgstr "" "\n" "[root@pcmk-1 ~]# crm\n" "cib crm(live)#\n" " " #. Tag: para #, no-c-format msgid "Next we must create a working copy or the current configuration. This is where all our changes will go. The cluster will not see any of them until we say its ok. Notice again how the prompt changes, this time to indicate that we’re no longer looking at the live cluster." msgstr "然后我们创建一个当前配置文件的副本。我们在这个副本里更改配置。直到我们提交这个副本之前集群不会应用这些更改。请注意提示符的变更,现在它指出我们看到的已经不是当前(live)集群的配置文件。" #. Tag: screen #, no-c-format msgid "" "\n" "cib crm(live)# cib new drbd\n" "INFO: drbd shadow CIB created\n" "crm(drbd)#\n" " " msgstr "" "\n" "cib crm(live)# cib new drbd\n" "INFO: drbd shadow CIB created\n" "crm(drbd)#\n" " " #. Tag: para #, no-c-format msgid "Now we can create our DRBD clone and display the revised configuration." msgstr "现在我们可以创建DRBD clone,然后看看修改过后的配置文件。" #. Tag: screen #, no-c-format msgid "" "\n" "crm(drbd)# configure primitive WebData ocf:linbit:drbd params drbd_resource=wwwdata \\\n" "        op monitor interval=60s\n" "crm(drbd)# configure ms WebDataClone WebData meta master-max=1 master-node-max=1 \\\n" "        clone-max=2 clone-node-max=1 notify=true\n" "crm(drbd)# configure show\n" "node pcmk-1\n" "node pcmk-2\n" "primitive WebData ocf:linbit:drbd \\\n" " params drbd_resource=\"wwwdata\" \\\n" " op monitor interval=\"60s\"\n" "primitive WebSite ocf:heartbeat:apache \\\n" "        params configfile=\"/etc/httpd/conf/httpd.conf\" \\\n" "        op monitor interval=\"1min\"\n" "primitive ClusterIP ocf:heartbeat:IPaddr2 \\\n" "        params ip=\"192.168.122.101\" cidr_netmask=\"32\" \\\n" "        op monitor interval=\"30s\"\n" "ms WebDataClone WebData \\\n" " meta master-max=\"1\" master-node-max=\"1\" clone-max=\"2\" clone-node-max=\"1\" notify=\"true\"\n" "location prefer-pcmk-1 WebSite 50: pcmk-1\n" "colocation website-with-ip inf: WebSite ClusterIP\n" "order apache-after-ip inf: ClusterIP WebSite\n" "property $id=\"cib-bootstrap-options\" \\\n" "        dc-version=\"1.0.5-462f1569a43740667daf7b0f6b521742e9eb8fa7\" \\\n" "        cluster-infrastructure=\"openais\" \\\n" "        expected-quorum-votes=”2” \\\n" "        stonith-enabled=\"false\" \\\n" "        no-quorum-policy=\"ignore\"\n" "rsc_defaults $id=\"rsc-options\" \\\n" "        resource-stickiness=”100”\n" " " msgstr "" "\n" "crm(drbd)# configure primitive WebData ocf:linbit:drbd params drbd_resource=wwwdata \\\n" "        op monitor interval=60s\n" "crm(drbd)# configure ms WebDataClone WebData meta master-max=1 master-node-max=1 \\\n" "        clone-max=2 clone-node-max=1 notify=true\n" "crm(drbd)# configure show\n" "node pcmk-1\n" "node pcmk-2\n" "primitive WebData ocf:linbit:drbd \\\n" " params drbd_resource=\"wwwdata\" \\\n" " op monitor interval=\"60s\"\n" "primitive WebSite ocf:heartbeat:apache \\\n" "        params configfile=\"/etc/httpd/conf/httpd.conf\" \\\n" "        op monitor interval=\"1min\"\n" "primitive ClusterIP ocf:heartbeat:IPaddr2 \\\n" "        params ip=\"192.168.122.101\" cidr_netmask=\"32\" \\\n" "        op monitor interval=\"30s\"\n" "ms WebDataClone WebData \\\n" " meta master-max=\"1\" master-node-max=\"1\" clone-max=\"2\" clone-node-max=\"1\" notify=\"true\"\n" "location prefer-pcmk-1 WebSite 50: pcmk-1\n" "colocation website-with-ip inf: WebSite ClusterIP\n" "order apache-after-ip inf: ClusterIP WebSite\n" "property $id=\"cib-bootstrap-options\" \\\n" "        dc-version=\"1.0.5-462f1569a43740667daf7b0f6b521742e9eb8fa7\" \\\n" "        cluster-infrastructure=\"openais\" \\\n" "        expected-quorum-votes=”2” \\\n" "        stonith-enabled=\"false\" \\\n" "        no-quorum-policy=\"ignore\"\n" "rsc_defaults $id=\"rsc-options\" \\\n" "        resource-stickiness=”100”\n" " " #. Tag: para #, no-c-format msgid "Once we’re happy with the changes, we can tell the cluster to start using them and use crm_mon to check everything is functioning." msgstr "一旦你确认这些修改没问题,我们就提交这个副本,然后用crm_mon来看看修改是否生效了。" #. Tag: screen #, no-c-format msgid "" "\n" "crm(drbd)# cib commit drbd\n" "INFO: commited 'drbd' shadow CIB to the cluster\n" "crm(drbd)# quit\n" "bye\n" "[root@pcmk-1 ~]# crm_mon\n" "============\n" "Last updated: Tue Sep  1 09:37:13 2009\n" "Stack: openais\n" "Current DC: pcmk-1 - partition with quorum\n" "Version: 1.0.5-462f1569a43740667daf7b0f6b521742e9eb8fa7\n" "2 Nodes configured, 2 expected votes\n" "3 Resources configured.\n" "============\n" "\n" "Online: [ pcmk-1 pcmk-2 ]\n" "\n" "ClusterIP        (ocf::heartbeat:IPaddr):        Started pcmk-1\n" "WebSite (ocf::heartbeat:apache):        Started pcmk-1\n" "Master/Slave Set: WebDataClone\n" " Masters: [ pcmk-2 ]\n" " Slaves: [ pcmk-1 ]\n" " " msgstr "" "\n" "crm(drbd)# cib commit drbd\n" "INFO: commited 'drbd' shadow CIB to the cluster\n" "crm(drbd)# quit\n" "bye\n" "[root@pcmk-1 ~]# crm_mon\n" "============\n" "Last updated: Tue Sep  1 09:37:13 2009\n" "Stack: openais\n" "Current DC: pcmk-1 - partition with quorum\n" "Version: 1.0.5-462f1569a43740667daf7b0f6b521742e9eb8fa7\n" "2 Nodes configured, 2 expected votes\n" "3 Resources configured.\n" "============\n" "\n" "Online: [ pcmk-1 pcmk-2 ]\n" "\n" "ClusterIP        (ocf::heartbeat:IPaddr):        Started pcmk-1\n" "WebSite (ocf::heartbeat:apache):        Started pcmk-1\n" "Master/Slave Set: WebDataClone\n" " Masters: [ pcmk-2 ]\n" " Slaves: [ pcmk-1 ]\n" " " #. Tag: para #, no-c-format msgid "Include details on adding a second DRBD resource" msgstr "Include details on adding a second DRBD resource" #. Tag: para #, no-c-format msgid "Now that DRBD is functioning we can configure a Filesystem resource to use it. In addition to the filesystem’s definition, we also need to tell the cluster where it can be located (only on the DRBD Primary) and when it is allowed to start (after the Primary was promoted)." msgstr "现在DRBD已经工作了,我们可以配置一个Filesystem资源来使用它。 此外,对于这个文件系统的定义,同样的我们告诉集群这个文件系统能在哪运行(主DRBD运行的节点)以及什么时候可以启动(在主DRBD启动以后)。" #. Tag: para #, no-c-format msgid "Once again we’ll use the shell’s interactive mode" msgstr "我们再一次的使用交互模式的crm shell" #. Tag: screen #, no-c-format msgid "" "\n" "[root@pcmk-1 ~]# crm\n" "crm(live)# cib new fs\n" "INFO: fs shadow CIB created\n" "crm(fs)# configure primitive WebFS ocf:heartbeat:Filesystem \\\n" "        params device=\"/dev/drbd/by-res/wwwdata\" directory=\"/var/www/html\" fstype=\"ext4\"\n" "crm(fs)# configure colocation fs_on_drbd inf: WebFS WebDataClone:Master\n" "crm(fs)# configure order WebFS-after-WebData inf: WebDataClone:promote WebFS:start\n" " " msgstr "" "\n" "[root@pcmk-1 ~]# crm\n" "crm(live)# cib new fs\n" "INFO: fs shadow CIB created\n" "crm(fs)# configure primitive WebFS ocf:heartbeat:Filesystem \\\n" "        params device=\"/dev/drbd/by-res/wwwdata\" directory=\"/var/www/html\" fstype=\"ext4\"\n" "crm(fs)# configure colocation fs_on_drbd inf: WebFS WebDataClone:Master\n" "crm(fs)# configure order WebFS-after-WebData inf: WebDataClone:promote WebFS:start\n" " " #. Tag: para #, no-c-format msgid "We also need to tell the cluster that Apache needs to run on the same machine as the filesystem and that it must be active before Apache can start." msgstr "我们也要告诉集群Apache也要运行在同样的节点上,而且文件系统要在Apache之前启动。" #. Tag: screen #, no-c-format msgid "" "\n" "crm(fs)# configure colocation WebSite-with-WebFS inf: WebSite WebFS\n" "crm(fs)# configure order WebSite-after-WebFS inf: WebFS WebSite\n" " " msgstr "" "\n" "crm(fs)# configure colocation WebSite-with-WebFS inf: WebSite WebFS\n" "crm(fs)# configure order WebSite-after-WebFS inf: WebFS WebSite\n" " " #. Tag: para #, no-c-format msgid "Time to review the updated configuration:" msgstr "审视一下你的配置:" #. Tag: screen #, no-c-format msgid "" "\n" "[root@pcmk-1 ~]# crm configure show\n" "node pcmk-1\n" "node pcmk-2\n" "primitive WebData ocf:linbit:drbd \\\n" "        params drbd_resource=\"wwwdata\" \\\n" "        op monitor interval=\"60s\"\n" "primitive WebFS ocf:heartbeat:Filesystem \\\n" "        params device=\"/dev/drbd/by-res/wwwdata\" directory=\"/var/www/html\" fstype=\"ext4\"\n" "primitive WebSite ocf:heartbeat:apache \\\n" "        params configfile=\"/etc/httpd/conf/httpd.conf\" \\\n" "        op monitor interval=\"1min\"\n" "primitive ClusterIP ocf:heartbeat:IPaddr2 \\\n" "        params ip=\"192.168.122.101\" cidr_netmask=\"32\" \\\n" "        op monitor interval=\"30s\"\n" "ms WebDataClone WebData \\\n" "        meta master-max=\"1\" master-node-max=\"1\" clone-max=\"2\" clone-node-max=\"1\" notify=\"true\"\n" "location prefer-pcmk-1 WebSite 50: pcmk-1\n" "colocation WebSite-with-WebFS inf: WebSite WebFS\n" "colocation fs_on_drbd inf: WebFS WebDataClone:Master\n" "colocation website-with-ip inf: WebSite ClusterIP\n" "order WebFS-after-WebData inf: WebDataClone:promote WebFS:start\n" "order WebSite-after-WebFS inf: WebFS WebSite\n" "order apache-after-ip inf: ClusterIP WebSite\n" "property $id=\"cib-bootstrap-options\" \\\n" "        dc-version=\"1.0.5-462f1569a43740667daf7b0f6b521742e9eb8fa7\" \\\n" "        cluster-infrastructure=\"openais\" \\\n" "        expected-quorum-votes=”2” \\\n" "        stonith-enabled=\"false\" \\\n" "        no-quorum-policy=\"ignore\"\n" "rsc_defaults $id=\"rsc-options\" \\\n" "        resource-stickiness=”100”\n" " " msgstr "" "\n" "[root@pcmk-1 ~]# crm configure show\n" "node pcmk-1\n" "node pcmk-2\n" "primitive WebData ocf:linbit:drbd \\\n" "        params drbd_resource=\"wwwdata\" \\\n" "        op monitor interval=\"60s\"\n" "primitive WebFS ocf:heartbeat:Filesystem \\\n" "        params device=\"/dev/drbd/by-res/wwwdata\" directory=\"/var/www/html\" fstype=\"ext4\"\n" "primitive WebSite ocf:heartbeat:apache \\\n" "        params configfile=\"/etc/httpd/conf/httpd.conf\" \\\n" "        op monitor interval=\"1min\"\n" "primitive ClusterIP ocf:heartbeat:IPaddr2 \\\n" "        params ip=\"192.168.122.101\" cidr_netmask=\"32\" \\\n" "        op monitor interval=\"30s\"\n" "ms WebDataClone WebData \\\n" "        meta master-max=\"1\" master-node-max=\"1\" clone-max=\"2\" clone-node-max=\"1\" notify=\"true\"\n" "location prefer-pcmk-1 WebSite 50: pcmk-1\n" "colocation WebSite-with-WebFS inf: WebSite WebFS\n" "colocation fs_on_drbd inf: WebFS WebDataClone:Master\n" "colocation website-with-ip inf: WebSite ClusterIP\n" "order WebFS-after-WebData inf: WebDataClone:promote WebFS:start\n" "order WebSite-after-WebFS inf: WebFS WebSite\n" "order apache-after-ip inf: ClusterIP WebSite\n" "property $id=\"cib-bootstrap-options\" \\\n" "        dc-version=\"1.0.5-462f1569a43740667daf7b0f6b521742e9eb8fa7\" \\\n" "        cluster-infrastructure=\"openais\" \\\n" "        expected-quorum-votes=”2” \\\n" "        stonith-enabled=\"false\" \\\n" "        no-quorum-policy=\"ignore\"\n" "rsc_defaults $id=\"rsc-options\" \\\n" "        resource-stickiness=”100”\n" " " #. Tag: para #, no-c-format msgid "After reviewing the new configuration, we again upload it and watch the cluster put it into effect." msgstr "看完以后,我们提交它并看看有没有生效。" #. Tag: screen #, no-c-format msgid "" "\n" "crm(fs)# cib commit fs\n" "INFO: commited 'fs' shadow CIB to the cluster\n" "crm(fs)# quit\n" "bye\n" "[root@pcmk-1 ~]# crm_mon\n" "============\n" "Last updated: Tue Sep  1 10:08:44 2009\n" "Stack: openais\n" "Current DC: pcmk-1 - partition with quorum\n" "Version: 1.0.5-462f1569a43740667daf7b0f6b521742e9eb8fa7\n" "2 Nodes configured, 2 expected votes\n" "4 Resources configured.\n" "============\n" "\n" "Online: [ pcmk-1 pcmk-2 ]\n" "\n" "ClusterIP        (ocf::heartbeat:IPaddr):        Started pcmk-1\n" "WebSite (ocf::heartbeat:apache): Started pcmk-1\n" "Master/Slave Set: WebDataClone\n" "        Masters: [ pcmk-1 ]\n" "        Slaves: [ pcmk-2 ]\n" "WebFS (ocf::heartbeat:Filesystem): Started pcmk-1\n" " " msgstr "" "\n" "crm(fs)# cib commit fs\n" "INFO: commited 'fs' shadow CIB to the cluster\n" "crm(fs)# quit\n" "bye\n" "[root@pcmk-1 ~]# crm_mon\n" "============\n" "Last updated: Tue Sep  1 10:08:44 2009\n" "Stack: openais\n" "Current DC: pcmk-1 - partition with quorum\n" "Version: 1.0.5-462f1569a43740667daf7b0f6b521742e9eb8fa7\n" "2 Nodes configured, 2 expected votes\n" "4 Resources configured.\n" "============\n" "\n" "Online: [ pcmk-1 pcmk-2 ]\n" "\n" "ClusterIP        (ocf::heartbeat:IPaddr):        Started pcmk-1\n" "WebSite (ocf::heartbeat:apache): Started pcmk-1\n" "Master/Slave Set: WebDataClone\n" "        Masters: [ pcmk-1 ]\n" "        Slaves: [ pcmk-2 ]\n" "WebFS (ocf::heartbeat:Filesystem): Started pcmk-1\n" " " #. Tag: title #, no-c-format msgid "Testing Migration" msgstr "迁移测试" #. Tag: para #, no-c-format msgid "We could shut down the active node again, but another way to safely simulate recovery is to put the node into what is called “standby mode”. Nodes in this state tell the cluster that they are not allowed to run resources. Any resources found active there will be moved elsewhere. This feature can be particularly useful when updating the resources’ packages." msgstr "我们可以再次关掉在运行的那个节点,但是安全的方法是把节点设置为standby模式。节点在这个状态下面等于告诉集群它不能运行任何资源,任何在这个节点上面运行的资源都会被移动到其他地方。这个特性在更新资源安装包的时候特别的方便。(确实!)" #. Tag: para #, no-c-format msgid "Put the local node into standby mode and observe the cluster move all the resources to the other node. Note also that the node’s status will change to indicate that it can no longer host resources." msgstr "把一个本地节点设置为standby模式并观察集群把所有资源移动到另外一个节点了。并且注意节点的状态改变为不能运行任何的资源。" #. Tag: screen #, no-c-format msgid "" "\n" "[root@pcmk-1 ~]# crm node standby\n" "[root@pcmk-1 ~]# crm_mon\n" "============\n" "Last updated: Tue Sep  1 10:09:57 2009\n" "Stack: openais\n" "Current DC: pcmk-1 - partition with quorum\n" "Version: 1.0.5-462f1569a43740667daf7b0f6b521742e9eb8fa7\n" "2 Nodes configured, 2 expected votes\n" "4 Resources configured.\n" "============\n" "\n" "Node pcmk-1: standby\n" "Online: [ pcmk-2 ]\n" "\n" "ClusterIP        (ocf::heartbeat:IPaddr):        Started pcmk-2\n" "WebSite (ocf::heartbeat:apache):        Started pcmk-2\n" "Master/Slave Set: WebDataClone\n" "        Masters: [ pcmk-2 ]\n" "        Stopped: [ WebData:1 ]\n" "WebFS   (ocf::heartbeat:Filesystem):    Started pcmk-2\n" " " msgstr "" "\n" "[root@pcmk-1 ~]# crm node standby\n" "[root@pcmk-1 ~]# crm_mon\n" "============\n" "Last updated: Tue Sep  1 10:09:57 2009\n" "Stack: openais\n" "Current DC: pcmk-1 - partition with quorum\n" "Version: 1.0.5-462f1569a43740667daf7b0f6b521742e9eb8fa7\n" "2 Nodes configured, 2 expected votes\n" "4 Resources configured.\n" "============\n" "\n" "Node pcmk-1: standby\n" "Online: [ pcmk-2 ]\n" "\n" "ClusterIP        (ocf::heartbeat:IPaddr):        Started pcmk-2\n" "WebSite (ocf::heartbeat:apache):        Started pcmk-2\n" "Master/Slave Set: WebDataClone\n" "        Masters: [ pcmk-2 ]\n" "        Stopped: [ WebData:1 ]\n" "WebFS   (ocf::heartbeat:Filesystem):    Started pcmk-2\n" " " #. Tag: para #, no-c-format msgid "Once we’ve done everything we needed to on pcmk-1 (in this case nothing, we just wanted to see the resources move), we can allow the node to be a full cluster member again." msgstr "当我在pcmk-1上面操作完了--本例中没有任何操作,我们只是想让资源移动移动--我们可以让节点变回正常的集群成员。" #. Tag: screen #, no-c-format msgid "" "\n" "[root@pcmk-1 ~]# crm node online\n" "[root@pcmk-1 ~]# crm_mon\n" "============\n" "Last updated: Tue Sep  1 10:13:25 2009\n" "Stack: openais\n" "Current DC: pcmk-1 - partition with quorum\n" "Version: 1.0.5-462f1569a43740667daf7b0f6b521742e9eb8fa7\n" "2 Nodes configured, 2 expected votes\n" "4 Resources configured.\n" "============\n" "\n" "Online: [ pcmk-1 pcmk-2 ]\n" "\n" "ClusterIP        (ocf::heartbeat:IPaddr):        Started pcmk-2\n" "WebSite (ocf::heartbeat:apache):        Started pcmk-2\n" "Master/Slave Set: WebDataClone\n" "        Masters: [ pcmk-2 ]\n" "        Slaves: [ pcmk-1 ]\n" "WebFS   (ocf::heartbeat:Filesystem):    Started pcmk-2\n" " " msgstr "" "\n" "[root@pcmk-1 ~]# crm node online\n" "[root@pcmk-1 ~]# crm_mon\n" "============\n" "Last updated: Tue Sep  1 10:13:25 2009\n" "Stack: openais\n" "Current DC: pcmk-1 - partition with quorum\n" "Version: 1.0.5-462f1569a43740667daf7b0f6b521742e9eb8fa7\n" "2 Nodes configured, 2 expected votes\n" "4 Resources configured.\n" "============\n" "\n" "Online: [ pcmk-1 pcmk-2 ]\n" "\n" "ClusterIP        (ocf::heartbeat:IPaddr):        Started pcmk-2\n" "WebSite (ocf::heartbeat:apache):        Started pcmk-2\n" "Master/Slave Set: WebDataClone\n" "        Masters: [ pcmk-2 ]\n" "        Slaves: [ pcmk-1 ]\n" "WebFS   (ocf::heartbeat:Filesystem):    Started pcmk-2\n" " " #. Tag: para #, no-c-format msgid "Notice that our resource stickiness settings prevent the services from migrating back to pcmk-1." msgstr "注意我们设置的资源黏性值阻止了资源迁移回pcmk-1"