﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-勤加练习，必能得心应手！不期速成，日拱一卒 ！-随笔分类-云计算、虚拟化</title><link>http://www.blogjava.net/ldwblog/category/49576.html</link><description>态度决定一切</description><language>zh-cn</language><lastBuildDate>Tue, 07 Jan 2020 10:50:19 GMT</lastBuildDate><pubDate>Tue, 07 Jan 2020 10:50:19 GMT</pubDate><ttl>60</ttl><item><title>个人公众号「Java爱好者社区」高质量原创文章持续输出，欢迎各位小主关注</title><link>http://www.blogjava.net/ldwblog/archive/2019/10/30/434887.html</link><dc:creator>David1228</dc:creator><author>David1228</author><pubDate>Wed, 30 Oct 2019 06:10:00 GMT</pubDate><guid>http://www.blogjava.net/ldwblog/archive/2019/10/30/434887.html</guid><wfw:comment>http://www.blogjava.net/ldwblog/comments/434887.html</wfw:comment><comments>http://www.blogjava.net/ldwblog/archive/2019/10/30/434887.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ldwblog/comments/commentRss/434887.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ldwblog/services/trackbacks/434887.html</trackback:ping><description><![CDATA[blogjava网站与博客园合并了，对blogjava还是有感情的。<br />并且blogjava网站发布的文章是在博客园首页看不到的。<br />blogjava网站首页能看到，你可以点击标题进入可以看到图片二维码信息。<br /><br /><strong style="color: red; font-size: 14pt;">Java爱好者社区</strong><br />公众号内容简介：<br /><p><span style="background-color: yellow; color: red;">专注于分享Java后端相关技术、老司机实战干货，不限于JVM、并发、设计模式、性能优化、分布式&amp;微服务、云原生、大数据相关主题。</span><br style="color: red;" /><span style="background-color: yellow; color: red;">希望关注的你停下脚步，定有所收获。</span><br style="color: red;" /><br />以前的个人博客内容不好迁移，所以我打算根据自己的多年经验，不断整理输出有价值的内容。<br />目前公众号内容有关于<span style="background-color: yellow; color: red;">SpringCloud（微服务框架）、Skywalking（APM监控调用链）、JVM（GC分析、内存泄漏分析）、并发编程</span>相关原创实战文章已出炉。<br /><br />最近刚开始已经有不少小伙伴关注了，期待能有幸搜索到本博客的同学，可以扫码关注一下，不胜感激。<br />大家有任何技术、职场、面试上的问题都可以与我交流。<br /><br /><span style="background-color: yellow;"><strong>方式一：</strong></span><span style="color: red; background-color: yellow;"><strong>扫码以下公众号二维码：</strong></span><br /><img src="http://www.blogjava.net/images/blogjava_net/ldwblog/Java%E7%88%B1%E5%A5%BD%E8%80%85%E7%A4%BE%E5%8C%BA%E4%BA%8C%E7%BB%B4%E7%A0%81.png" border="0" alt="" /><br /><br />方式二：<span style="color: red;">在微信上直接搜索：&nbsp;</span><span style="color: red; background-color: yellow;">javatech_cbo</span><br /><br />感谢各位小伙伴的支持，后续会在该公众号上输出大量的有价值的实战干货 ，期待与你一同进步与成长。<br /></p><img src ="http://www.blogjava.net/ldwblog/aggbug/434887.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ldwblog/" target="_blank">David1228</a> 2019-10-30 14:10 <a href="http://www.blogjava.net/ldwblog/archive/2019/10/30/434887.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>多服务器自动化部署脚本</title><link>http://www.blogjava.net/ldwblog/archive/2015/07/29/426487.html</link><dc:creator>David1228</dc:creator><author>David1228</author><pubDate>Wed, 29 Jul 2015 05:48:00 GMT</pubDate><guid>http://www.blogjava.net/ldwblog/archive/2015/07/29/426487.html</guid><wfw:comment>http://www.blogjava.net/ldwblog/comments/426487.html</wfw:comment><comments>http://www.blogjava.net/ldwblog/archive/2015/07/29/426487.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ldwblog/comments/commentRss/426487.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ldwblog/services/trackbacks/426487.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;<a href='http://www.blogjava.net/ldwblog/archive/2015/07/29/426487.html'>阅读全文</a><img src ="http://www.blogjava.net/ldwblog/aggbug/426487.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ldwblog/" target="_blank">David1228</a> 2015-07-29 13:48 <a href="http://www.blogjava.net/ldwblog/archive/2015/07/29/426487.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>OpenNebula中无法部署虚拟机原因</title><link>http://www.blogjava.net/ldwblog/archive/2013/06/24/400917.html</link><dc:creator>David1228</dc:creator><author>David1228</author><pubDate>Mon, 24 Jun 2013 10:01:00 GMT</pubDate><guid>http://www.blogjava.net/ldwblog/archive/2013/06/24/400917.html</guid><wfw:comment>http://www.blogjava.net/ldwblog/comments/400917.html</wfw:comment><comments>http://www.blogjava.net/ldwblog/archive/2013/06/24/400917.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ldwblog/comments/commentRss/400917.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ldwblog/services/trackbacks/400917.html</trackback:ping><description><![CDATA[OpenNebula中主机添加一切正常。<br />执行$onehost list 主机CPU、内存资源可以正常被监控到。但是，创建虚拟机后，虚拟机状态很长一段时间一直处于pend状态。而OpenNebula的mm_sched调度虚拟机的周期是缺省30秒调度一次，根据调度算法适配一台合适的主机，主机是新添加的而且是有足够资源的，为什么不能部署呢？<br />我们可以通过查看虚拟机的调度日志$ONE_LOCATION/var/sched.log发现如下错误信息：<br /><div>Tue Feb 21 [HOST][E]: Exception raised: Unable to transport XML to server and get XML response back. <br />&nbsp;HTTP response: 504 Tue Feb 22 14:27:39 2011 [POOL][E]: Could not retrieve pool info from ONE。<br />解决方法：<br />在OpenNebula官方的Wiki中可以找到原因，原因是所添加的主机使用了HTTP代理上网了，所以OpenNebula读取了系统的http_proxy环境变量，此时就需要关闭http_proxy。<br /><h4><a name="i_can_create_vms_but_schedlog_shows_the_error_could_not_retrieve_pool_info_from_one__what_s_wrong" id="i_can_create_vms_but_schedlog_shows_the_error_could_not_retrieve_pool_info_from_one__what_s_wrong" style="color: #0098c3; font-size: 1em;">I can create VMs, but sched.log shows the error "Could not retrieve pool info from ONE". What's wrong?</a></h4><div style="color: #353735; font-family: Arial, Verdana, Geneva, Helvetica, sans-serif; font-size: 13px; line-height: 18px; background-color: #f5f5f5;"><p style="padding: 0px;">If the scheduler does not deploy the pending VMs, and messages like these are found in sched.log</p><pre style="padding: 0.5em; border: 1px dashed #555555; color: #555555; margin: 10px; overflow: auto !important;">[HOST][E]: Exception raised: Unable to transport XML to server and get XML response back.  HTTP response code is 404, not 200 [POOL][E]: Could not retrieve pool info from ONE</pre><p style="padding: 0px;">Then you need to unset the&nbsp;<code>http_proxy</code>&nbsp;environment variable, or set the&nbsp;<code>no_proxy</code>&nbsp;accordingly.<br /></p></div>wiki参考地址(这里汇总了使用或部署one过程中可能遇到的问题以及解决办法)：<a href="http://wiki.opennebula.org/faq#listing_vms_takes_a_lot_of_time_why">http://wiki.opennebula.org/faq#listing_vms_takes_a_lot_of_time_why<br /><br /></a>大家对于Opennebula的安装部署感兴趣的话，可以参考vpsee的博客（<a href="http://www.vpsee.com/2011/02/install-opennebula-on-centos/">在Centos上安装和部署Opennebula</a>），讲解的很详细。<a href="http://wiki.opennebula.org/faq#listing_vms_takes_a_lot_of_time_why"><br /><br /></a>vpsee已经试玩了下<a href="http://www.vpsee.com/2013/05/install-opennebula-4-0-on-centos-6-4/">OpenNebula4.0</a>，由于项目原因，目前我们还在用OpenNebula3.8.1，后面也会测试升级到OpenNebula4.0看看新功能。<br />升级过程同样也参考下vpsee的<a href="http://www.vpsee.com/2013/05/upgrading-opennebula-3-to-opennebula-4-0/">OpenNebula3.x升级到OpenNebula4.0</a>，^^ 这么好的资源优先借鉴。<br /><a href="http://wiki.opennebula.org/faq#listing_vms_takes_a_lot_of_time_why"><br /></a></div><img src ="http://www.blogjava.net/ldwblog/aggbug/400917.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ldwblog/" target="_blank">David1228</a> 2013-06-24 18:01 <a href="http://www.blogjava.net/ldwblog/archive/2013/06/24/400917.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(原)KVM环境下虚拟机迁移失败问题解决</title><link>http://www.blogjava.net/ldwblog/archive/2013/03/08/396187.html</link><dc:creator>David1228</dc:creator><author>David1228</author><pubDate>Fri, 08 Mar 2013 04:03:00 GMT</pubDate><guid>http://www.blogjava.net/ldwblog/archive/2013/03/08/396187.html</guid><wfw:comment>http://www.blogjava.net/ldwblog/comments/396187.html</wfw:comment><comments>http://www.blogjava.net/ldwblog/archive/2013/03/08/396187.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ldwblog/comments/commentRss/396187.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ldwblog/services/trackbacks/396187.html</trackback:ping><description><![CDATA[<div>使用开源云工具OpenNebula3.8.1在KVM环境下虚拟机迁移失败问题解决。<br />1、虚拟机迁移失败1日志：</div><div>Fri Mar &nbsp;8 17:57:18 2013 [LCM][I]: New VM state is SAVE_MIGRATE</div><div>Fri Mar &nbsp;8 17:57:30 2013 [VMM][I]: ExitCode: 0</div><div>Fri Mar &nbsp;8 17:57:30 2013 [VMM][I]: Successfully execute virtualization driver operation: save.</div><div>Fri Mar &nbsp;8 17:57:30 2013 [VMM][I]: ExitCode: 0</div><div>Fri Mar &nbsp;8 17:57:30 2013 [VMM][I]: Successfully execute network driver operation: clean.</div><div>Fri Mar &nbsp;8 17:58:14 2013 [LCM][I]: New VM state is PROLOG_MIGRATE</div><div>Fri Mar &nbsp;8 17:58:14 2013 [TM][I]: mv: -------------------------/one_images_3.8.1/0/42/disk.0</div><div>Fri Mar &nbsp;8 17:58:14 2013 [TM][I]: ExitCode: 0</div><div>Fri Mar &nbsp;8 18:02:28 2013 [TM][I]: mv: Moving bcec162:/one_images_3.8.1/0/42 to node153:/one_images_3.8.1/0/42</div><div>Fri Mar &nbsp;8 18:02:28 2013 [TM][I]: ExitCode: 0</div><div>Fri Mar &nbsp;8 18:02:29 2013 [LCM][I]: New VM state is BOOT</div><div>Fri Mar &nbsp;8 18:02:30 2013 [VMM][I]: ExitCode: 0</div><div>Fri Mar &nbsp;8 18:02:30 2013 [VMM][I]: Successfully execute network driver operation: pre.</div><div>Fri Mar &nbsp;8 18:02:33 2013 [VMM][I]: Command execution fail: /var/tmp/one/vmm/kvm/restore /one_images_3.8.1/0/42/checkpoint node153 42 node153</div><div>Fri Mar &nbsp;8 18:02:33 2013 [VMM][E]: restore: Command "virsh --connect qemu:///system restore /one_images_3.8.1/0/42/checkpoint" failed: error: Failed to restore domain from /one_images_3.8.1/0/42/checkpoint</div><div>Fri Mar &nbsp;8 18:02:33 2013 [VMM][I]: error: unable to set user and group to '0:0' on '/one_images_3.8.1/0/42/disk.1': No such file or directory</div><div>Fri Mar &nbsp;8 18:02:33 2013 [VMM][E]: Could not restore from /one_images_3.8.1/0/42/checkpoint</div><div>Fri Mar &nbsp;8 18:02:33 2013 [VMM][I]: ExitCode: 1</div><div>Fri Mar &nbsp;8 18:02:33 2013 [VMM][I]: Failed to execute virtualization driver operation: restore.</div><div>Fri Mar &nbsp;8 18:02:33 2013 [VMM][E]: Error restoring VM: Could not restore from /one_images_3.8.1/0/42/checkpoint</div><div>Fri Mar &nbsp;8 18:02:34 2013 [DiM][I]: New VM state is FAILED</div><div>Sat Mar &nbsp;9 09:23:46 2013 [DiM][I]: New VM state is DONE.</div><div>Sat Mar &nbsp;9 09:23:46 2013 [TM][W]: Ignored: LOG I 42 ExitCode: 0</div><div></div><div>Sat Mar &nbsp;9 09:23:47 2013 [TM][W]: Ignored: LOG I 42 delete: Deleting /one_images_3.8.1/0/42</div><div></div><div>Sat Mar &nbsp;9 09:23:47 2013 [TM][W]: Ignored: LOG I 42 ExitCode: 0</div><div></div><div>Sat Mar &nbsp;9 09:23:47 2013 [TM][W]: Ignored: TRANSFER SUCCESS 42 -</div><div></div><div>解决方法：</div><div>在mv脚本中TAR拷贝命令前面增加$SUDO命令.</div><div></div><div>$ONE_LOCATION/var/remotes/tm/ssh/mv</div><div></div><div>#!/bin/bash</div><div></div><div># -------------------------------------------------------------------------- #</div><div># Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #</div><div># &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#</div><div># Licensed under the Apache License, Version 2.0 (the "License"); you may &nbsp; &nbsp;#</div><div># not use this file except in compliance with the License. You may obtain &nbsp; &nbsp;#</div><div># a copy of the License at &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #</div><div># &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#</div><div># http://www.apache.org/licenses/LICENSE-2.0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #</div><div># &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#</div><div># Unless required by applicable law or agreed to in writing, software &nbsp; &nbsp; &nbsp; &nbsp;#</div><div># distributed under the License is distributed on an "AS IS" BASIS, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#</div><div># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. &nbsp; #</div><div># See the License for the specific language governing permissions and &nbsp; &nbsp; &nbsp; &nbsp;#</div><div># limitations under the License. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #</div><div>#--------------------------------------------------------------------------- #</div><div></div><div># MV &lt;hostA:system_ds/disk.i|hostB:system_ds/disk.i&gt; vmid dsid</div><div># &nbsp; &nbsp;&lt;hostA:system_ds/|hostB:system_ds/&gt;</div><div># &nbsp; - hostX is the target host to deploy the VM</div><div># &nbsp; - system_ds is the path for the system datastore in the host</div><div># &nbsp; - vmid is the id of the VM</div><div># &nbsp; - dsid is the target datastore (0 is the system datastore)</div><div></div><div>SRC=$1</div><div>DST=$2</div><div></div><div>VMID=$3</div><div>DSID=$4</div><div></div><div>if [ -z "${ONE_LOCATION}" ]; then</div><div>&nbsp; &nbsp; TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh</div><div>else</div><div>&nbsp; &nbsp; TMCOMMON=$ONE_LOCATION/var/remotes/tm/tm_common.sh</div><div>fi</div><div></div><div>. $TMCOMMON</div><div></div><div>#-------------------------------------------------------------------------------</div><div># Return if moving a disk, we will move them when moving the whole system_ds</div><div># directory for the VM</div><div>#-------------------------------------------------------------------------------</div><div>SRC=`fix_dir_slashes $SRC`</div><div>DST=`fix_dir_slashes $DST`</div><div></div><div>SRC_PATH=`arg_path $SRC`</div><div>DST_PATH=`arg_path $DST`</div><div></div><div>SRC_HOST=`arg_host $SRC`</div><div>DST_HOST=`arg_host $DST`</div><div></div><div>DST_DIR=`dirname $DST_PATH`</div><div></div><div>SRC_DS_DIR=`dirname &nbsp;$SRC_PATH`</div><div>SRC_VM_DIR=`basename $SRC_PATH`</div><div></div><div>if [ `is_disk $DST_PATH` -eq 1 ]; then</div><div>&nbsp; &nbsp; log "-------------------------$DST_PATH"</div><div><span style="white-space:pre">	</span>exit 0</div><div>fi</div><div></div><div>if [ "$SRC" == "$DST" ]; then</div><div>&nbsp; &nbsp;<span style="white-space:pre">	</span>exit 0</div><div>fi</div><div></div><div>ssh_make_path "$DST_HOST" "$DST_DIR"</div><div></div><div>log "Moving $SRC to $DST"</div><div></div><div>ssh_exec_and_log "$DST_HOST" "rm -rf '$DST_PATH'" \</div><div>&nbsp; &nbsp; "Error removing target path to prevent overwrite errors"</div><div></div><div>TAR_COPY="$SSH $SRC_HOST '$SUDO $TAR -C $SRC_DS_DIR -cf - $SRC_VM_DIR'"</div><div>TAR_COPY="$TAR_COPY | $SSH $DST_HOST '$TAR -C $DST_DIR -xf -'"</div><div></div><div>exec_and_log "eval $TAR_COPY" "Error copying disk directory to target host"</div><div></div><div>exec_and_log "$SSH $SRC_HOST rm -rf $SRC_PATH"</div><div></div><div>exit 0</div><div>-------------------------------------------------------------------------------------------</div><div>2、虚拟机迁移失败2日志：</div><div>Sat Mar &nbsp;9 09:34:12 2013 [LCM][I]: New VM state is SAVE_MIGRATE</div><div>Sat Mar &nbsp;9 09:34:24 2013 [VMM][I]: ExitCode: 0</div><div>Sat Mar &nbsp;9 09:34:24 2013 [VMM][I]: Successfully execute virtualization driver operation: save.</div><div>Sat Mar &nbsp;9 09:34:24 2013 [VMM][I]: ExitCode: 0</div><div>Sat Mar &nbsp;9 09:34:24 2013 [VMM][I]: Successfully execute network driver operation: clean.</div><div>Sat Mar &nbsp;9 09:34:25 2013 [LCM][I]: New VM state is PROLOG_MIGRATE</div><div>Sat Mar &nbsp;9 09:34:25 2013 [TM][I]: mv: -------------------------/one_images_3.8.1/0/43/disk.0</div><div>Sat Mar &nbsp;9 09:34:25 2013 [TM][I]: ExitCode: 0</div><div>Sat Mar &nbsp;9 09:36:38 2013 [TM][I]: mv: Moving node153:/one_images_3.8.1/0/43 to bcec162:/one_images_3.8.1/0/43</div><div>Sat Mar &nbsp;9 09:36:38 2013 [TM][I]: mv: -------------------target copyy</div><div>Sat Mar &nbsp;9 09:36:38 2013 [TM][I]: mv: ++++++++++++++++++++++end copy</div><div>Sat Mar &nbsp;9 09:36:38 2013 [TM][I]: ExitCode: 0</div><div>Sat Mar &nbsp;9 09:36:38 2013 [LCM][I]: New VM state is BOOT</div><div>Sat Mar &nbsp;9 09:36:38 2013 [VMM][I]: ExitCode: 0</div><div>Sat Mar &nbsp;9 09:36:38 2013 [VMM][I]: Successfully execute network driver operation: pre.</div><div>Sat Mar &nbsp;9 09:36:42 2013 [VMM][I]: Command execution fail: /var/tmp/one/vmm/kvm/restore /one_images_3.8.1/0/43/checkpoint bcec162 43 bcec162</div><div>Sat Mar &nbsp;9 09:36:42 2013 [VMM][E]: restore: Command "virsh --connect qemu:///system restore /one_images_3.8.1/0/43/checkpoint" failed: error: Failed to restore domain from /one_images_3.8.1/0/43/checkpoint</div><div>Sat Mar &nbsp;9 09:36:42 2013 [VMM][I]: error: internal error process exited while connecting to monitor: Supported machines are:</div><div>Sat Mar &nbsp;9 09:36:42 2013 [VMM][I]: pc &nbsp; &nbsp; &nbsp; &nbsp; RHEL 6.0.0 PC (alias of rhel6.0.0)</div><div>Sat Mar &nbsp;9 09:36:42 2013 [VMM][I]: rhel6.0.0 &nbsp;RHEL 6.0.0 PC (default)</div><div>Sat Mar &nbsp;9 09:36:42 2013 [VMM][I]: rhel5.5.0 &nbsp;RHEL 5.5.0 PC</div><div>Sat Mar &nbsp;9 09:36:42 2013 [VMM][I]: rhel5.4.4 &nbsp;RHEL 5.4.4 PC</div><div>Sat Mar &nbsp;9 09:36:42 2013 [VMM][I]: rhel5.4.0 &nbsp;RHEL 5.4.0 PC</div><div>Sat Mar &nbsp;9 09:36:42 2013 [VMM][E]: Could not restore from /one_images_3.8.1/0/43/checkpoint</div><div>Sat Mar &nbsp;9 09:36:42 2013 [VMM][I]: ExitCode: 1</div><div>Sat Mar &nbsp;9 09:36:42 2013 [VMM][I]: Failed to execute virtualization driver operation: restore.</div><div>Sat Mar &nbsp;9 09:36:42 2013 [VMM][E]: Error restoring VM: Could not restore from /one_images_3.8.1/0/43/checkpoint</div><div>Sat Mar &nbsp;9 09:36:42 2013 [DiM][I]: New VM state is FAILED</div><div></div><div>登陆到节点：</div><div>[root@bcec162 43]# virsh restore checkpoint&nbsp;</div><div>错误：从 checkpoint 恢复域失败</div><div>错误：internal error process exited while connecting to monitor: Supported machines are:</div><div>pc &nbsp; &nbsp; &nbsp; &nbsp; RHEL 6.0.0 PC (alias of rhel6.0.0)</div><div>rhel6.0.0 &nbsp;RHEL 6.0.0 PC (default)</div><div>rhel5.5.0 &nbsp;RHEL 5.5.0 PC</div><div>rhel5.4.4 &nbsp;RHEL 5.4.4 PC</div><div>rhel5.4.0 &nbsp;RHEL 5.4.0 PC</div><div></div><div>修改了bcec162节点的/etc/libvirt/qemu.conf文件:</div><div># The user ID for QEMU processes run by the system instance</div><div>user = "root"</div><div></div><div># The group ID for QEMU processes run by the system instance</div><div>group = "root"</div><div></div><div># Whether libvirt should dynamically change file ownership</div><div># to match the configured user/group above. Defaults to 1.</div><div># Set to 0 to disable file ownership changes.</div><div>#dynamic_ownership = 0</div><div></div><div></div><div>bcec162节点迁移到node153节点成功。</div><div>[root@node153 43]# ll</div><div>total 5075464</div><div>-rw-r--r-- 1 root &nbsp; &nbsp; root &nbsp;287215779 Mar &nbsp;8 11:11 checkpoint</div><div>-rw-r--r-- 1 oneadmin kvm &nbsp; 283538737 Mar &nbsp;9 09:34 checkpoint.1362712278</div><div>-rw-r--r-- 1 oneadmin kvm &nbsp; &nbsp; &nbsp; &nbsp; 920 Mar &nbsp;9 09:26 deployment.0</div><div>-rw-r--r-- 1 root &nbsp; &nbsp; root 4621008896 Mar &nbsp;9 10:14 disk.0</div><div>-rw-r----- 1 root &nbsp; &nbsp; root &nbsp; &nbsp; 401408 Mar &nbsp;9 09:26 disk.1</div><div>lrwxrwxrwx 1 oneadmin kvm &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;29 Mar &nbsp;9 10:09 disk.1.iso -&gt; /one_images_3.8.1/0/43/disk.1</div><div></div><div>--------------------------------------------------------------------------------------------------------</div><div>3、仅修改node152节点的/etc/libvirt/qemu.conf文件：</div><div># The user ID for QEMU processes run by the system instance</div><div>#user = "root"</div><div></div><div># The group ID for QEMU processes run by the system instance</div><div>#group = "root"</div><div></div><div># Whether libvirt should dynamically change file ownership</div><div># to match the configured user/group above. Defaults to 1.</div><div># Set to 0 to disable file ownership changes.</div><div>dynamic_ownership = 0</div><div></div><div>从bcec162节点迁移到node152不成功，日志如下：</div><div>Sat Mar &nbsp;9 10:31:47 2013 [LCM][I]: New VM state is SAVE_MIGRATE</div><div>Sat Mar &nbsp;9 10:31:54 2013 [VMM][I]: save: Moving old checkpoint file /one_images_3.8.1/0/43/checkpoint</div><div>Sat Mar &nbsp;9 10:31:54 2013 [VMM][I]: ExitCode: 0</div><div>Sat Mar &nbsp;9 10:31:54 2013 [VMM][I]: Successfully execute virtualization driver operation: save.</div><div>Sat Mar &nbsp;9 10:31:54 2013 [VMM][I]: ExitCode: 0</div><div>Sat Mar &nbsp;9 10:31:54 2013 [VMM][I]: Successfully execute network driver operation: clean.</div><div>Sat Mar &nbsp;9 10:31:55 2013 [LCM][I]: New VM state is PROLOG_MIGRATE</div><div>Sat Mar &nbsp;9 10:31:55 2013 [TM][I]: mv: -------------------------/one_images_3.8.1/0/43/disk.0</div><div>Sat Mar &nbsp;9 10:31:55 2013 [TM][I]: ExitCode: 0</div><div>Sat Mar &nbsp;9 10:35:02 2013 [TM][I]: mv: Moving bcec162:/one_images_3.8.1/0/43 to node152:/one_images_3.8.1/0/43</div><div>Sat Mar &nbsp;9 10:35:02 2013 [TM][I]: mv: -------------------target copyy</div><div>Sat Mar &nbsp;9 10:35:02 2013 [TM][I]: mv: ++++++++++++++++++++++end copy</div><div>Sat Mar &nbsp;9 10:35:02 2013 [TM][I]: ExitCode: 0</div><div>Sat Mar &nbsp;9 10:35:02 2013 [LCM][I]: New VM state is BOOT</div><div>Sat Mar &nbsp;9 10:35:03 2013 [VMM][I]: ExitCode: 0</div><div>Sat Mar &nbsp;9 10:35:03 2013 [VMM][I]: Successfully execute network driver operation: pre.</div><div>Sat Mar &nbsp;9 10:35:07 2013 [VMM][I]: Command execution fail: /var/tmp/one/vmm/kvm/restore /one_images_3.8.1/0/43/checkpoint node152 43 node152</div><div>Sat Mar &nbsp;9 10:35:07 2013 [VMM][E]: restore: Command "virsh --connect qemu:///system restore /one_images_3.8.1/0/43/checkpoint" failed: error: Failed to restore domain from /one_images_3.8.1/0/43/checkpoint</div><div>Sat Mar &nbsp;9 10:35:07 2013 [VMM][I]: error: operation failed: failed to retrieve chardev info in qemu with 'info chardev'</div><div>Sat Mar &nbsp;9 10:35:07 2013 [VMM][E]: Could not restore from /one_images_3.8.1/0/43/checkpoint</div><div>Sat Mar &nbsp;9 10:35:07 2013 [VMM][I]: ExitCode: 1</div><div>Sat Mar &nbsp;9 10:35:07 2013 [VMM][I]: Failed to execute virtualization driver operation: restore.</div><div>Sat Mar &nbsp;9 10:35:07 2013 [VMM][E]: Error restoring VM: Could not restore from /one_images_3.8.1/0/43/checkpoint</div><div>Sat Mar &nbsp;9 10:35:07 2013 [DiM][I]: New VM state is FAILED</div><div></div><div>登陆到node152节点执行restore命令：</div><div>[root@node152 43]# virsh restore checkpoint</div><div>error: Failed to restore domain from checkpoint</div><div>error: internal error process exited while connecting to monitor: qemu: could not open disk image /one_images_3.8.1/0/43/disk.0: Permission denied</div><div></div><div>将/etc/libvirt/qemu.conf文件中注释掉dynamic_ownership=0，开启user=root和group=root.&nbsp;</div><div>如果开启dynamic_ownership则恢复虚拟机也会报出上面的错误信息。</div><div>在node152节点上恢复虚拟机：</div><div>[root@node152 43]# virsh restore checkpoint</div><div>Domain restored from checkpoint</div><div></div><div>[root@node152 43]# virsh list</div><div>&nbsp;Id Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; State</div><div>----------------------------------</div><div>117 one-43 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; running</div><div></div><div></div><div>参考文章：</div><div>https://wiki.archlinux.org/index.php/QEMU_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)</div><div>http://hi.baidu.com/juacm/item/f1fc3f98d8428ad07a7f01e2</div><div><br />转载请保持原链接：http://www.blogjava.net/ldwblog/archive/2013/03/08/396187.html</div><img src ="http://www.blogjava.net/ldwblog/aggbug/396187.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ldwblog/" target="_blank">David1228</a> 2013-03-08 12:03 <a href="http://www.blogjava.net/ldwblog/archive/2013/03/08/396187.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用httpd时候碰到8443端口占用问题解决</title><link>http://www.blogjava.net/ldwblog/archive/2013/01/18/394389.html</link><dc:creator>David1228</dc:creator><author>David1228</author><pubDate>Fri, 18 Jan 2013 03:22:00 GMT</pubDate><guid>http://www.blogjava.net/ldwblog/archive/2013/01/18/394389.html</guid><wfw:comment>http://www.blogjava.net/ldwblog/comments/394389.html</wfw:comment><comments>http://www.blogjava.net/ldwblog/archive/2013/01/18/394389.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ldwblog/comments/commentRss/394389.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ldwblog/services/trackbacks/394389.html</trackback:ping><description><![CDATA[<div style="font-family: 微软雅黑; font-size: 16px; line-height: normal; text-align: -webkit-auto; text-indent: 2em; ">使用httpd时候碰到一个问题，共享一下。</div><div style="font-family: 微软雅黑; font-size: 16px; line-height: normal; text-align: -webkit-auto; text-indent: 2em; ">BC-EC配置tomcat的时候占用8443端口，如果tomcat服务器又作为http服务器，启动httpd服务的时候就报错，8443端口被占用。反过来httpd占用8443，tomcat启动就报错。</div><div style="font-family: 微软雅黑; font-size: 16px; line-height: normal; text-align: -webkit-auto; text-indent: 2em; ">解决办法：</div><div style="font-family: 微软雅黑; font-size: 16px; line-height: normal; text-align: -webkit-auto; text-indent: 4em; ">编辑 /etc/httpd/conf.d/nss.conf配置文件，将该文件中的</div><div style="font-family: 微软雅黑; font-size: 16px; line-height: normal; text-align: -webkit-auto; text-indent: 4em; "><div>nss.conf:Listen&nbsp;8443</div><div>nss.conf:&lt;VirtualHost&nbsp;_default_:8443&gt;</div><div>改成</div><div><div>nss.conf:Listen 8444</div><div>nss.conf:&lt;VirtualHost _default_:8444&gt;</div><div>&nbsp;</div></div></div><div style="font-family: 微软雅黑; font-size: 16px; line-height: normal; text-align: -webkit-auto; text-indent: 2em; ">这样启动httpd和tomcat就互不影响了。</div><img src ="http://www.blogjava.net/ldwblog/aggbug/394389.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ldwblog/" target="_blank">David1228</a> 2013-01-18 11:22 <a href="http://www.blogjava.net/ldwblog/archive/2013/01/18/394389.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>不启动虚机的情况下，修改虚机磁盘文件的方法</title><link>http://www.blogjava.net/ldwblog/archive/2013/01/18/394388.html</link><dc:creator>David1228</dc:creator><author>David1228</author><pubDate>Fri, 18 Jan 2013 03:21:00 GMT</pubDate><guid>http://www.blogjava.net/ldwblog/archive/2013/01/18/394388.html</guid><wfw:comment>http://www.blogjava.net/ldwblog/comments/394388.html</wfw:comment><comments>http://www.blogjava.net/ldwblog/archive/2013/01/18/394388.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ldwblog/comments/commentRss/394388.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ldwblog/services/trackbacks/394388.html</trackback:ping><description><![CDATA[<div style="font-family: 微软雅黑; font-size: 16px; line-height: normal; text-align: -webkit-auto; ">--------------------------- 下面是在不启动虚机的情况下，修改虚机磁盘文件的方法（增加一种调试的手段） ---------------------------------</div><div style="font-family: 微软雅黑; font-size: 16px; line-height: normal; text-align: -webkit-auto; ">-- 首先关闭虚机</div><div style="font-family: 微软雅黑; font-size: 16px; line-height: normal; text-align: -webkit-auto; "># losetup /dev/loop100 /one_images/5/images/disk.0</div><div style="font-family: 微软雅黑; font-size: 16px; line-height: normal; text-align: -webkit-auto; "># kpartx -a /dev/loop100</div><div style="font-family: 微软雅黑; font-size: 16px; line-height: normal; text-align: -webkit-auto; ">-- 通过以上两个命令后，可以在/dev/mapper/目录下看到虚机的两个分区设备 loop100p1、loop100p2 （一般loop100p1是根分区）（loop设备找一个空闲的即可，我这里写的是loop100）</div><div style="font-family: 微软雅黑; font-size: 16px; line-height: normal; text-align: -webkit-auto; "># mount /dev/mapper/loop100p1 /mnt</div><div style="font-family: 微软雅黑; font-size: 16px; line-height: normal; text-align: -webkit-auto; ">-- 将虚机根分区挂载到/mnt目录，这时虚机的文件系统结构就都在/mnt目录下了（可以进行读写操作）</div><div style="font-family: 微软雅黑; font-size: 16px; line-height: normal; text-align: -webkit-auto; "># umount /mnt</div><div style="font-family: 微软雅黑; font-size: 16px; line-height: normal; text-align: -webkit-auto; "># kpartx&nbsp;-d&nbsp;/dev/loop100</div><div style="font-family: 微软雅黑; font-size: 16px; line-height: normal; text-align: -webkit-auto; "># losetup&nbsp;-d&nbsp;/dev/loop100</div><div style="font-family: 微软雅黑; font-size: 16px; line-height: normal; text-align: -webkit-auto; ">-- 通过以上三个命令卸载，重新启动虚机，修改都生效了。（测试虚机系统centos-5.5-x86_64）</div><img src ="http://www.blogjava.net/ldwblog/aggbug/394388.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ldwblog/" target="_blank">David1228</a> 2013-01-18 11:21 <a href="http://www.blogjava.net/ldwblog/archive/2013/01/18/394388.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(转)安装 log.io 实时日志监控工具</title><link>http://www.blogjava.net/ldwblog/archive/2012/11/06/390886.html</link><dc:creator>David1228</dc:creator><author>David1228</author><pubDate>Tue, 06 Nov 2012 07:49:00 GMT</pubDate><guid>http://www.blogjava.net/ldwblog/archive/2012/11/06/390886.html</guid><wfw:comment>http://www.blogjava.net/ldwblog/comments/390886.html</wfw:comment><comments>http://www.blogjava.net/ldwblog/archive/2012/11/06/390886.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ldwblog/comments/commentRss/390886.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ldwblog/services/trackbacks/390886.html</trackback:ping><description><![CDATA[<strong>个人说明：</strong>以下作者应该是在Ubuntu OS上做的测试。 感谢作者vpsee。<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;本人在公司的Red Hat Enterprise Linux Server release 6.1 (Santiago) 服务器上做的测试，可参见最下面截图，监控Tomcat和其他日志信息。很是方便哈^^.<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;由于Redhat OS上没有apt-get，如果缺少相应软件包，可以通过yum或者iso源方式安装缺少的软件。<br /><br /><br />转自：<a href="http://www.vpsee.com/2012/11/install-real-time-log-monitoring-tool-log-io/#comments">http://www.vpsee.com/2012/11/install-real-time-log-monitoring-tool-log-io/#comments</a>&nbsp;<br /><span style="line-height: 17.2pt; font-size: 11pt; font-family: 宋体; ">日志是个好东西，对技术人员来说写日志能纪录成长，分享经验；对机器来说纪录日志能及时发现错误，为日后的排错提供信息。如果还在一台机器上用</span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 'Lucida Sans Unicode', sans-serif; color: #333333; "> tail -f </span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 宋体; ">监听单个日志或者</span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 'Lucida Sans Unicode', sans-serif; color: #333333; "><a href="http://www.vpsee.com/2012/09/use-multitail-to-track-openstack-logs/"><span style="font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;color:#336699">用</span><span style="color:#336699"> multitail </span><span style="font-family: 宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#336699">监听多个日志</span></a></span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 宋体; ">也太</span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 'Lucida Sans Unicode', sans-serif; color: #333333; "> out </span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 宋体; ">了，我们需要一种工具能纪录上百台机器、不同类型的日志，并最好能汇集到一个界面里方便查看，最好还是实时的。</span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 'Lucida Sans Unicode', sans-serif; color: #333333; "><a href="http://logio.org/"><span style="color:#336699">log.io</span></a>&nbsp;</span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 宋体; ">就是这样一个实时日志监控工具，采用</span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 'Lucida Sans Unicode', sans-serif; color: #333333; "> node.js + socket.io </span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 宋体; ">开发，使用浏览器访问，每秒可以处理超过</span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 'Lucida Sans Unicode', sans-serif; color: #333333; ">5000</span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 宋体; ">条日志变动消息。有一点要指出来的是</span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 'Lucida Sans Unicode', sans-serif; color: #333333; "> log.io </span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 宋体; ">只监视日志变动并不存储日志，不过这个没关系，我们知道日志存储在哪个机器上。</span><br /><fieldset>  <p align="left" style="margin-bottom: 21.6pt; line-height: 17.2pt; background-color: white; background-position: initial initial; background-repeat: initial initial; "><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">和其他的监控工具一样，</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;">log.io </span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">也采用服务器－客户端的模式。</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;">log.io </span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">由两部分组成：</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;">server </span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">和</span><span style="font-size: 11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> harvester, server </span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">运行在机器</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> A</span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">（服务器）上监视和纪录其他机器发来的日志消息；</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;">log harvester </span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">运行在机器</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> B</span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">（客户端）上用来监听和收集机器</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> B </span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">上的日志改动，并将改动发送给机器</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> A</span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">，每个需要纪录日志的机器都需要一个</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> harvester.</span></p>  <p align="left" style="background-color: white; background-position: initial initial; background-repeat: initial initial; "><strong><span style="font-size:18.0pt; font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;color:#333333;">在机器</span></strong><strong><span style="font-size:18.0pt; font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;; color:#333333;"> A </span></strong><strong><span style="font-size: 18.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;color:#333333;">和</span></strong><strong><span style="font-size:18.0pt; font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;; color:#333333;"> B </span></strong><strong><span style="font-size: 18.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;color:#333333;">上</span></strong></p>  <p align="left" style="margin-bottom: 21.6pt; line-height: 17.2pt; background-color: white; background-position: initial initial; background-repeat: initial initial; "><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">因为</span><span style="font-size: 11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> log.io </span><span style="font-size: 11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;color:#333333;">基于</span><span style="font-size:11.0pt; font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;; color:#333333;"> node.js</span><span style="font-size:11.0pt; font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;color:#333333;">，所以在服务器和客户端都要安装</span><span style="font-size: 11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> node.js</span><span style="font-size: 11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;color:#333333;">，这里采用编译安装的办法，首先安装需要的依赖包：</span></p>  <div style="border:solid #C9D1D7 1.0pt;padding:7.0pt 7.0pt 7.0pt 7.0pt;background:#F1F5F9">  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">$ sudo apt-get install g++ make git libssl-dev pkg-config</span></p>  </div>  <p align="left" style="margin-bottom: 21.6pt; line-height: 17.2pt; background-color: white; background-position: initial initial; background-repeat: initial initial; "><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">下载</span><span style="font-size: 11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> node.js </span><span style="font-size: 11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;color:#333333;">源代码，编译并安装：</span></p>  <div style="border:solid #C9D1D7 1.0pt;padding:7.0pt 7.0pt 7.0pt 7.0pt;background:#F1F5F9">  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">$ wget http://nodejs.org/dist/v0.8.14/node-v0.8.14.tar.gz</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">$ tar zxvf node-v0.8.14.tar.gz</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">$ cd node-v0.8.14/</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">$ ./configure</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">$ make</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">$ sudo make install</span></p>  </div>  <p align="left" style="margin-bottom: 21.6pt; line-height: 17.2pt; background-color: white; background-position: initial initial; background-repeat: initial initial; "><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">安装</span><span style="font-size: 11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> NPM</span><span style="font-size:11.0pt; font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;color:#333333;">：</span></p>  <div style="border:solid #C9D1D7 1.0pt;padding:7.0pt 7.0pt 7.0pt 7.0pt;background:#F1F5F9">  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">$ curl https://npmjs.org/install.sh | sudo sh </span></p>  </div>  <p align="left" style="margin-bottom: 21.6pt; line-height: 17.2pt; background-color: white; background-position: initial initial; background-repeat: initial initial; "><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">安装</span><span style="font-size: 11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> log.io</span><span style="font-size: 11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;color:#333333;">（包含了</span><span style="font-size:11.0pt; font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;; color:#333333;"> log server </span><span style="font-size: 11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;color:#333333;">和</span><span style="font-size:11.0pt; font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;; color:#333333;"> log harvester</span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">）</span></p>  <div style="border:solid #C9D1D7 1.0pt;padding:7.0pt 7.0pt 7.0pt 7.0pt;background:#F1F5F9">  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">$ sudo npm config set unsafe</span><span style="color: #333333; font-family: 宋体; font-size: 11pt; ">-perm true</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">$ sudo npm install -g --prefix=/usr/local log.io</span></p>  </div>  <p align="left" style="background-color: white; background-position: initial initial; background-repeat: initial initial; "><strong><span style="font-size:18.0pt; font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;color:#333333;">在机器</span></strong><strong><span style="font-size:18.0pt; font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;; color:#333333;"> A </span></strong><strong><span style="font-size: 18.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;color:#333333;">上启动</span></strong><strong><span style="font-size:18.0pt; font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;; color:#333333;"> server</span></strong></p>  <div style="border:solid #C9D1D7 1.0pt;padding:7.0pt 7.0pt 7.0pt 7.0pt;background:#F1F5F9">  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">$ sudo log.io server start</span></p>  </div>  <p align="left" style="background-color: white; "><strong><span style="font-size:18.0pt; font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;color:#333333;">在机器</span></strong><strong><span style="font-size:18.0pt; font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;; color:#333333;"> B </span></strong><strong><span style="font-size: 18.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;color:#333333;">上配置和启动</span></strong><strong><span style="font-size: 18.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> harvester</span></strong></p>  <p align="left" style="margin-bottom: 21.6pt; line-height: 17.2pt; background-color: white; "><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;">server </span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">用来监听各个机器发来的日志消息，</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;">harvester </span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">用来把本机的日志发给</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> server</span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">，所以</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> harvester </span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">配置的时候需要指定</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> server </span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">的主机地址（或域名）。如何告诉</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> harvester </span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">哪些日志需要监控呢？</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;">log_file_paths </span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">就是指定日志路径的地方。下面的配置是</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> h</span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 'Lucida Sans Unicode', sans-serif; color: #333333; ">arvester </span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 宋体; ">把</span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 'Lucida Sans Unicode', sans-serif; color: #333333; "> auth.log </span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 宋体; ">和</span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 'Lucida Sans Unicode', sans-serif; color: #333333; "> harvester.log </span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 宋体; ">这两个日志的改动</span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 宋体; ">发送给</span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 'Lucida Sans Unicode', sans-serif; color: #333333; "> server</span><span style="line-height: 17.2pt; font-size: 11pt; font-family: 宋体; ">：</span></p>  <div style="border:solid #C9D1D7 1.0pt;padding:7.0pt 7.0pt 7.0pt 7.0pt;background:#F1F5F9">  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">$ sudo vi /etc/log.io/harvester.conf</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">exports.config = {</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">&nbsp; // Log server host &amp; port</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">&nbsp; server: {</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">&nbsp;&nbsp;&nbsp; host: 'log.vpsee.com', // </span><span style="font-size:11.0pt;font-family:宋体;color:#333333;">也可以用 IP 地址</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">&nbsp;&nbsp;&nbsp; port: 8998,</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">&nbsp; },</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; ">&nbsp;</p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">&nbsp; // Watch the following log files, defined by label:path mappings</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">&nbsp; log_file_paths: {</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">&nbsp;&nbsp;&nbsp; logio_auth: '/var/log/auth.log',</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">&nbsp;&nbsp;&nbsp; logio_harvester: '/var/log/log.io/harvester.log',</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">&nbsp; },</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; ">&nbsp;</p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">&nbsp; instance_name : 'log_node_1'</span></p>  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">}</span></p>  </div>  <p align="left" style="margin-bottom: 21.6pt; line-height: 17.2pt; background-color: white; background-position: initial initial; background-repeat: initial initial; "><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">启动</span><span style="font-size: 11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> harvester</span><span style="font-size: 11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;color:#333333;">：</span></p>  <div style="border:solid #C9D1D7 1.0pt;padding:7.0pt 7.0pt 7.0pt 7.0pt;background:#F1F5F9">  <p align="left" style="border: none; padding: 0cm; background-position: initial initial; background-repeat: initial initial; "><span style="font-size: 11.0pt;font-family:宋体;color:#333333;">$ sudo log.io harvester start</span></p>  </div>  <p align="left" style="background-color: white; background-position: initial initial; background-repeat: initial initial; "><strong><span style="font-size:18.0pt; font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;color:#333333;">测试</span></strong><strong></strong></p>  <p align="left" style="margin-bottom: 21.6pt; line-height: 17.2pt; background-color: white; background-position: initial initial; background-repeat: initial initial; "><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">打开浏览器访问</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> log server </span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">所在的机器</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> A</span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">，域名是</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> log.vpsee.com</span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">（也可以用</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> IP </span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">地址），端口是</span><span style="font-size:11.0pt;font-family:&quot;Lucida Sans Unicode&quot;,&quot;sans-serif&quot;;color:#333333;"> 8998</span><span style="font-size:11.0pt;font-family:宋体;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;;Lucida Sans Unicode&quot;; color:#333333;">：<br />======================================================================================<br /></span>本人测试时harvester.conf文件配置如下：</p><p><div>/* Log.io log harvester configuration */</div><div></div><div>exports.config = {</div><div></div><div>&nbsp; // Log server host &amp; port</div><div>&nbsp; server: {</div><div>&nbsp; &nbsp; host: '192.168.32.92',</div><div>&nbsp; &nbsp; port: 8998,</div><div>&nbsp; },</div><div></div><div>&nbsp; // Watch the following log files, defined by label:path mappings</div><div>&nbsp; log_file_paths: {</div><div>&nbsp; &nbsp; <span style="white-space:pre">	</span>logio_tomcat: '/usr/local/tomcat6/logs/catalina.out',</div><div><span style="white-space:pre">	</span>logio_oned: '/opt/nebula/ONE/var/oned.log', &nbsp; &nbsp;</div><div><span style="white-space:pre">	</span>logio_harvester: '/var/log/log.io/harvester.log',</div><div>&nbsp; },</div><div></div><div>&nbsp; // Define name of current machine.</div><div>&nbsp; // Alternatively, you can set this name in /etc/profile:</div><div>&nbsp; // export LOGIO_HARVESTER_INSTANCE_NAME='my_log_machine'</div><div>&nbsp; // If so, comment out the line below</div><div>&nbsp; instance_name : 'log_node_1'</div><div></div><div>}</div><img src="http://www.blogjava.net/images/blogjava_net/ldwblog/11.png" border="0" alt="" width="1430" height="776" style="background-color: #f1f5f9; line-height: 22.933334350585938px; " /></p><legend></legend></fieldset><img src ="http://www.blogjava.net/ldwblog/aggbug/390886.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ldwblog/" target="_blank">David1228</a> 2012-11-06 15:49 <a href="http://www.blogjava.net/ldwblog/archive/2012/11/06/390886.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>转：qcow2、raw、vmdk等镜像格式</title><link>http://www.blogjava.net/ldwblog/archive/2012/10/11/389401.html</link><dc:creator>David1228</dc:creator><author>David1228</author><pubDate>Thu, 11 Oct 2012 07:43:00 GMT</pubDate><guid>http://www.blogjava.net/ldwblog/archive/2012/10/11/389401.html</guid><wfw:comment>http://www.blogjava.net/ldwblog/comments/389401.html</wfw:comment><comments>http://www.blogjava.net/ldwblog/archive/2012/10/11/389401.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ldwblog/comments/commentRss/389401.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ldwblog/services/trackbacks/389401.html</trackback:ping><description><![CDATA[<p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; ">云计算用一个朋友的话来说:&#8221;<em>做云计算最苦逼的就是得时时刻刻为一些可能一辈子都碰不到的事做好准备。更苦逼的就是刚以为一个问题不会遇到，立刻就发生了。。。</em>&#8220;。这个还真的没有办法，谁让哥我是搞云计算的呢，简单一个虚拟化就搞的你蛋疼，你还能想其它的吗？一直纠结在做虚拟化使用什么镜像格式，刚刚开始用了raw的file，后来发现LVM的很多特性对于虚拟化还是有比较理想的能力，而且性能也很不错就用了LVM。后来被VMware骗了跑去搞Esxi接触了VMDK，最近研究openstack发现了qcow2格式，貌似现在很流行呀。也说不上分析这些镜像格式的能力，就简单说说自己的一些使用心得。</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; ">目前主要有那些格式来作为虚拟机的镜像：<br /><strong>raw</strong><br />(default) the raw format is a plain binary image of the disc image, and is very portable. On filesystems that support sparse files, images in this format only use the space actually used by the data recorded in them.<br />老牌的格式了，用一个字来说就是裸，也就是赤裸裸，你随便dd一个file就模拟了一个raw格式的镜像。由于裸的彻底，性能上来说的话还是不错的。目前来看，KVM和XEN默认的格式好像还是这个格式。因为其原始，有很多原生的特性，例如直接挂载也是一件简单的事情。<br />裸的好处还有就是简单，支持转换成其它格式的虚拟机镜像对裸露的它来说还是很简单的（如果其它格式需要转换，有时候还是需要它做为中间格式），空间使用来看，这个很像磁盘，使用多少就是多少（<span style="color: #ff0000; ">du -h看到的大小就是使用大小</span>），但如果你要把整块磁盘都拿走的话得全盘拿了（copy镜像的时候），会比较消耗网络带宽和I/O。接下来还有个有趣的问题，如果那天你的硬盘用着用着不够用了，你咋办，在买一块盘。但raw格式的就比较犀利了，可以在原来的盘上追加空间：<br />dd if=/dev/zero of=zeros.raw bs=1024k count=4096（先创建4G的空间）<br />cat foresight.img zeros.raw &gt; new-foresight.img（追加到原有的镜像之后）<br />当然，好东西是吹出来的，谁用谁知道，还是有挺多问题的。由于原生的裸格式，不支持snapshot也是很正常的。传说有朋友用版本管理软件对raw格式的文件做版本管理从而达到snapshot的能力，估计可行，但没试过，这里也不妄加评论。但如果你使用LVM的裸设备，那就另当别论。说到LVM还是十分的犀利的，当年用LVM做虚拟机的镜像，那性能杠杠的。而且现在好多兄弟用虚拟化都采用LVM来做的。在LVM上做了很多的优化，国外听说也有朋友在LVM增量备份方面做了很多的工作。目前来LVM的snapshot、性能、可扩展性方面都还是有相当的效果的。目前来看的话，备份的话也问题不大。就是在虚拟机迁移方面还是有很大的限制。但目前虚拟化的现状来看，真正需要热迁移的情况目前需求还不是是否的强烈。虽然使用LVM做虚拟机镜像的相关公开资料比较少，但目前来看牺牲一点灵活性，换取性能和便于管理还是不错的选择。</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; ">对于LVM相关的特性及使用可以参考如下链接：</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; "><a href="http://www.ibm.com/developerworks/linux/library/l-lvm2/index.html" style="color: #133257; ">http://www.ibm.com/developerworks/linux/library/l-lvm2/index.html</a></p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; "><strong>cow</strong><br />copy-on-write format, supported for historical reasons only and not available to QEMU on Windows<br />曾经qemu的写时拷贝的镜像格式，目前由于历史遗留原因不支持窗口模式。从某种意义上来说是个弃婴，还没得它成熟就死在腹中，后来被qcow格式所取代。</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; "><strong>qcow</strong><br />the old QEMU copy-on-write format, supported for historical reasons and superseded by qcow2</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; ">一代的qemu的cow格式，刚刚出现的时候有比较好的特性，但其性能和raw格式对比还是有很大的差距，目前已经被新版本的qcow2取代。其性能可以查看如下链接：<br /><a href="http://www.linux-kvm.org/page/Qcow2" style="color: #133257; ">http://www.linux-kvm.org/page/Qcow2</a></p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; "><strong>qcow2</strong><br />QEMU copy-on-write format with a range of special features, including the ability to take multiple snapshots, smaller images on filesystems that don&#8217;t support sparse files, optional AES encryption, and optional zlib compression<br />现在比较主流的一种虚拟化镜像格式，经过一代的优化，目前qcow2的性能上接近raw裸格式的性能，这个也算是redhat的官方渠道了，哈哈，希望有朋友能拍他们砖：</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; ">https://fedoraproject.org/wiki/Features/KVM_qcow2_Performance</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; ">对于qcow2的格式，几点还是比较突出的，qcow2的snapshot，可以在镜像上做N多个快照：</p><ul style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; "><li>更小的存储空间，即使是不支持<em>holes</em>的文件系统也可以<span style="color: #ff0000; ">（这下du -h和ls -lh看到的就一样了）</span></li><li>Copy-on-write support, where the image only represents changes made to an underlying disk image（这个特性SUN ZFS表现的淋漓尽致）</li><li>支持多个snapshot，对历史snapshot进行管理</li><li>支持zlib的磁盘压缩</li><li>支持AES的加密</li></ul><p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; "><strong>vmdk&nbsp;</strong><br /><a href="http://en.wikipedia.org/wiki/VMware" style="color: #133257; ">VMware</a>&nbsp;3 &amp; 4, or 6 image format, for exchanging images with that product<br />VMware的格式，这个格式说的蛋疼一点就有点牛X，原本VMware就是做虚拟化起家，自己做了一个集群的VMDK的pool，做了自己的虚拟机镜像格式。又拉着一些公司搞了一个OVF的统一封包。从性能和功能上来说，vmdk应该算最出色的，由于vmdk结合了VMware的很多能力，目前来看，KVM和XEN使用这种格式的情况不是太多。但就VMware的Esxi来看，它的稳定性和各方面的能力还是可圈可点。</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; "><strong>vdi</strong><br /><a href="http://en.wikipedia.org/wiki/VirtualBox" style="color: #133257; ">VirtualBox</a>&nbsp;1.1 compatible image format, for exchanging images with VirtualBox.<br />SUN收购了VirtualBox，Oracle又收购了SUN，这么说呢，vdi也算虚拟化这方面的一朵奇葩，可惜的是入主的两家公司。SUN太专注于技术（可以说是IT技术最前端也不为过），Oracle又是开源杀手（<span style="color: #ff0000; "><strong>mysql的没落</strong></span>）。单纯从能力上来说vdi在VirtualBox上的表现还是不错的。也是不错的workstation级别的产品。</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; ">说了这么多虚拟机镜像格式，这么多虚拟化，做云计算的伤不起呀，得为长期发展考虑，也有朋友对镜像的转换做了很多事情，简单看看几种镜像的转化：</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; ">VMDK&#8211;&gt;qcow2:</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; ">kevin@kevin:~# qemu-img convert -f vmdk -O qcow2 SLES11SP1-single.vmdk SLES11SP1-single.img</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; "><a href="http://www.ibm.com/developerworks/cn/linux/l-cn-mgrtvm3/index.html" style="color: #133257; ">http://www.ibm.com/developerworks/cn/linux/l-cn-mgrtvm3/index.html</a></p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; ">qcow2&#8211;&gt;raw:</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; ">kevin@kevin:~$ qemu-img convert -O qcow2 image-raw.raw image-raw-converted.qcow</p>转载自：<a href="http://www.prajnagarden.com/?p=248">http://www.prajnagarden.com/?p=248</a>&nbsp;<img src ="http://www.blogjava.net/ldwblog/aggbug/389401.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ldwblog/" target="_blank">David1228</a> 2012-10-11 15:43 <a href="http://www.blogjava.net/ldwblog/archive/2012/10/11/389401.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>KVM通过virt-manager远程管理guest时键盘错乱解决方法</title><link>http://www.blogjava.net/ldwblog/archive/2012/08/06/384899.html</link><dc:creator>David1228</dc:creator><author>David1228</author><pubDate>Mon, 06 Aug 2012 04:10:00 GMT</pubDate><guid>http://www.blogjava.net/ldwblog/archive/2012/08/06/384899.html</guid><wfw:comment>http://www.blogjava.net/ldwblog/comments/384899.html</wfw:comment><comments>http://www.blogjava.net/ldwblog/archive/2012/08/06/384899.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ldwblog/comments/commentRss/384899.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ldwblog/services/trackbacks/384899.html</trackback:ping><description><![CDATA[<p style="padding: 0px 0px 15px; margin: 0px; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; "><strong style="padding: 0px; margin: 0px; ">一、命令行方式</strong></p><p style="padding: 0px 0px 15px; margin: 0px; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">关闭要调整的虚拟机，编辑虚拟机配置文件</p><p style="padding: 0px 0px 15px; margin: 0px; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; "><span style="padding: 0px; margin: 0px; color: #0000ff; ">#virsh edit 'your vm name'</span></p><p style="padding: 0px 0px 15px; margin: 0px; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">找到配置文件中的以下字段：</p><p style="padding: 0px 0px 15px; margin: 0px; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; "><span style="padding: 0px; margin: 0px; color: #00ccff; ">&lt;graphics type='vnc' port='-1'/&gt;</span></p><p style="padding: 0px 0px 15px; margin: 0px; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">加入键盘的语言布局后如下：</p><p style="padding: 0px 0px 15px; margin: 0px; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; "><span style="padding: 0px; margin: 0px; color: #00ccff; ">&lt;graphics type='vnc' port='-1' keymap='en-us'/&gt;</span></p><p style="padding: 0px 0px 15px; margin: 0px; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">保存退出后，重新载入虚拟机配置文件</p><p style="padding: 0px 0px 15px; margin: 0px; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; "><span style="padding: 0px; margin: 0px; color: #0000ff; ">#virsh create /etc/libvirt/qemu/'your vm name'.xml</span></p><p style="padding: 0px 0px 15px; margin: 0px; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">如果要避免这种情况，在使用virt-install安装的时候，就加入键盘布局的字段</p><p style="padding: 0px 0px 15px; margin: 0px; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">--keymap=en-us&nbsp;</p><p style="padding: 0px 0px 15px; margin: 0px; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; "><strong style="padding: 0px; margin: 0px; ">二、virt-manager方式</strong></p><p style="padding: 0px 0px 15px; margin: 0px; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">在虚拟关闭的状态下，通过virt-manager界面选中相应的虚拟机:</p><p style="padding: 0px 0px 15px; margin: 0px; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; "><u style="padding: 0px; margin: 0px; ">open--&gt;Details--&gt;Display VNC--&gt;keymap--&gt;en-us</u></p><p style="padding: 0px 0px 15px; margin: 0px; color: #2c2c2c; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">保存后再启动虚拟机就可以了<br />转载自：<a href="http://cncto.blog.51cto.com/blog/235831/886946">http://cncto.blog.51cto.com/blog/235831/886946</a></p><img src ="http://www.blogjava.net/ldwblog/aggbug/384899.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ldwblog/" target="_blank">David1228</a> 2012-08-06 12:10 <a href="http://www.blogjava.net/ldwblog/archive/2012/08/06/384899.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Centos6.0制作镜像网卡问题总结-zhgp</title><link>http://www.blogjava.net/ldwblog/archive/2012/06/15/380842.html</link><dc:creator>David1228</dc:creator><author>David1228</author><pubDate>Fri, 15 Jun 2012 03:07:00 GMT</pubDate><guid>http://www.blogjava.net/ldwblog/archive/2012/06/15/380842.html</guid><wfw:comment>http://www.blogjava.net/ldwblog/comments/380842.html</wfw:comment><comments>http://www.blogjava.net/ldwblog/archive/2012/06/15/380842.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ldwblog/comments/commentRss/380842.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ldwblog/services/trackbacks/380842.html</trackback:ping><description><![CDATA[<div><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->一、问题描述<br />&nbsp;&nbsp;&nbsp;&nbsp;根据CentOS-6.0-x86_64-bin-DVD1.iso制作虚拟机镜像后，使用该镜像创建的虚<br /><br />拟机都是网卡eth1，虽然能设置上ip但是虚拟网关并不能设置成功。<br />&nbsp;&nbsp;&nbsp;&nbsp;并且随着镜像-&gt;虚拟机-&gt;镜像-&gt;虚拟机类似流程迭代，网卡ethx会递增。总结一<br /><br />句话：就是eth0不起作用。<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />二、解决问题如下：<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;1、在grub里增加biosdevname=0的启动参数，形如<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;kernel&nbsp;/vmlinuz-2.6.32-131.21.1.el6.i686&nbsp;ro&nbsp;root=/dev/mapper/vg_test-<br /><br />lv_root&nbsp;rd_LVM_LV=vg_test/lv_root&nbsp;rd_LVM_LV=vg_test/lv_swap&nbsp;rd_NO_LUKS&nbsp;rd_NO_MD&nbsp;<br /><br />rd_NO_DM&nbsp;LANG=en_US.UTF-8&nbsp;SYSFONT=latar<br />&nbsp;&nbsp;&nbsp;&nbsp;cyrheb-sun16&nbsp;KEYBOARDTYPE=pc&nbsp;KEYTABLE=us&nbsp;crashkernel=auto&nbsp;rhgb&nbsp;quiet&nbsp;<br /><br />biosdevname=0<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;2、删除udev的配置文件rm&nbsp;-f&nbsp;/etc/udev/rules.d/70-persistent-net.rules。<br /><br />（我的做法比较彪悍，直接把rules.d干掉了。）<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;第3、4、5步是针对单个主机或者虚拟机而言的，我们保证镜像中的eth0网卡配置<br /><br />文件存在，名字为ifcfg-eth0文件中DEVICE=eth0。<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;3、把网卡配置文件改名<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mv&nbsp;ifcfg-em1&nbsp;ifcfg-eth0<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;4、把网卡配置文件内容修正，把em1的全部改成eth0<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;perl&nbsp;-p&nbsp;-i&nbsp;-e&nbsp;&#8216;s/em1/eth0/g&#8217;&nbsp;ifcfg-eth0&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;5、重启系统即可<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;6、配置ssh<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6.1：/etc/ssh/sshd_config&nbsp;&nbsp;&nbsp;配置文件中修改或加入UseDNS=no，将<br /><br />#UseDNS=yes&nbsp;改成：UseDNS=no<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6.2：/etc/ssh/sshd_config&nbsp;&nbsp;&nbsp;配置文件中将#GSSAPIAuthentication&nbsp;<br /><br />no&nbsp;的#号去掉，更改成GSSAPIAuthentication&nbsp;no<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6.3：/etc/ssh/sshd_config&nbsp;&nbsp;&nbsp;配置文件中将PermitRootLogin&nbsp;no修改<br /><br />为yes&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6.4：&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6.5：/etc/ssh/sshd_config&nbsp;&nbsp;&nbsp;配置文件中将PasswordAuthentication&nbsp;<br /><br />no修改为yes就可以了<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6.6：/etc/nsswitch.conf&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;配置文件中，将hosts：files&nbsp;dns&nbsp;&nbsp;改<br /><br />成：hosts：files<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6.7：/etc/init.d/sshd&nbsp;restart&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;重启sshd进程使配置生效<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;其中6.1、6.2、6.6都是处于性能方面考虑<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;7、镜像中存在bcec提供的setIp、rc.local等脚本。<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;经过在39.4环境测试，操作过程从原始镜像&nbsp;-&gt;&nbsp;新虚拟机&nbsp;-&gt;&nbsp;制作镜像镜像&nbsp;-&gt;&nbsp;<br /><br />新镜像虚拟机，网卡都没有问题，都是eth0。<br /><br />&nbsp;Centos6.0制作镜像网卡问题总结-zhgp&nbsp;</div></div><img src ="http://www.blogjava.net/ldwblog/aggbug/380842.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ldwblog/" target="_blank">David1228</a> 2012-06-15 11:07 <a href="http://www.blogjava.net/ldwblog/archive/2012/06/15/380842.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>禁用SSH连接远程主机公钥检查</title><link>http://www.blogjava.net/ldwblog/archive/2012/06/15/380832.html</link><dc:creator>David1228</dc:creator><author>David1228</author><pubDate>Fri, 15 Jun 2012 01:30:00 GMT</pubDate><guid>http://www.blogjava.net/ldwblog/archive/2012/06/15/380832.html</guid><wfw:comment>http://www.blogjava.net/ldwblog/comments/380832.html</wfw:comment><comments>http://www.blogjava.net/ldwblog/archive/2012/06/15/380832.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ldwblog/comments/commentRss/380832.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ldwblog/services/trackbacks/380832.html</trackback:ping><description><![CDATA[<h1><a href="http://www.worldhello.net/2010/04/08/1026.html" style="color: #000000; font-weight: normal; text-decoration: none; clear: left; display: block; padding: 0.3em 0.5em; margin: 0px 0px 0.2em; background-image: url(http://www.worldhello.net/images/header_gradient.gif); background-color: #f8f8f8; -webkit-box-shadow: rgba(0, 0, 0, 0.597656) 1px 1px 5px; box-shadow: rgba(0, 0, 0, 0.597656) 1px 1px 5px; z-index: 10000; background-position: 50% 100%; background-repeat: repeat no-repeat; ">禁用 SSH 远程主机的公钥检查</a></h1><div style="color: #333333; font-family: Rockwell, Verdana, sans-serif; font-size: 18px; line-height: normal; background-color: #ffffff; ">SSH 公钥检查是一个重要的安全机制，可以防范中间人劫持等黑客攻击。但是在特定情况下，严格的 SSH 公钥检查会破坏一些依赖 SSH 协议的自动化任务，就需要一种手段能够绕过 SSH 的公钥检查。<h2>首先看看什么是 SSH 公钥检查</h2>SSH 连接远程主机时，会检查主机的公钥。如果是第一次该主机，会显示该主机的公钥摘要，提示用户是否信任该主机：<pre style="background-color: #f8f8f8; border-style: solid; border-color: #e7e5dc; border-width: 1px 0px 4px 6px; padding: 1em; overflow: auto; color: black; line-height: 16px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 14px; letter-spacing: 0px; background-position: initial initial; background-repeat: initial initial; ">The authenticity of host '192.168.0.110 (192.168.0.110)' can't be established. RSA key fingerprint is a3:ca:ad:95:a1:45:d2:57:3a:e9:e7:75:a8:4c:1f:9f. Are you sure you want to continue connecting (yes/no)? </pre>当选择接受，就会将该主机的公钥追加到文件 ~/.ssh/known_hosts 中。当再次连接该主机时，就不会再提示该问题了。 如果因为某种原因（服务器系统重装，服务器间IP地址交换，DHCP，虚拟机重建，中间人劫持），该IP地址的公钥改变了，当使用 SSH 连接的时候，会报错：<pre style="background-color: #f8f8f8; border-style: solid; border-color: #e7e5dc; border-width: 1px 0px 4px 6px; padding: 1em; overflow: auto; color: black; line-height: 16px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 14px; letter-spacing: 0px; background-position: initial initial; background-repeat: initial initial; ">@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @&nbsp;&nbsp;&nbsp; WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!&nbsp;&nbsp;&nbsp;&nbsp; @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that the RSA host key has just been changed. The fingerprint for the RSA key sent by the remote host is e9:0c:36:89:7f:3c:07:71:09:5a:9f:28:8c:44:e9:05. Please contact your system administrator. Add correct host key in /home/jiangxin/.ssh/known_hosts to get rid of this message. Offending key in /home/jiangxin/.ssh/known_hosts:81 RSA host key for 192.168.0.110 has changed and you have requested strict checking. Host key verification failed. </pre>上面的警告信息说的是：<ul><li>服务器公钥已经改变，新的公钥的摘要是：e9:0c:36:89:7f:3c:07:71:09:5a:9f:28:8c:44:e9:05.</li><li>该服务器原来的公钥记录在文件 ~/.ssh/known_hosts 中第 81 行。</li></ul>如果确认不是中间人劫持，需要连接到该服务器，怎么办呢？最简单的就是用 vi 打开 ~/.ssh/known_hosts 文件，定位到 81 行，将该行删除。之后就可以使用 ssh 连接了。<h2>如何让连接新主机时，不进行公钥确认？</h2>在首次连接服务器时，会弹出公钥确认的提示。这会导致某些自动化任务，由于初次连接服务器而导致自动化任务中断。或者由于&nbsp; ~/.ssh/known_hosts 文件内容清空，导致自动化任务中断。 SSH 客户端的 StrictHostKeyChecking 配置指令，可以实现当第一次连接服务器时，自动接受新的公钥。只需要修改 /etc/ssh/ssh_config 文件，包含下列语句：<pre style="background-color: #f8f8f8; border-style: solid; border-color: #e7e5dc; border-width: 1px 0px 4px 6px; padding: 1em; overflow: auto; color: black; line-height: 16px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 14px; letter-spacing: 0px; background-position: initial initial; background-repeat: initial initial; ">Host *  StrictHostKeyChecking no </pre>或者在 ssh 命令行中用 -o 参数<pre style="background-color: #f8f8f8; border-style: solid; border-color: #e7e5dc; border-width: 1px 0px 4px 6px; padding: 1em; overflow: auto; color: black; line-height: 16px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 14px; letter-spacing: 0px; background-position: initial initial; background-repeat: initial initial; ">$ ssh&nbsp; -o StrictHostKeyChecking=no&nbsp; 192.168.0.110</pre><h2>如何防止远程主机公钥改变导致 SSH 连接失败</h2>当确认中间人劫持攻击风险比较小的情况下，才可以使用下面的方法，禁用 SSH 远程主机的公钥检查。 SSH 客户端提供一个 UserKnownHostsFile 配置，允许指定不同的 known_hosts 文件。那么将 known_hosts 指向不同的文件，不就不会造成公钥冲突导致的中断了么？<pre style="background-color: #f8f8f8; border-style: solid; border-color: #e7e5dc; border-width: 1px 0px 4px 6px; padding: 1em; overflow: auto; color: black; line-height: 16px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 14px; letter-spacing: 0px; background-position: initial initial; background-repeat: initial initial; ">$ ssh -o UserKnownHostsFile=/dev/null 192.168.0.110 The authenticity of host '192.168.0.110 (192.168.0.110)' can't be established. RSA key fingerprint is e9:0c:36:89:7f:3c:07:71:09:5a:9f:28:8c:44:e9:05. Are you sure you want to continue connecting (yes/no)? </pre>看，提示信息由公钥改变中断警告，变成了首次连接的提示。 和之前提到的 StrictHostKeyChecking 配置配合使用，则不再有任何警告出现了：<pre style="border-style: solid; border-color: #e7e5dc; border-width: 1px 0px 4px 6px; padding: 1em; overflow: auto; color: black; line-height: 16px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 14px; letter-spacing: 0px; background-color: #f8f8f8; ">$ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null 192.168.0.110 Warning: Permanently added '192.168.0.110' (RSA) to the list of known hosts. jiangxin@192.168.0.110's password: </pre>如果设置了无口令 SSH 登录（即通过客户端公钥认证），就可以直接连接到远程主机。这是基于 SSH 协议的自动化任务常用的手段。<br /><br />转自:&nbsp;<a href="http://www.worldhello.net/2010/04/08/1026.html">http://www.worldhello.net/2010/04/08/1026.html</a>&nbsp;<br />可参考资料：<a href="http://www.symantec.com/connect/articles/ssh-host-key-protection">http://www.symantec.com/connect/articles/ssh-host-key-protection</a></div><img src ="http://www.blogjava.net/ldwblog/aggbug/380832.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ldwblog/" target="_blank">David1228</a> 2012-06-15 09:30 <a href="http://www.blogjava.net/ldwblog/archive/2012/06/15/380832.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux下rvm安装ruby以及rubygems的过程分享 </title><link>http://www.blogjava.net/ldwblog/archive/2012/03/14/371835.html</link><dc:creator>David1228</dc:creator><author>David1228</author><pubDate>Wed, 14 Mar 2012 02:08:00 GMT</pubDate><guid>http://www.blogjava.net/ldwblog/archive/2012/03/14/371835.html</guid><wfw:comment>http://www.blogjava.net/ldwblog/comments/371835.html</wfw:comment><comments>http://www.blogjava.net/ldwblog/archive/2012/03/14/371835.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ldwblog/comments/commentRss/371835.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ldwblog/services/trackbacks/371835.html</trackback:ping><description><![CDATA[<div><dl><dd><br /></dd></dl>  		<dl><dd line_blue"="">2012-01-08 18:14:40  &nbsp;&nbsp;&nbsp;&nbsp;<a style="font-weight:bold;padding:5px 0px 5px 20px;background:url('http://www.2cto.com/statics/images/icon/user_comment.png') left center no-repeat" href="http://www.2cto.com/os/201201/116337.html#comment_iframe">我来说两句&nbsp;</a></dd><dd line_blue"=""> 			<span id="favorite"> 				<a>收藏</a></span></dd></dl> 		<dl id="fontzoom"><dd id="Article"> 		以前从来没有使用过ruby，这两天刚好要使用GitHub上的离线wiki系统gollum,所以要在偶的ubuntu下安装ruby和ruby-gems。其中遇到一些问题：<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> 如果使用apt-get install ruby 和apt-get install rubygems1.8<br /> &nbsp;<br /> 当使用gem install 命令时报以下错误：<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> ERROR: While executing gem ... (TypeError) instance of Date needs to have method `marshal_load<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> 可能是Ubuntu环境的原因，那么就改用rvm安装，参考了http://beginrescueend.com/rvm/install/<br /> &nbsp;<br /> 若以非root模式安装：<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> bash -s stable &lt; &lt;(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;添加rvm scripts路径变量到bash：<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;&nbsp;&nbsp;&nbsp; echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] &amp;&amp; . "$HOME/.rvm/scripts/rvm" # Load RVM function' &gt;&gt; ~/.bash_profile<br /> &nbsp;<br /> &nbsp;&nbsp;<br /> &nbsp;<br /> &nbsp;让新的bash生效：<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;&nbsp;&nbsp;&nbsp; source ~/.bash_profile<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> 安装ruby1.9.2:<br /> &nbsp;<br /> &nbsp;&nbsp;&nbsp; rvm install 1.9.2<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> 让系统默认使用1.92：<br /> &nbsp;<br /> &nbsp;&nbsp;&nbsp; rvm use 1.9.2 --default<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> 检查安装是否OK：<br /> &nbsp;<br /> &nbsp;&nbsp;&nbsp; ruby&nbsp; -v<br /> &nbsp;<br /> --------------------------------------------<br /> &nbsp;<br /> 接下来安装rubygems<br /> &nbsp;<br /> 先到官网<a href="http://www.2cto.com/soft" target="_blank">下载</a>安装包http://rubygems.org/pages/download<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> 然后安装<br /> &nbsp;<br /> ruby setup.rb<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> 默认采用淘宝的Gem镜像站点<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> gem source http://ruby.taobao.org/<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> 接下来就可以使用gem install xxx命令了，just enjoy it!<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> PS:如过使用gem install报错，可能是Ubuntu本身少一些依赖，比如我安装gollum时缺少依赖libxml2,libxslt,<br /> &nbsp;<br /> 缺少啥就install 啥：<br /> &nbsp;<br /> &nbsp;<br /> &nbsp;<br /> apt-get install libxml2<br /> &nbsp;<br /> apt-get install libxslt<br /> &nbsp;				</dd></dl></div>转自：<div>http://www.2cto.com/os/201201/116337.html</div><img src ="http://www.blogjava.net/ldwblog/aggbug/371835.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ldwblog/" target="_blank">David1228</a> 2012-03-14 10:08 <a href="http://www.blogjava.net/ldwblog/archive/2012/03/14/371835.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>云计算 Google Amazon IBM三巨头</title><link>http://www.blogjava.net/ldwblog/archive/2011/09/09/358355.html</link><dc:creator>David1228</dc:creator><author>David1228</author><pubDate>Fri, 09 Sep 2011 03:06:00 GMT</pubDate><guid>http://www.blogjava.net/ldwblog/archive/2011/09/09/358355.html</guid><wfw:comment>http://www.blogjava.net/ldwblog/comments/358355.html</wfw:comment><comments>http://www.blogjava.net/ldwblog/archive/2011/09/09/358355.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ldwblog/comments/commentRss/358355.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ldwblog/services/trackbacks/358355.html</trackback:ping><description><![CDATA[<div><div>==========amazon<br />亚马逊的弹性计算云<br /><br /><br />亚马逊是互联网上最大的在线零售商，但是同时也为独立开发人员以及开发商提供云计算服务平台。亚马逊将他们的云计算平台称为弹性计算云（Elastic Compute Cloud，EC2），它是最早提供远程云计算平台服务的公司。<br /><br />开放的服务<br /><br />与 Google提供的云计算服务不同，Google仅为自己在互联网上的应用提供云计算平台，独立开发商或者开发人员无法在这个平台上工作，因此只能转而通 过开源的Hadoop软件支持来开发云计算应用。亚马逊的弹性计算云服务也和IBM的云计算服务平台不一样，亚马逊不销售物理的云计算服务平台，没有类似 于&#8220;蓝云&#8221;一样的计算平台。亚马逊将自己的弹性计算云建立在公司内部的大规模集群计算的平台之上，而用户可以通过弹性计算云的网络界面去操作在云计算平台 上运行的各个实例（Instance），而付费方式则由用户的使用状况决定，即用户仅需要为自己所使用的计算平台实例付费，运行结束后计费也随之结束。<br /><br />弹 性计算云从沿革上来看，并不是亚马逊公司推出的第一项这种服务，它由名为亚马逊网络服务的现有平台发展而来。早在2006年3月，亚马逊就发布了简单存储 服务（Simple Storage  Service，S3），这种存储服务按照每个月类似租金的形式进行服务付费，同时用户还需要为相应的网络流量进行付费。亚马逊网络服务平台使用REST  （Representational State  Transfer）和简单对象访问协议（SOAP）等标准接口，用户可以通过这些接口访问到相应的存储服务。<br /><br />2007年7月，亚马逊公司 推出了简单队列服务（Simple Queue  Service，SQS），这项服务使托管主机可以存储计算机之间发送的消息。通过这一项服务，应用程序编写人员可以在分布式程序之间进行数据传递，而无 须考虑消息丢失的问题。通过这种服务方式，即使消息的接收方还没有模块启动也没有关系。服务内部会缓存相应的消息，而一旦有消息接收组件被启动运行，则队 列服务将消息提交给相应的运行模块进行处理。同样的，用户必须为这种消息传递服务进行付费使用，计费的规则与存储计费规则类似，依据消息的个数以及消息传 递的大小进行收费。<br /><br />在亚马逊提供上述服务的时候，并没有从头开始开发相应的网络服务组件，而是对公司已有的平台进行优化和改造，一方面满足了本身网络零售购物应用程序的需求，另一方面也供外部开发人员使用。<br /><br />在开放了上述的服务接口之后，亚马逊公司进一步在此基础上开发了EC2系统，并且开放给外部开发人员使用。</div><div>灵活的工作模式<br /><br />亚马逊的云计算模式沿袭了简单易用的传统，并且建立在亚马逊公司现有的云计算基础平台之上。弹性计算云用户使用客户端通过 SOAP over  HTTPS协议来实现与亚马逊弹性计算云内部的实例进行交互。使用HTTPS协议的原因是为了保证远端连接的安全性，避免用户数据在传输的过程中造成泄 露。因此，从使用模式上来说，弹性计算云平台为用户或者开发人员提供了一个虚拟的集群环境，使得用户的应用具有充分的灵活性，同时也减轻了云计算平台拥有 者（亚马逊公司）的管理负担。<br /><br />而弹性计算云中的实例是一些真正在运行中的虚拟机服务器，每一个实例代表一个运行中的虚拟机。对于提供给某 一个用户的虚拟机，该用户具有完整的访问权限，包括针对此虚拟机的管理员用户权限。虚拟服务器的收费也是根据虚拟机的能力进行计算的，因此，实际上用户租 用的是虚拟的计算能力，简化了计费方式。在弹性计算云中，提供了三种不同能力的虚拟机实例，具有不同的收费价格。例如，其中默认的也是最小的运行实例是 1.7GB的内存，1个EC2的计算单元（1虚拟的计算核以相关的计算单元），160GB的虚拟机内部存储容量，是一个32位的计算平台，收费标准为每个 小时10美分。在当前的蓝计算平台中，还有两种性能更加强劲的虚拟机实例可供使用，当然价格也更加昂贵一点。<br /><br />由于用户在部署网络程序的时 候，一般会使用超过一个运行实例，需要很多个实例共同工作。弹性计算云的内部也架设了实例之间的内部网络，使得用户的应用程序在不同的实例之间可以通信。 在弹性计算云中的每一个计算实例都具有一个内部的IP地址，用户程序可以使用内部IP地址进行数据通信，以获得数据通信的最好性能。每一个实例也具有外部 的地址，用户可以将分配给自己的弹性IP地址分配给自己的运行实例，使得建立在弹性计算云上的服务系统能够为外部提供服务。当然，亚马逊公司也对网络上的 服务流量计费，计费规则也按照内部传输以及外部传输进行分开。<br /><br />总而言之，亚马逊通过提供弹性计算云，减少了小规模软件开发人员对于集群系 统的维护，并且收费方式相对简单明了，用户使用多少资源，只需要为这一部分资源付费即可。这种付费方式与传统的主机托管模式不同。传统的主机托管模式让用 户将主机放入到托管公司，用户一般需要根据最大或者计划的容量进行付费，而不是根据使用情况进行付费，而且，可能还需要保证服务的可靠性、可用性等，付出 的费用更多，而很多时候，服务并没有进行满额资源使用。而根据亚马逊的模式，用户只需要为实际使用情况付费即可。<br /><br />在用户使用模式上，亚马 逊的弹性计算云要求用户要创建基于亚马逊规格的服务器映像（名为亚马逊机器映像即亚马逊 Machine Image,  AMI）。弹性计算云的目标是服务器映像能够拥有用户想要的任何一种操作系统、应用程序、配置、登录和安全机制，但是当前情况下，它只支持Linux内 核。通过创建自己的AMI，或者使用亚马逊预先为用户提供的AMI，用户在完成这一步骤后将AMI上传到弹性计算云平台，然后调用亚马逊的应用编程接口 （API），对AMI进行使用与管理。AMI实际上就是虚拟机的映像，用户可以使用它们来完成任何工作，例如运行数据库服务器，构建快速网络下载的平台， 提供外部搜索服务甚至可以出租自己具有特色的AMI而获得收益。用户所拥有的多个AMI可以通过通信而彼此合作，就像当前的集群计算服务平台一样。<br /><br />在 弹性计算云的将来发展过程中，亚马逊也规划了如何在云计算平台之上帮助用户开发Web  2.0的应用程序。亚马逊认为除了它所依赖的网络零售业务之外，云计算也是亚马逊公司的核心价值所在。可以预见，在将来的发展过程中，亚马逊必然会在弹性 计算云的平台上添加更多的网络服务组件模块，为用户构建云计算应用提供方便。<br /><img src="http://imgs.ccw.com.cn/resources/2008_05/2008_05_11/200805110751210512465687.jpg" alt="" /></div><br /><br />========google<br /><div><br />Google的云计算平台与应用<br /><br />Google的云计算技术实际上是针对Google特定的网络应用程序而定制的。针对内部网络数据规模超大的特点，Google提出了一整套基于分布式并行集群方式的基础架构，利用软件的能力来处理集群中经常发生的节点失效问题。<br /><br />从 2003年开始，Google连续几年在计算机系统研究领域的最顶级会议与杂志上发表论文，揭示其内部的分布式数据处理方法，向外界展示其使用的云计算核 心技术。从其近几年发表的论文来看，Google使用的云计算基础架构模式包括四个相互独立又紧密结合在一起的系统。包括Google建立在集群之上的文 件系统Google File  System，针对Google应用程序的特点提出的Map/Reduce编程模式，分布式的锁机制Chubby以及Google开发的模型简化的大规模 分布式数据库BigTable。<br /><br />Google File System 文件系统<br /><br />为了满足Google迅速增长的数据处 理需求，Google设计并实现了Google文件系统（GFS，Google File  System）。GFS与过去的分布式文件系统拥有许多相同的目标，例如性能、可伸缩性、可靠性以及可用性。然而，它的设计还受到Google应用负载和 技术环境的影响。主要体现在以下四个方面:<br /><br />1. 集群中的节点失效是一种常态，而不是一种异常。由于参与运算与处理的节点数目非常庞大，通常会使用上千个节点进行共同计算，因此，每时每刻总会有节点处在失效状态。需要通过软件程序模块，监视系统的动态运行状况，侦测错误，并且将容错以及自动恢复系统集成在系统中。<br /><br />2. Google系统中的文件大小与通常文件系统中的文件大小概念不一样，文件大小通常以G字节计。另外文件系统中的文件含义与通常文件不同，一个大文件可能包含大量数目的通常意义上的小文件。所以，设计预期和参数，例如I/O操作和块尺寸都要重新考虑。<br /><br />3.   Google文件系统中的文件读写模式和传统的文件系统不同。在Google应用（如搜索）中对大部分文件的修改，不是覆盖原有数据，而是在文件尾追加新 数据。对文件的随机写是几乎不存在的。对于这类巨大文件的访问模式，客户端对数据块缓存失去了意义，追加操作成为性能优化和原子性（把一个事务看做是一个 程序。它要么被完整地执行，要么完全不执行）保证的焦点。<br /><br />4.  文件系统的某些具体操作不再透明，而且需要应用程序的协助完成，应用程序和文件系统API的协同设计提高了整个系统的灵活性。例如，放松了对GFS一致性 模型的要求，这样不用加重应用程序的负担，就大大简化了文件系统的设计。还引入了原子性的追加操作，这样多个客户端同时进行追加的时候，就不需要额外的同 步操作了。<br /><br />总之，GFS是为Google应用程序本身而设计的。据称，Google已经部署了许多GFS集群。有的集群拥有超过1000个存储节点，超过300T的硬盘空间，被不同机器上的数百个客户端连续不断地频繁访问着。<br /><br />图 1给出了Google File  System的系统架构，一个GFS集群包含一个主服务器和多个块服务器，被多个客户端访问。文件被分割成固定尺寸的块。在每个块创建的时候，服务器分配 给它一个不变的、全球惟一的64位块句柄对它进行标识。块服务器把块作为linux文件保存在本地硬盘上，并根据指定的块句柄和字节范围来读写块数据。为 了保证可靠性，每个块都会复制到多个块服务器上，缺省保存三个备份。主服务器管理文件系统所有的元数据，包括名字空间、访问控制信息和文件到块的映射信 息，以及块当前所在的位置。GFS客户端代码被嵌入到每个程序里，它实现了Google文件系统  API，帮助应用程序与主服务器和块服务器通信，对数据进行读写。客户端跟主服务器交互进行元数据操作，但是所有的数据操作的通信都是直接和块服务器进行 的。客户端提供的访问接口类似于POSIX接口，但有一定的修改，并不完全兼容POSIX标准。通过服务器端和客户端的联合设计，Google File  System能够针对它本身的应用获得最大的性能以及可用性效果。<br /><img src="http://imgs.ccw.com.cn/resources/2008_05/2008_05_11/200805112061210512334132.jpg" alt="" /></div><div>MapReduce分布式编程环境<br /><br />为了让内部非分布式系统方向背景的员工能够有机会将应用程序建立在大规模的集群基础之上，Google 还设计并实现了一套大规模数据处理的编程规范Map/Reduce系统。这样，非分布式专业的程序编写人员也能够为大规模的集群编写应用程序而不用去顾虑 集群的可靠性、可扩展性等问题。应用程序编写人员只需要将精力放在应用程序本身，而关于集群的处理问题则交由平台来处理。<br /><br />Map/Reduce通过&#8220;Map（映射）&#8221;和&#8220;Reduce（化简）&#8221;这样两个简单的概念来参加运算，用户只需要提供自己的Map函数以及Reduce函数就可以在集群上进行大规模的分布式数据处理。<br /><br />据称，Google的文本索引方法，即搜索引擎的核心部分，已经通过Map Reduce的方法进行了改写，获得了更加清晰的程序架构。在Google内部，每天有上千个Map Reduce的应用程序在运行。<br /><br />分布式大规模数据库管理系统BigTable<br /><br />构 建于上述两项基础之上的第三个云计算平台就是Google关于将数据库系统扩展到分布式平台上的BigTable系统。很多应用程序对于数据的组织还是非 常有规则的。一般来说，数据库对于处理格式化的数据还是非常方便的，但是由于关系数据库很强的一致性要求，很难将其扩展到很大的规模。为了处理 Google内部大量的格式化以及半格式化数据，Google构建了弱一致性要求的大规模数据库系统BigTable。据称，现在有很多Google的应 用程序建立在BigTable之上，例如Search History、Maps、Orkut和RSS阅读器等。<br /><br />图2给出了在BigTable模型中的数据模型。数据模型包括行列以及相应的时间戳，所有的数据都存放在表格中的单元里。BigTable的内容按照行来划分，将多个行组成一个小表，保存到某一个服务器节点中。这一个小表就被称为Tablet。<br /><br />以上是Google内部云计算基础平台的三个主要部分，除了这三个部分之外，Google还建立了分布式程序的调度器，分布式的锁服务等一系列相关的云计算服务平台。<br /><br />Google的云应用<br /><br />除 了上述的云计算基础设施之外，Google还在其云计算基础设施之上建立了一系列新型网络应用程序。由于借鉴了异步网络数据传输的Web  2.0技术，这些应用程序给予用户全新的界面感受以及更加强大的多用户交互能力。其中典型的Google云计算应用程序就是Google推出的与 Microsoft Office软件进行竞争的Docs网络服务程序。Google Docs是一个基于Web的工具，它有跟Microsoft  Office相近的编辑界面，有一套简单易用的文档权限管理，而且它还记录下所有用户对文档所做的修改。Google  Docs的这些功能令它非常适用于网上共享与协作编辑文档。Google Docs甚至可以用于监控责任清晰、目标明确的项目进度。当前，Google  Docs已经推出了文档编辑、电子表格、幻灯片演示、日程管理等多个功能的编辑模块，能够替代Microsoft  Office相应的一部分功能。值得注意的是，通过这种云计算方式形成的应用程序非常适合于多个用户进行共享以及协同编辑，为一个小组的人员进行共同创作 带来很大的方便性。<br /><br />Google Docs是云计算的一种重要应用，即可以通过浏览器的方式访问远端大规模的存储与计算服务。云计算能够为大规模的新一代网络应用打下良好的基础。<br /><br />虽 然Google可以说是云计算的最大实践者，但是，Google的云计算平台是私有的环境，特别是Google的云计算基础设施还没有开放出来。除了开放 有限的应用程序接口，例如GWT（Google Web Toolkit）以及Google Map  API等，Google并没有将云计算的内部基础设施共享给外部的用户使用，上述的所有基础设施都是私有的。<br /><br />幸运的是，Google公开 了其内部集群计算环境的一部分技术，使得全球的技术开发人员能够根据这一部分文档构建开源的大规模数据处理云计算基础设施，其中最有名的项目即 Apache旗下的Hadoop项目。而下面的两个云计算的实现则为外部的开发人员以及中小公司提供了云计算的平台环境，使得开发者能够在云计算的基础设 施之上构建自己的新型网络应用。其中IBM的蓝云计算平台是可供销售的计算平台，用户可以基于这些软硬件产品自己构建云计算平台。亚马逊的弹性计算云则是 托管式的云计算平台，用户可以通过远端的操作界面直接使用。<br /><img src="http://imgs.ccw.com.cn/resources/2008_05/2008_05_11/200805115911210512347475.jpg" alt="" /></div><br />==================IBM<br /><div>IBM蓝云计算平台<br /><br /><br />IBM在2007年11月15日推出了蓝云计算平台，为客户带来即买即用的云计算平台。它包括一系列的云计算产品，使得计算不仅仅局限在本地机器或远程服务器农场（即服务器集群），通过架构一个分布式、可全球访问的资源结构，使得数据中心在类似于互联网的环境下运行计算。<br /><br />通 过IBM的技术白皮书，我们可以一窥蓝云计算平台的内部构造。&#8220;蓝云&#8221;建立在IBM大规模计算领域的专业技术基础上，基于由IBM软件、系统技术和服务支 持的开放标准和开源软件。简单地说，&#8220;蓝云&#8221;基于IBM Almaden研究中心（Almaden Research  Center）的云基础架构，包括Xen和PowerVM虚拟化、Linux操作系统映像以及Hadoop文件系统与并行构建。&#8220;蓝云&#8221;由IBM  Tivoli软件支持，通过管理服务器来确保基于需求的最佳性能。这包括通过能够跨越多服务器实时分配资源的软件，为客户带来一种无缝体验，加速性能并确 保在最苛刻环境下的稳定性。IBM新近发布的&#8220;蓝云（Blue  Cloud）&#8221;计划，能够帮助用户进行云计算环境的搭建。它通过将Tivoli、DB2、WebSphere与硬件产品（目前是x86刀片服务器）集成， 能够为企业架设一个分布式、可全球访问的资源结构。根据IBM的计划，首款支持Power和x86处理器刀片服务器系统的&#8220;蓝云&#8221;产品将于2008年正式 推出，并且计划随后推出基于System z&#8220;大型主机&#8221;的云环境，以及基于高密度机架集群的云环境。<br /><br />在IBM的云计算白皮书上，我们可以看到如下的蓝云计算平台配置情况。<br /><br />图 4演示了蓝云计算的高层架构。可以看到，蓝云计算平台由一个数据中心: IBM Tivoli部署管理软件（Tivoli Provisioning  Manager）、IBM Tivoli监控软件（IBM Tivoli Monitoring）、IBM WebSphere应用服务器、IBM  DB2数据库以及一些虚拟化的组件共同组成。图中的架构主要描述了云计算的后台架构，并没有涉及到前台的用户界面。<br /><br />蓝云的硬件平台并没有 什么特殊的地方，但是蓝云使用的软件平台相较于以前的分布式平台具有不同的地方，主要体现在对与虚拟机的使用以及对于大规模数据处理软件Apache  Hadoop的部署。Hadoop是网络开发人员根据Google公司公开的资料开发出来的类似于Google File System的Hadoop  File  System以及相应的Map/Reduce编程规范。现在也正在进一步开发类似于Google的Chubby系统以及相应的分布式数据库管理系统 BigTable。由于Hadoop是开源的，因此可以被用户单位直接修改，以适合应用的特殊需求。IBM的蓝云产品则直接将Hadoop软件集成到自己 本身的云计算平台之上。<br /><br />&#8220;蓝云&#8221;中的<br /><br />虚拟化<br /><br />从蓝云的结构上我们还可以看出，在每一个节点上运行的软件栈 与传统的软件栈一个很大的不同在于蓝云内部使用了虚拟化技术。虚拟化的方式在云计算中可以在两个级别上实现。一个级别是在硬件级别上实现虚拟化。硬件级别 的虚拟化可以使用IBM p系列的服务器，获得硬件的逻辑分区LPAR。逻辑分区的CPU资源能够通过IBM Enterprise Workload  Manager来管理。通过这样的方式加上在实际使用过程中的资源分配策略，能够使得相应的资源合理地分配到各个逻辑分区。P系列系统的逻辑分区最小粒度 是1/10颗中央处理器（CPU）。<br /><br />虚拟化的另外一个级别可以通过软件来获得，在蓝云计算平台中使用了Xen虚拟化软件。Xen也是一个开源的虚拟化软件，能够在现有的Linux基础之上运行另外一个操作系统，并通过虚拟机的方式灵活地进行软件部署和操作。<br /><br />通 过虚拟机的方式进行云计算资源的管理具有特殊的好处。由于虚拟机是一类特殊的软件，能够完全模拟硬件的执行，因此能够在上面运行操作系统，进而能够保留一 整套运行环境语义。这样，可以将整个执行环境通过打包的方式传输到其他物理节点上，这样就能够使得执行环境与物理环境隔离，方便整个应用程序模块的部署。 总体上来说，通过将虚拟化的技术应用到云计算的平台，可以获得一些良好的特性。<br /><br />1. 云计算的管理平台能够动态地将计算平台定位到所需要的物理平台上，而无需停止运行在虚拟机平台上的应用程序，这比采用虚拟化技术之前的进程迁移方法更加灵活。<br /><br />2. 能够更加有效率地使用主机资源，将多个负载不是很重的虚拟机计算节点合并到同一个物理节点上，从而能够关闭空闲的物理节点，达到节约电能的目的。<br /><br />3. 通过虚拟机在不同物理节点上的动态迁移，能够获得与应用无关的负载平衡性能。由于虚拟机包含了整个虚拟化的操作系统以及应用程序环境，因此在进行迁移的时候带着整个运行环境，达到了与应用无关的目的。<br /><br />4. 在部署上也更加灵活，即可以将虚拟机直接部署到物理计算平台当中。<br /><br />总而言之，通过虚拟化的方式，云计算平台能够达到极其灵活的特性，而如果不使用虚拟化的方式则会有很多的局限。<br /><img src="http://imgs.ccw.com.cn/resources/2008_05/2008_05_11/200805111651210512742280.jpg" alt="" /></div><div>&#8220;蓝云&#8221;中的<br /><br />存储结构<br /><br />蓝云计算平台中的存储体系结构对于云计算来说也是非常重要的，无论是操作系统，服务程序还是用户应 用程序的数据都保存在存储体系中。云计算并不排斥任何一种有用的存储体系结构，而是需要跟应用程序的需求结合起来获得最好的性能提升。总体上来说，云计算 的存储体系结构包含类似于Google File System的集群文件系统以及基于块设备方式的存储区域网络SAN两种方式。<br /><br />在设计 云计算平台的存储体系结构的时候，不仅仅是需要考虑存储的容量。实际上随着硬盘容量的不断扩充以及硬盘价格的不断下降，使用当前的磁盘技术，可以很容易通 过使用多个磁盘的方式获得很大的磁盘容量。相较于磁盘的容量，在云计算平台的存储中，磁盘数据的读写速度是一个更重要的问题。单个磁盘的速度很有可能限制 应用程序对于数据的访问，因此在实际使用的过程中，需要将数据分布到多个磁盘之上，并且通过对于多个磁盘的同时读写以达到提高速度的目的。在云计算平台 中，数据如何放置是一个非常重要的问题，在实际使用的过程中，需要将数据分配到多个节点的多个磁盘当中。而能够达到这一目的的存储技术趋势当前有两种方 式，一种是使用类似于Google File System的集群文件系统，另外一种是基于块设备的存储区域网络SAN系统。<br /><br />Google 文件系统在前面已经做过一定的描述。在IBM的蓝云计算平台中使用的是它的开源实现Hadoop HDFS （Hadoop Distributed  File  System）。这种使用方式将磁盘附着于节点的内部，并且为外部提供一个共享的分布式文件系统空间，并且在文件系统级别做冗余以提高可靠性。在合适的分 布式数据处理模式下，这种方式能够提高总体的数据处理效率。Google文件系统的这种架构与SAN系统有很大的不同。<br /><br />SAN系统也是云计算平台的另外一种存储体系结构选择，在蓝云平台上也有一定的体现，IBM也提供SAN的平台能够接入到蓝云计算平台中。图5就是一个SAN系统的结构示意图。<br /><br />从 图5中可以看到，SAN系统是在存储端构建存储的网络，将多个存储设备构成一个存储区域网络。前端的主机可以通过网络的方式访问后端的存储设备。而且，由 于提供了块设备的访问方式，与前端操作系统无关。在SAN连接方式上，可以有多种选择。一种选择是使用光纤网络，能够操作快速的光纤磁盘，适合于对性能与 可靠性要求比较高的场所。另外一种选择是使用以太网，采取iSCSI协议，能够运行在普通的局域网环境下，从而降低了成本。由于存储区域网络中的磁盘设备 并没有与某一台主机绑定在一起，而是采用了非常灵活的结构，因此对于主机来说可以访问多个磁盘设备，从而能够获得性能的提升。在存储区域网络中，使用虚拟 化的引擎来进行逻辑设备到物理设备的映射，管理前端主机到后端数据的读写。因此虚拟化引擎是存储区域网络中非常重要的管理模块。<br /><br />SAN系 统与分布式文件系统例如Google File  System并不是相互对立的系统，而是在构建集群系统的时候可供选择的两种方案。其中，在选择SAN系统的时候，为了应用程序的读写，还需要为应用程序 提供上层的语义接口，此时就需要在SAN之上构建文件系统。而Google File  System正好是一个分布式的文件系统，因此能够建立在SAN系统之上。总体来说，SAN与分布式文件系统都可以提供类似的功能，例如对于出错的处理 等。至于如何使用还是需要由建立在云计算平台之上的应用程序来决定。<br /><br />与Google不同的是，IBM并没有基于云计算提供外部可访问的网 络应用程序。这主要是由于IBM并不是一个网络公司，而是一个IT的服务公司。当然，IBM内部以及IBM未来为客户提供的软件服务会基于云计算的架构。 （注: 本文受国家973计划资助，资助号: 2007CB310900以及国家自然科学基金资助，资助号90718040）<br /><img src="http://imgs.ccw.com.cn/resources/2008_05/2008_05_11/200805111081210512763013.jpg" alt="" /></div><br /><br />转载自 http://topic.csdn.net/u/20080526/11/D9D28C55-9BE0-46F1-97DD-B6E2F0CDE31D.html</div><img src ="http://www.blogjava.net/ldwblog/aggbug/358355.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ldwblog/" target="_blank">David1228</a> 2011-09-09 11:06 <a href="http://www.blogjava.net/ldwblog/archive/2011/09/09/358355.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>