首页 文章 精选 留言 我的

精选列表

搜索[环境层隔离],共10034篇文章
优秀的个人博客,低调大师

Docker核心原理-资源隔离和限制

通常情况运行docker容器没有指定具体哪个cpu和内存的分配,其实docker官方给出了,docker容器可以运行在指定CPU上通过docker run --help可以看到: 先制作docker镜像: 编写Dockerfile 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 [root@linux-node1~] #cdstress/ [root@linux-node1stress] #catDockerfile FROMcentos ADDepel-6.repo /etc/yum .repos.d/ RUNyum-y install stress&&yumcleanall ENTRYPOINT[ "stress" ] [root@linux-node1stress] # [root@linux-node1stress] #dockerbuild-tstress. SendingbuildcontexttoDockerdaemon4.096kB Step1:FROMcentos --->970633036444 Step2:ADDepel-6.repo /etc/yum .repos.d/ --->77600d6b488e Removingintermediatecontainerf141f47cb34f Step3:RUNyum-y install stress&&yumcleanall --->Running in 0949035c73da Loadedplugins:fastestmirror,ovl http: //mirrors .aliyuncs.com /epel/6/x86_64/repodata/98697cba0d79c083725de0c38b11c15878b35f5e27262becc02cd7ed1a13ac22-updateinfo .xml.bz2:[Errno12]Timeoutonhttp: //mirrors .aliyuncs.com /epel/6/x86_64/repodata/98697cba0d79c083725de0c38b11c15878b35f5e27262becc02cd7ed1a13ac22-updateinfo .xml.bz2:(28, 'Connectiontimedoutafter30001milliseconds' ) Tryingothermirror. Determiningfastestmirrors *base:mirrors.zju.edu.cn *epel:mirrors.aliyun.com *extras:mirrors.zju.edu.cn *updates:mirrors.cqu.edu.cn ResolvingDependencies -->Runningtransactioncheck --->Packagestress.x86_640:1.0.4-4.el6willbeinstalled -->FinishedDependencyResolution DependenciesResolved ================================================================================ PackageArchVersionRepositorySize ================================================================================ Installing: stressx86_641.0.4-4.el6epel36k TransactionSummary ================================================================================ Install1Package Totaldownloadsize:36k Installedsize:89k Downloadingpackages: Runningtransactioncheck Runningtransaction test Transaction test succeeded Runningtransaction Installing:stress-1.0.4-4.el6.x86_641 /1 install -info:Nosuch file ordirectory for /usr/share/info/stress .info Verifying:stress-1.0.4-4.el6.x86_641 /1 Installed: stress.x86_640:1.0.4-4.el6 Complete! Loadedplugins:fastestmirror,ovl Cleaningrepos:baseepelextrasupdates Cleaningupeverything Cleaninguplistoffastestmirrors --->504c747b9b51 Removingintermediatecontainer0949035c73da Step4:ENTRYPOINTstress --->Running in ea8d8eb8fb87 --->7e1e0e5cf825 Removingintermediatecontainerea8d8eb8fb87 Successfullybuilt7e1e0e5cf825 [root@linux-node1stress] #dockerimages REPOSITORYTAGIMAGEIDCREATEDSIZE stresslatest7e1e0e5cf825Aboutaminuteago214MB ningx- file v01460b5af495c43daysago531.9MB nginx /ningx 1.9.3v02097c98e3cb2b3daysago534.6MB nginx1.9.3d2cfb9ed3f2b3daysago534.6MB docker.io /centos latest97063303644411daysago196.7MB [root@linux-node1stress] # 查看docker run命令帮助输出: 1 2 3 4 5 6 7 [root@linux-node1stress] #dockerrun--help|grepcpu --cpu-sharesCPUshares(relativeweight) --cpu-periodLimitCPUCFS(CompletelyFairScheduler)period --cpu- quota LimitCPUCFS(CompletelyFairScheduler) quota --cpuset-cpusCPUs in which toallowexecution(0-3,0,1) --cpuset-memsMEMs in which toallowexecution(0-3,0,1) [root@linux-node1stress] # 启动一个容器: 1 2 [root@linux-node1stress] #dockerrun-it--rm--cpuset-cpus=0stress--cpu1 stress:info:[1]dispatchinghogs:1cpu,0io,0vm,0hdd 在另外一个窗口查看使用情况cpu: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 [root@linux-node1~] #top top -00:55:15up13:39,2 users ,loadaverage:0.58,0.47,0.69 Tasks:406total,2running,404sleeping,0stopped,0zombie %Cpu0:100.0us,0.0sy,0.0ni,0.0 id ,0.0wa,0.0hi,0.0si,0.0st %Cpu1:0.3us,0.3sy,0.0ni,99.3 id ,0.0wa,0.0hi,0.0si,0.0st %Cpu2:0.0us,0.0sy,0.0ni,100.0 id ,0.0wa,0.0hi,0.0si,0.0st %Cpu3:0.0us,0.0sy,0.0ni,100.0 id ,0.0wa,0.0hi,0.0si,0.0st KiBMem:773004total,204488 free ,194528used,373988buff /cache KiBSwap:2098172total,2096324 free ,1848used.399644availMem PIDUSERPRNIVIRTRESSHRS%CPU%MEMTIME+COMMAND 5944root2007260920R100.00.00:52.46stress 335root200000S0.30.01:17.95kworker /3 :1 1569root200553044136242952S0.31.80:13.46tuned 4779root200000S0.30.00:02.25kworker /1 :1 5946root20015794825041548R0.30.30:00.18 top 同样,再开启一个窗口: 1 2 [root@linux-node1stress] #dockerrun-it--rmstress--cpu1 stress:info:[1]dispatchinghogs:1cpu,0io,0vm,0hdd 再查切换到其他窗口查看cpu使用情况 1 2 3 4 5 6 7 8 9 10 [root@linux-node1~] #top top -00:57:52up13:41,3 users ,loadaverage:1.50,0.96,0.84 Tasks:414total,2running,412sleeping,0stopped,0zombie %Cpu0:100.0us,0.0sy,0.0ni,0.0 id ,0.0wa,0.0hi,0.0si,0.0st %Cpu1:0.0us,0.0sy,0.0ni,100.0 id ,0.0wa,0.0hi,0.0si,0.0st %Cpu2:0.0us,0.0sy,0.0ni,100.0 id ,0.0wa,0.0hi,0.0si,0.0st %Cpu3:0.0us,2.7sy,0.0ni,97.3 id ,0.0wa,0.0hi,0.0si,0.0st KiBMem:773004total,195560 free ,199560used,377884buff /cache KiBSwap:2098172total,2096576 free ,1596used.393660availMem PIDUSERPRNIVIRTRESSHRS%CPU%MEMTIME+COMMAND 注意命令: docker run -it --rm stress --cpu 1 docker run -it --rm --cpuset-cpus=0 stress --cpu 1 --cpuset-cpus后面跟cpu总个数,为docker容器指定的,而--cpu是用多少个cpu来运行,只能是1、2、3、4 ...N等等 本文转自027ryan 51CTO博客,原文链接:http://blog.51cto.com/ucode/1836484,如需转载请自行联系原作者

