<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>https://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>https://jackxiang.com/post/11826/</link>
<title><![CDATA[[kvm] Failed to get shared “write” lock Is another process using the image?]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[虚拟云与Docker]]></category>
<pubDate>Fri, 12 May 2023 07:54:38 +0000</pubDate> 
<guid>https://jackxiang.com/post/11826/</guid> 
<description>
<![CDATA[ 
	原因<br/>此磁盘已经被其他进程占用。<br/><br/>解决方法<br/>方法1<br/>ps -aux &#124;grep &quot; image(创建的磁盘名称)&quot;<br/>//通过上述命令找到相关进程杀死（该磁盘可能被别人占用，建议询问后在杀）<br/>kill -9 “上述命令查出的进程号”<br/>重新拉虚拟机<br/>方法2<br/>sb.img文件镜像大小制作： qemu-img create -f qcow2 sb.img 50G<br/>启动虚拟机 fdisk -l 查看查看磁盘信息 一般会输出/dev/vda或/dev/vdb信息<br/>mkfs.ext4 /dev/vda 格式化磁盘(分区磁盘，查看本地/document/Newer_enviroment_construct/分区磁盘命令)<br/>新建一个文件夹mkdir /tmp , 并挂载磁盘 mount /dev/vda /tmp<br/>替换原来的disk<br/><br/>实践如下：<br/>ps -aux&#124;grep &quot;win10&quot;<br/>root&nbsp;&nbsp;&nbsp;&nbsp; 1519052&nbsp;&nbsp;2.3&nbsp;&nbsp;0.1 883548 92928 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sl&nbsp;&nbsp; 14:51&nbsp;&nbsp; 1:25 /usr/bin/qemu-img convert -f qcow2 -O qcow2 -o compat=1.1,lazy_refcounts /backup/virtImages/win10_bak_10_10_0_119.img /backup/virtImages/win10_bak_10_10_0_168.img<br/><br/><br/>kill -9 1519052<br/><br/><br/>错误如下：<br/>启动域时出错: 内部错误：process exited while connecting to monitor: 2023-05-12T07:49:37.817008Z qemu-kvm: -blockdev &#123;&quot;node-name&quot;:&quot;libvirt-2-format&quot;,&quot;read-only&quot;:false,&quot;driver&quot;:&quot;qcow2&quot;,&quot;file&quot;:&quot;libvirt-2-storage&quot;,&quot;backing&quot;:null&#125;: Failed to get &quot;write&quot; lock<br/>Is another process using the image [/backup/virtImages/win10_bak_10_10_0_119.img]?<br/><br/>Traceback (most recent call last):<br/>&nbsp;&nbsp;File &quot;/usr/share/virt-manager/virtManager/asyncjob.py&quot;, line 75, in cb_wrapper<br/>&nbsp;&nbsp;&nbsp;&nbsp;callback(asyncjob, *args, **kwargs)<br/>&nbsp;&nbsp;File &quot;/usr/share/virt-manager/virtManager/asyncjob.py&quot;, line 111, in tmpcb<br/>&nbsp;&nbsp;&nbsp;&nbsp;callback(*args, **kwargs)<br/>&nbsp;&nbsp;File &quot;/usr/share/virt-manager/virtManager/object/libvirtobject.py&quot;, line 66, in newfn<br/>&nbsp;&nbsp;&nbsp;&nbsp;ret = fn(self, *args, **kwargs)<br/>&nbsp;&nbsp;File &quot;/usr/share/virt-manager/virtManager/object/domain.py&quot;, line 1280, in startup<br/>&nbsp;&nbsp;&nbsp;&nbsp;self._backend.create()<br/>&nbsp;&nbsp;File &quot;/usr/lib64/python3.6/site-packages/libvirt.py&quot;, line 1234, in create<br/>&nbsp;&nbsp;&nbsp;&nbsp;if ret == -1: raise libvirtError (&#039;virDomainCreate() failed&#039;, dom=self)<br/>libvirt.libvirtError: 内部错误：process exited while connecting to monitor: 2023-05-12T07:49:37.817008Z qemu-kvm: -blockdev &#123;&quot;node-name&quot;:&quot;libvirt-2-format&quot;,&quot;read-only&quot;:false,&quot;driver&quot;:&quot;qcow2&quot;,&quot;file&quot;:&quot;libvirt-2-storage&quot;,&quot;backing&quot;:null&#125;: Failed to get &quot;write&quot; lock<br/>Is another process using the image [/backup/virtImages/win10_bak_10_10_0_119.img]?<br/><br/>来自：https://blog.csdn.net/qq_36657175/article/details/124748507
]]>
</description>
</item><item>
<link>https://jackxiang.com/post/10651/</link>
<title><![CDATA[[实践OK]手把手教你打造高效的 Kubernetes 命令行终端]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[虚拟云与Docker]]></category>
<pubDate>Mon, 17 Aug 2020 09:56:30 +0000</pubDate> 
<guid>https://jackxiang.com/post/10651/</guid> 
<description>
<![CDATA[ 
	<textarea name="code" class="php" rows="15" cols="100">
echo &quot;source &lt;(kubectl completion bash)&quot; &gt;&gt; ~/.bashrc
source ~/.bashrc


如果发现不能自动补全，可以尝试安装 bash-completion 然后刷新即可！
#kubectl&nbsp;&nbsp;--contex-bash: _get_comp_words_by_ref: command not found
 ^M
-bash: $&#039;&#92;r&#039;: command not found

重新成功安装步骤如下：
yum install -y bash-completion&nbsp;&nbsp; #安装后还是不能补全

source /usr/share/bash-completion/bash_completion
source &lt;(kubectl completion bash)&nbsp;&nbsp;&nbsp;&nbsp;#运行这一句就能提示了，下面这一行是登录后自动运行这一行，写到~/.bashrc里。
echo &quot;source &lt;(kubectl completion bash)&quot; &gt;&gt; ~/.bashrc

能补全了！
</textarea><br/><br/><br/><br/><br/>在mac上<br/><br/>$ brew install bash-completion<br/>$ source $(brew --prefix)/etc/bash_completion<br/>$ source &lt;(kubectl completion bash)<br/><br/><br/>来自：https://juejin.im/entry/6844903678898356237<br/>Mac： https://i4t.com/3245.html
]]>
</description>
</item><item>
<link>https://jackxiang.com/post/10278/</link>
<title><![CDATA[k8s下容器的内存大小触发OOM]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[虚拟云与Docker]]></category>
<pubDate>Mon, 02 Sep 2019 08:29:45 +0000</pubDate> 
<guid>https://jackxiang.com/post/10278/</guid> 
<description>
<![CDATA[ 
	背景：出现没有OOM，但是stress子进程反复重启，于是系统负载到118，死机，让机房重启，需要验证为何没有OOM？<br/><br/>container_memory_cache，我们会发现使用的缓存量继续增加，直到container_memory_usage_bytes达到限制，然后开始减少。container_memory_usage_bytes确实考虑了一些正在缓存的文件系统页面。我们还可以看到OOMKiller正在跟踪container_memory_working_set_bytes。这是有道理的，因为共享文件系统缓存页面可以随时从内存中逐出。<br/><br/>也就是说：container_memory_cache （（思考文件系统缓存））平时是不动它的一个值，但是当container_memory_usage_bytes伴随container_memory_usage_bytes的增长而增长，container_memory_usage_bytes增长到设定的limit 200M后，发现container_memory_usage_bytes还继续增长，那么它会把container_memory_cache的内存给用掉。<br/><br/>来自：<a href="https://medium.com/faun/how-much-is-too-much-the-linux-oomkiller-and-used-memory-d32186f29c9d" target="_blank">https://medium.com/faun/how-much-is-too-much-the-linux-oomkiller-and-used-memory-d32186f29c9d</a><br/><br/><br/>kubectl get pod memory-demo-2 --namespace=mem-example<br/>这时候，容器可能会运行，也可能会被杀掉。如果容器还没被杀掉，重复之前的命令直至 你看到这个容器被杀掉：<br/><br/>NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;READY&nbsp;&nbsp;&nbsp;&nbsp; STATUS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RESTARTS&nbsp;&nbsp; AGE<br/>memory-demo-2&nbsp;&nbsp; 0/1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OOMKilled&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;24s<br/><br/><br/>来自：<a href="https://www.cnblogs.com/weifeng1463/p/10174432.html" target="_blank">https://www.cnblogs.com/weifeng1463/p/10174432.html</a><br/><br/><br/>相关测试的yaml:<a href="https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/" target="_blank">https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/</a>
]]>
</description>
</item><item>
<link>https://jackxiang.com/post/10202/</link>
<title><![CDATA[[实践OK]Docker里的php-fpm 错误日志级别由notice修改为warning]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[虚拟云与Docker]]></category>
<pubDate>Fri, 24 May 2019 08:05:13 +0000</pubDate> 
<guid>https://jackxiang.com/post/10202/</guid> 
<description>
<![CDATA[ 
	Docker里的php-fpm 错误日志级别由notice修改为warning 不指定,原因是默认的notice日志太多关于PHP-FPM接受设置的请求数后通出的notice:<br/>[24-May-2019 16:22:58] NOTICE: [pool www] child 281 exited with code 0 after 5.861800 seconds from start<br/>[24-May-2019 16:22:58] NOTICE: [pool www] child 282 started<br/>[24-May-2019 16:23:01] NOTICE: [pool www] child 282 exited with code 0 after 2.919651 seconds from start<br/>[24-May-2019 16:23:01] NOTICE: [pool www] child 283 started<br/><br/><textarea name="code" class="php" rows="15" cols="100">
[global]
pid = run/php-fpm.pid
error_log = /data/logs/php/php-fpm-error.log
log_level = warning&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;&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;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
emergency_restart_threshold = 10
emergency_restart_interval = 1m
process_control_timeout = 5s
daemonize = yes 

include=/usr/local/php/etc/php-fpm.d/www.conf
</textarea><br/><br/><br/>1、php-fpm 错误日志<br/><br/>#默认位置 安装目录下的 log/php-fpm.log&nbsp;&nbsp;<br/>error_log = log/php-fpm.log&nbsp;&nbsp;<br/><br/>#错误级别 alert（必须立即处理）, error（错误情况）, warning（警告情况）, notice（一般重要信息）, debug（调试信息）. 默认: notice.<br/>log_level = notice<br/><br/><br/>来自：https://www.cnblogs.com/siqi/p/3656823.html
]]>
</description>
</item><item>
<link>https://jackxiang.com/post/9988/</link>
<title><![CDATA[[实践OK]dive - 用于探索docker image中每个图层的工具]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[虚拟云与Docker]]></category>
<pubDate>Mon, 10 Dec 2018 01:51:03 +0000</pubDate> 
<guid>https://jackxiang.com/post/9988/</guid> 
<description>
<![CDATA[ 
	Docker 容器镜像是一个轻量、独立、含有运行某个应用所需全部软件的可执行包，那么一个 Docker 镜像里面会包含什么东西？这个名为 Dive 的工具正是用来分析和浏览 Docker 镜像每层的内容。<br/><br/>通过分析 Docker 镜像，我们可以发现在各个层之间可能重复的文件，并通过移除它们来减小 Docker 镜像的大小。<br/><br/>Dive 是一个用 Go 语言编写的自由开源工具。Dive 工具不仅仅是一个 Docker 镜像分析工具，它还可以帮助使用者用于构建镜像。<br/><br/>RHEL/Centos<br/><br/>curl -OL https://github.com/wagoodman/dive/releases/download/v0.3.0/dive_0.3.0_linux_amd64.rpm<br/>rpm -i dive_0.3.0_linux_amd64.rpm<br/><br/><br/>来自：https://javascript.ctolib.com/wagoodman-dive.html
]]>
</description>
</item>
</channel>
</rss>