优秀的个人博客,低调大师

S5700三交换机 复杂网络环境设置默认路优先级实战

一、拓扑图 新加核心交换机在分中心,分别连区域中心上传路段视频,和路由器去映射内网手机发布服务器,远程手机查看视频,内网服务器必须上网。 二、问题描述 现在分中心上传区域中心视频正常,手机发布服务器不能上网,手机无法远程观看视频。 三、解决方案 查看核心交换机的静态路由器,发现默认路由指向区域分中心。核心交换机与路由器之间互联可以相互ping通,就是无法上网。 发现所有上网请求都被发往区域中心(默认路由的作用),增加一条指向路由器的默认路由,修改优先级为50,(默认60) 配置代码如下: [GLZX_hexin_s5700]ip route-static 0.0.0.0 0.0.0.0 172.16.10.1 preference 50 [GLZX_hexin_s5700]ping 218.30.67.83 (上网正常) PING 218.30.67.83: 56 data bytes, press CTRL_C to break Reply from 218.30.67.83: bytes=56 Sequence=1 ttl=120 time=49 ms Reply from 218.30.67.83: bytes=56 Sequence=2 ttl=120 time=49 ms Reply from 218.30.67.83: bytes=56 Sequence=3 ttl=120 time=49 ms Reply from 218.30.67.83: bytes=56 Sequence=4 ttl=120 time=49 ms Reply from 218.30.67.83: bytes=56 Sequence=5 ttl=120 time=48 ms --- 218.30.67.83 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 48/48/49 ms [GLZX_hexin_s5700]quit <GLZX_hexin_s5700>sa <GLZX_hexin_s5700>save (保存) The current configuration will be written to the device. Are you sure to continue?[Y/N]y Now saving the current configuration to the slot 0. Save the configuration successfully. <GLZX_hexin_s5700>ping www.baidu.com(域名ping不通) Error: Unknown host www.baidu.com. <GLZX_hexin_s5700>sys <GLZX_hexin_s5700>system-view Enter system view, return user view with Ctrl+Z. [GLZX_hexin_s5700]dns server 118.118.118.9 (设置DNS) [GLZX_hexin_s5700] [GLZX_hexin_s5700]dns resolve (启用解析) [GLZX_hexin_s5700]ping www.baidu.com (百度正常) PING www.a.shifen.com (14.215.177.38): 56 data bytes, press CTRL_C to break Reply from 14.215.177.38: bytes=56 Sequence=1 ttl=55 time=33 ms Reply from 14.215.177.38: bytes=56 Sequence=2 ttl=55 time=33 ms Reply from 14.215.177.38: bytes=56 Sequence=3 ttl=55 time=33 ms Reply from 14.215.177.38: bytes=56 Sequence=4 ttl=55 time=33 ms Reply from 14.215.177.38: bytes=56 Sequence=5 ttl=55 time=33 ms --- www.a.shifen.com ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 33/33/33 ms [GLZX_hexin_s5700]clock timezone BJ add 8 (设置时区) [GLZX_hexin_s5700]dis ntp-service status (查看NTP状态) clock status: unsynchronized clock stratum: 16 reference clock ID: none nominal frequency: 60.0002 Hz actual frequency: 60.0002 Hz clock precision: 2^17 clock offset: 0.0000 ms root delay: 0.00 ms root dispersion: 0.00 ms peer dispersion: 0.00 ms reference time: 00:00:00.000 UTC Jan 1 1900(00000000.00000000) [GLZX_hexin_s5700]ntp-service unicast-server 202.120.2.101 [GLZX_hexin_s5700] Oct 1 2008 16:37:58+08:00 GLZX_hexin_s5700 %%01NTP/4/PEER_SELE(l)[2]:The peer selected by the system is 202.120.2.101. [GLZX_hexin_s5700]dis clock (显示时间,发现时间已经校准) 2016-12-21 12:48:13+08:00 Wednesday Time Zone(BJ) : UTC+08:00 [GLZX_hexin_s5700]quit <GLZX_hexin_s5700>save The current configuration will be written to the device. Are you sure to continue?[Y/N]y Dec 21 2016 12:48:34+08:00 GLZX_hexin_s5700 %%01CFM/4/SAVE(l)[5]:The user chose Y when deciding whether to save the configuration to the device. Now saving the current configuration to the slot 0.. Save the configuration successfully. <GLZX_hexin_s5700> 至此,问题解决。

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册