参考资料:
http://jiajun.iteye.com/blog/810150
https://docs.oracle.com/javase/8/docs/technotes/guides/management/jconsole.html
DevOps
相比较在vagrant中配置centos来讲,配置windows会比较麻烦而且特殊一些,下面记录一些自己的经历。
第一步:创建虚拟机
由于windows的vbox不多,能找到一个适合自己的也不太容易,倒不如自己在virtualbox中直接用iso文件安装一个,安装完成后直接: vagrant package –base the_virtualbox_vm_name –output my_windows.box
由于windows不比centos可以使用ssh登录,而是有自己的管理方式,叫做wrm,这个必须在安装windows的时候都设置好,参考资料:
下面是我遇到过的一些问题:
重要配置:
1 2 3 4 5 6 |
winrm quickconfig -q winrm set winrm/config/winrs @{MaxMemoryPerShellMB="512"} winrm set winrm/config @{MaxTimeoutms="1800000"} winrm set winrm/config/service @{AllowUnencrypted="true"} winrm set winrm/config/service/auth @{Basic="true"} sc config WinRM start= auto |
曾经因为没有设置@{AllowUnencrypted=”true” } 和 @{Basic=”true”} 浪费了很多时间
关闭UAC: http://jingyan.baidu.com/article/09ea3ede241689c0afde3972.html
第二步: 配置vagrantfile
vagrant默认使用ssh,而windows要使用wrm,那么,总得有个方式说明一下吧?vagrant官网文档查看了一大片,没找到,最后还是在 http://huestones.co.uk/node/305 找到的,如下:
1 |
config.vm.communicator = "winrm" |
windows中很可能会出现未识别的网络或者是“公用网络”,在这种情况下,winrm是不能正常使用的,所以,保险起见,vagrantfile中添加如下设置:
1 2 |
# Ensure that all networks are set to private config.windows.set_work_network = true |
确保不会出现公用网络,曾经因为这个浪费了不少时间
附:一个windows的vagrantfile
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# -*- mode: ruby -*- # vi: set ft=ruby : # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing. Vagrant.configure(2) do |config| # The most common configuration options are documented and commented below. # For a complete reference, please see the online documentation at # https://docs.vagrantup.com. # Every Vagrant development environment requires a box. You can search for # boxes at https://atlas.hashicorp.com/search. config.vm.box = "win7" # Disable automatic box update checking. If you disable this, then # boxes will only be checked for updates when the user runs # `vagrant box outdated`. This is not recommended. # config.vm.box_check_update = false # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine. In the example below, # accessing "localhost:8080" will access port 80 on the guest machine. # config.vm.network "forwarded_port", guest: 80, host: 8080 # Create a private network, which allows host-only access to the machine # using a specific IP. # config.vm.network "private_network", ip: "192.168.33.10" # Create a public network, which generally matched to bridged network. # Bridged networks make the machine appear as another physical device on # your network. # config.vm.network "public_network" config.vm.network "public_network", ip:"172.16.161.230", :bridge => "em2" # Share an additional folder to the guest VM. The first argument is # the path on the host to the actual folder. The second argument is # the path on the guest to mount the folder. And the optional third # argument is a set of non-required options. # config.vm.synced_folder "../data", "/vagrant_data" config.vm.guest = :windows config.vm.communicator = "winrm" config.windows.set_work_network = true config.winrm.username = "vagrant" config.winrm.password = "vagrant" # Provider-specific configuration so you can fine-tune various # backing providers for Vagrant. These expose provider-specific options. # Example for VirtualBox: # #config.vm.provider "virtualbox" do |vb| # # Display the VirtualBox GUI when booting the machine # vb.gui = true # # # Customize the amount of memory on the VM: # vb.memory = "4096" #end # # View the documentation for the provider you are using for more # information on available options. # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies # such as FTP and Heroku are also available. See the documentation at # https://docs.vagrantup.com/v2/push/atlas.html for more information. # config.push.define "atlas" do |push| # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME" # end # Enable provisioning with a shell script. Additional provisioners such as # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the # documentation for more information about their specific syntax and use. config.vm.provision "shell", inline: <<-SHELL route delete 0.0.0.0 route add 0.0.0.0 mask 0.0.0.0 172.16.161.1 SHELL config.vm.provider "virtualbox" do |v| v.customize ["modifyvm", :id, "--vrde", "on"] v.name = "phpor_win7" end end |
附:
如何给设置的ip指定掩码(默认24位)? 如下指定22位掩码:
1 |
config.vm.network "public_network", ip:"172.16.161.230", :bridge => "em2", :netmask => "255.255.252.0" |
windows的“未识别网络”是什么意思?
当本地连接设置为“自动获取IP地址”,同时网络中又没有dhcp服务器,则该本地连接会被标识为“未识别网络”;如果在所在网络提供一个dhcp服务器,就会避免此种问题的出现
脚本:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
#!/bin/bash size=$1 if [[ $size != *GB ]]; then echo "size must be nGB";exit 1 fi new_size=$((${size/GB/*1024*1024*1024})) data_file=`docker info 2>/dev/null|grep "Data file"|awk '{print $NF}'` data_loop_file=`docker info 2>/dev/null|grep "Data loop file"|awk '{print $NF}'` truncate -s $new_size $data_loop_file #blockdev --getsize64 $data_file losetup -c $data_file #blockdev --getsize64 $data_file pool=`dmsetup status | grep pool|awk '{print $1}' |sed -e s/:$//` old_table_info=`dmsetup table $pool` new_table_info=`echo $old_table_info|(read a b c; echo $a $((new_size/512)) $c)` dmsetup suspend $pool dmsetup reload $pool --table "$new_table_info" dmsetup resume $pool |
参考:
https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/
http://jpetazzo.github.io/2014/01/29/docker-device-mapper-resize/ 翻译版: https://segmentfault.com/a/1190000002931564
https://segmentfault.com/a/1190000004302467 这里的扩容方式比较低级,是丢失数据的扩容方式
https://docs.docker.com/engine/userguide/
https://developerblog.redhat.com/2014/09/30/overview-storage-scalability-docker/
http://blog.opskumu.com/docker-storage-setup.html
最近,经常出现我的blog不能响应的问题,起初怀疑网络问题,因为我是部署在阿里云的。后来,忍无可忍,查了一下:
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 |
#0 0x00007f08b8813248 in poll () from /lib64/libc.so.6 #1 0x00007f08ac57a8f6 in Curl_socket_ready () from /usr/lib64/libcurl.so.4 #2 0x00007f08ac571c11 in ?? () from /usr/lib64/libcurl.so.4 #3 0x00007f08ac571ee1 in Curl_connecthost () from /usr/lib64/libcurl.so.4 #4 0x00007f08ac566710 in Curl_connect () from /usr/lib64/libcurl.so.4 #5 0x00007f08ac56e8c0 in Curl_perform () from /usr/lib64/libcurl.so.4 #6 0x00007f08ac79c414 in ?? () from /usr/lib64/php/modules/curl.so #7 0x00007f08af712769 in dtrace_execute_internal () from /etc/httpd/modules/libphp7.so #8 0x00007f08af798bd2 in ?? () from /etc/httpd/modules/libphp7.so #9 0x00007f08af760960 in execute_ex () from /etc/httpd/modules/libphp7.so #10 0x00007f08af7128ae in dtrace_execute_ex () from /etc/httpd/modules/libphp7.so #11 0x00007f08af798a4a in ?? () from /etc/httpd/modules/libphp7.so #12 0x00007f08af760960 in execute_ex () from /etc/httpd/modules/libphp7.so #13 0x00007f08af7128ae in dtrace_execute_ex () from /etc/httpd/modules/libphp7.so #14 0x00007f08af798a4a in ?? () from /etc/httpd/modules/libphp7.so #15 0x00007f08af760960 in execute_ex () from /etc/httpd/modules/libphp7.so #16 0x00007f08af7128ae in dtrace_execute_ex () from /etc/httpd/modules/libphp7.so #17 0x00007f08af798a4a in ?? () from /etc/httpd/modules/libphp7.so #18 0x00007f08af760960 in execute_ex () from /etc/httpd/modules/libphp7.so #19 0x00007f08af7128ae in dtrace_execute_ex () from /etc/httpd/modules/libphp7.so #20 0x00007f08af798a4a in ?? () from /etc/httpd/modules/libphp7.so #21 0x00007f08af760960 in execute_ex () from /etc/httpd/modules/libphp7.so #22 0x00007f08af7128ae in dtrace_execute_ex () from /etc/httpd/modules/libphp7.so #23 0x00007f08af798a4a in ?? () from /etc/httpd/modules/libphp7.so #24 0x00007f08af760960 in execute_ex () from /etc/httpd/modules/libphp7.so #25 0x00007f08af7128ae in dtrace_execute_ex () from /etc/httpd/modules/libphp7.so #26 0x00007f08af798a4a in ?? () from /etc/httpd/modules/libphp7.so #27 0x00007f08af760960 in execute_ex () from /etc/httpd/modules/libphp7.so #28 0x00007f08af7128ae in dtrace_execute_ex () from /etc/httpd/modules/libphp7.so #29 0x00007f08af7b3f4b in zend_execute () from /etc/httpd/modules/libphp7.so #30 0x00007f08af721233 in zend_execute_scripts () from /etc/httpd/modules/libphp7.so #31 0x00007f08af6c28c0 in php_execute_script () from /etc/httpd/modules/libphp7.so #32 0x00007f08af7b7e3d in ?? () from /etc/httpd/modules/libphp7.so #33 0x00007f08ba225fc0 in ap_run_handler () #34 0x00007f08ba22987e in ap_invoke_handler () #35 0x00007f08ba234fb0 in ap_process_request () #36 0x00007f08ba231df8 in ?? () #37 0x00007f08ba22dac8 in ap_run_process_connection () #38 0x00007f08ba239d57 in ?? () #39 0x00007f08ba23a079 in ?? () #40 0x00007f08ba23acfc in ap_mpm_run () #41 0x00007f08ba211aa0 in main () |
对于一个公司来讲,为了安装软件方便,最好有一个自己的yum源镜像,下面介绍用cobbler配置镜像源。
1 |
/usr/bin/cobbler repo add --name=webtatic --mirror=http://us-east.repo.webtatic.com/yum/el6/x86_64/ --arch=x86_64 --breed=yum |
注:
1 |
cat */config.repo |sed -e s/'${http_server}'/yum.i.yourdomain.com/g >config.repo |
下面是docker安装的一个过程:
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
# yum install docker-engine 已加载插件:fastestmirror Loading mirror speeds from cached hostfile 正在解决依赖关系 --> 正在检查事务 ---> 软件包 docker-engine.x86_64.0.1.11.2-1.el7.centos 将被 安装 --> 正在处理依赖关系 docker-engine-selinux >= 1.11.2-1.el7.centos,它被软件包 docker-engine-1.11.2-1.el7.centos.x86_64 需要 --> 正在处理依赖关系 libsystemd.so.0(LIBSYSTEMD_209)(64bit),它被软件包 docker-engine-1.11.2-1.el7.centos.x86_64 需要 --> 正在处理依赖关系 libdevmapper.so.1.02(DM_1_02_97)(64bit),它被软件包 docker-engine-1.11.2-1.el7.centos.x86_64 需要 --> 正在处理依赖关系 libcgroup,它被软件包 docker-engine-1.11.2-1.el7.centos.x86_64 需要 --> 正在处理依赖关系 libsystemd.so.0()(64bit),它被软件包 docker-engine-1.11.2-1.el7.centos.x86_64 需要 --> 正在处理依赖关系 libltdl.so.7()(64bit),它被软件包 docker-engine-1.11.2-1.el7.centos.x86_64 需要 --> 正在检查事务 ---> 软件包 device-mapper-libs.x86_64.7.1.02.93-3.el7_1.1 将被 升级 --> 正在处理依赖关系 device-mapper-libs = 7:1.02.93-3.el7_1.1,它被软件包 7:device-mapper-1.02.93-3.el7_1.1.x86_64 需要 ---> 软件包 device-mapper-libs.x86_64.7.1.02.107-5.el7_2.2 将被 更新 ---> 软件包 docker-engine-selinux.noarch.0.1.11.2-1.el7.centos 将被 安装 --> 正在处理依赖关系 policycoreutils-python,它被软件包 docker-engine-selinux-1.11.2-1.el7.centos.noarch 需要 ---> 软件包 libcgroup.x86_64.0.0.41-8.el7 将被 安装 ---> 软件包 libtool-ltdl.x86_64.0.2.4.2-21.el7_2 将被 安装 ---> 软件包 systemd-libs.x86_64.0.208-20.el7_1.6 将被 升级 --> 正在处理依赖关系 systemd-libs = 208-20.el7_1.6,它被软件包 systemd-208-20.el7_1.6.x86_64 需要 ---> 软件包 systemd-libs.x86_64.0.219-19.el7_2.9 将被 更新 --> 正在检查事务 ---> 软件包 device-mapper.x86_64.7.1.02.93-3.el7_1.1 将被 升级 --> 正在处理依赖关系 device-mapper = 7:1.02.93-3.el7_1.1,它被软件包 7:device-mapper-event-1.02.93-3.el7_1.1.x86_64 需要 ---> 软件包 device-mapper.x86_64.7.1.02.107-5.el7_2.2 将被 更新 ---> 软件包 policycoreutils-python.x86_64.0.2.2.5-20.el7 将被 安装 --> 正在处理依赖关系 policycoreutils = 2.2.5-20.el7,它被软件包 policycoreutils-python-2.2.5-20.el7.x86_64 需要 --> 正在处理依赖关系 libsemanage-python >= 2.1.10-1,它被软件包 policycoreutils-python-2.2.5-20.el7.x86_64 需要 --> 正在处理依赖关系 audit-libs-python >= 2.1.3-4,它被软件包 policycoreutils-python-2.2.5-20.el7.x86_64 需要 --> 正在处理依赖关系 python-IPy,它被软件包 policycoreutils-python-2.2.5-20.el7.x86_64 需要 --> 正在处理依赖关系 libqpol.so.1(VERS_1.4)(64bit),它被软件包 policycoreutils-python-2.2.5-20.el7.x86_64 需要 --> 正在处理依赖关系 libqpol.so.1(VERS_1.2)(64bit),它被软件包 policycoreutils-python-2.2.5-20.el7.x86_64 需要 --> 正在处理依赖关系 libapol.so.4(VERS_4.0)(64bit),它被软件包 policycoreutils-python-2.2.5-20.el7.x86_64 需要 --> 正在处理依赖关系 checkpolicy,它被软件包 policycoreutils-python-2.2.5-20.el7.x86_64 需要 --> 正在处理依赖关系 libqpol.so.1()(64bit),它被软件包 policycoreutils-python-2.2.5-20.el7.x86_64 需要 --> 正在处理依赖关系 libapol.so.4()(64bit),它被软件包 policycoreutils-python-2.2.5-20.el7.x86_64 需要 ---> 软件包 systemd.x86_64.0.208-20.el7_1.6 将被 升级 --> 正在处理依赖关系 systemd = 208-20.el7_1.6,它被软件包 systemd-sysv-208-20.el7_1.6.x86_64 需要 --> 正在处理依赖关系 systemd = 208-20.el7_1.6,它被软件包 libgudev1-208-20.el7_1.6.x86_64 需要 ---> 软件包 systemd.x86_64.0.219-19.el7_2.9 将被 更新 --> 正在处理依赖关系 kmod >= 18-4,它被软件包 systemd-219-19.el7_2.9.x86_64 需要 --> 正在检查事务 ---> 软件包 audit-libs-python.x86_64.0.2.4.1-5.el7 将被 安装 ---> 软件包 checkpolicy.x86_64.0.2.1.12-6.el7 将被 安装 ---> 软件包 device-mapper-event.x86_64.7.1.02.93-3.el7_1.1 将被 升级 --> 正在处理依赖关系 device-mapper-event = 7:1.02.93-3.el7_1.1,它被软件包 7:lvm2-libs-2.02.115-3.el7_1.1.x86_64 需要 ---> 软件包 device-mapper-event.x86_64.7.1.02.107-5.el7_2.2 将被 更新 --> 正在处理依赖关系 device-mapper-event-libs = 7:1.02.107-5.el7_2.2,它被软件包 7:device-mapper-event-1.02.107-5.el7_2.2.x86_64 需要 ---> 软件包 kmod.x86_64.0.14-10.el7 将被 升级 ---> 软件包 kmod.x86_64.0.20-5.el7 将被 更新 ---> 软件包 libgudev1.x86_64.0.208-20.el7_1.6 将被 升级 ---> 软件包 libgudev1.x86_64.0.219-19.el7_2.9 将被 更新 ---> 软件包 libsemanage-python.x86_64.0.2.1.10-18.el7 将被 安装 --> 正在处理依赖关系 libsemanage = 2.1.10-18.el7,它被软件包 libsemanage-python-2.1.10-18.el7.x86_64 需要 ---> 软件包 policycoreutils.x86_64.0.2.2.5-15.el7 将被 升级 ---> 软件包 policycoreutils.x86_64.0.2.2.5-20.el7 将被 更新 ---> 软件包 python-IPy.noarch.0.0.75-6.el7 将被 安装 ---> 软件包 setools-libs.x86_64.0.3.3.7-46.el7 将被 安装 ---> 软件包 systemd-sysv.x86_64.0.208-20.el7_1.6 将被 升级 ---> 软件包 systemd-sysv.x86_64.0.219-19.el7_2.9 将被 更新 --> 正在检查事务 ---> 软件包 device-mapper-event-libs.x86_64.7.1.02.93-3.el7_1.1 将被 升级 ---> 软件包 device-mapper-event-libs.x86_64.7.1.02.107-5.el7_2.2 将被 更新 ---> 软件包 libsemanage.x86_64.0.2.1.10-16.el7 将被 升级 ---> 软件包 libsemanage.x86_64.0.2.1.10-18.el7 将被 更新 ---> 软件包 lvm2-libs.x86_64.7.2.02.115-3.el7_1.1 将被 升级 --> 正在处理依赖关系 lvm2-libs = 7:2.02.115-3.el7_1.1,它被软件包 7:lvm2-2.02.115-3.el7_1.1.x86_64 需要 ---> 软件包 lvm2-libs.x86_64.7.2.02.130-5.el7_2.2 将被 更新 --> 正在检查事务 ---> 软件包 lvm2.x86_64.7.2.02.115-3.el7_1.1 将被 升级 ---> 软件包 lvm2.x86_64.7.2.02.130-5.el7_2.2 将被 更新 --> 正在处理依赖关系 device-mapper-persistent-data >= 0.5.5-1,它被软件包 7:lvm2-2.02.130-5.el7_2.2.x86_64 需要 --> 正在检查事务 ---> 软件包 device-mapper-persistent-data.x86_64.0.0.4.1-2.el7 将被 升级 ---> 软件包 device-mapper-persistent-data.x86_64.0.0.5.5-1.el7 将被 更新 --> 处理 systemd-219-19.el7_2.9.x86_64 与 initscripts < 9.49.28-1 的冲突 --> 正在使用新的信息重新解决依赖关系 --> 正在检查事务 ---> 软件包 initscripts.x86_64.0.9.49.24-1.el7 将被 升级 ---> 软件包 initscripts.x86_64.0.9.49.30-1.el7_2.2 将被 更新 --> 处理 systemd-219-19.el7_2.9.x86_64 与 dracut < 033-243 的冲突 --> 正在使用新的信息重新解决依赖关系 --> 正在检查事务 ---> 软件包 dracut.x86_64.0.033-241.el7_1.5 将被 升级 --> 正在处理依赖关系 dracut = 033-241.el7_1.5,它被软件包 dracut-network-033-241.el7_1.5.x86_64 需要 --> 正在处理依赖关系 dracut = 033-241.el7_1.5,它被软件包 dracut-config-rescue-033-241.el7_1.5.x86_64 需要 ---> 软件包 dracut.x86_64.0.033-360.el7_2 将被 更新 --> 正在检查事务 ---> 软件包 dracut-config-rescue.x86_64.0.033-241.el7_1.5 将被 升级 ---> 软件包 dracut-config-rescue.x86_64.0.033-360.el7_2 将被 更新 ---> 软件包 dracut-network.x86_64.0.033-241.el7_1.5 将被 升级 ---> 软件包 dracut-network.x86_64.0.033-360.el7_2 将被 更新 --> 解决依赖关系完成 依赖关系解决 =================================================================================================================== Package 架构 版本 源 大小 =================================================================================================================== 正在安装: docker-engine x86_64 1.11.2-1.el7.centos docker-el7 13 M 正在更新: dracut x86_64 033-360.el7_2 centos-7-aliyun-x86_64-update 311 k initscripts x86_64 9.49.30-1.el7_2.2 centos-7-aliyun-x86_64-update 429 k 为依赖而安装: audit-libs-python x86_64 2.4.1-5.el7 centos-7-aliyun-x86_64-base 69 k checkpolicy x86_64 2.1.12-6.el7 centos-7-aliyun-x86_64-base 247 k docker-engine-selinux noarch 1.11.2-1.el7.centos docker-el7 28 k libcgroup x86_64 0.41-8.el7 centos-7-aliyun-x86_64-base 64 k libsemanage-python x86_64 2.1.10-18.el7 centos-7-aliyun-x86_64-base 94 k libtool-ltdl x86_64 2.4.2-21.el7_2 centos-7-aliyun-x86_64-update 49 k policycoreutils-python x86_64 2.2.5-20.el7 centos-7-aliyun-x86_64-base 435 k python-IPy noarch 0.75-6.el7 centos-7-aliyun-x86_64-base 32 k setools-libs x86_64 3.3.7-46.el7 centos-7-aliyun-x86_64-base 485 k 为依赖而更新: device-mapper x86_64 7:1.02.107-5.el7_2.2 centos-7-aliyun-x86_64-update 252 k device-mapper-event x86_64 7:1.02.107-5.el7_2.2 centos-7-aliyun-x86_64-update 167 k device-mapper-event-libs x86_64 7:1.02.107-5.el7_2.2 centos-7-aliyun-x86_64-update 169 k device-mapper-libs x86_64 7:1.02.107-5.el7_2.2 centos-7-aliyun-x86_64-update 305 k device-mapper-persistent-data x86_64 0.5.5-1.el7 centos-7-aliyun-x86_64-base 350 k dracut-config-rescue x86_64 033-360.el7_2 centos-7-aliyun-x86_64-update 49 k dracut-network x86_64 033-360.el7_2 centos-7-aliyun-x86_64-update 90 k kmod x86_64 20-5.el7 centos-7-aliyun-x86_64-base 114 k libgudev1 x86_64 219-19.el7_2.9 centos-7-aliyun-x86_64-update 66 k libsemanage x86_64 2.1.10-18.el7 centos-7-aliyun-x86_64-base 123 k lvm2 x86_64 7:2.02.130-5.el7_2.2 centos-7-aliyun-x86_64-update 1.0 M lvm2-libs x86_64 7:2.02.130-5.el7_2.2 centos-7-aliyun-x86_64-update 872 k policycoreutils x86_64 2.2.5-20.el7 centos-7-aliyun-x86_64-base 803 k systemd x86_64 219-19.el7_2.9 centos-7-aliyun-x86_64-update 5.1 M systemd-libs x86_64 219-19.el7_2.9 centos-7-aliyun-x86_64-update 358 k systemd-sysv x86_64 219-19.el7_2.9 centos-7-aliyun-x86_64-update 53 k 事务概要 =================================================================================================================== 安装 1 软件包 (+ 9 依赖软件包) 升级 2 软件包 (+16 依赖软件包) 总下载量:25 M Is this ok [y/d/N]: y Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. (1/28): audit-libs-python-2.4.1-5.el7.x86_64.rpm | 69 kB 00:00:00 (2/28): device-mapper-event-1.02.107-5.el7_2.2.x86_64.rpm | 167 kB 00:00:00 (3/28): device-mapper-event-libs-1.02.107-5.el7_2.2.x86_64.rpm | 169 kB 00:00:00 (4/28): device-mapper-1.02.107-5.el7_2.2.x86_64.rpm | 252 kB 00:00:00 (5/28): checkpolicy-2.1.12-6.el7.x86_64.rpm | 247 kB 00:00:00 (6/28): device-mapper-libs-1.02.107-5.el7_2.2.x86_64.rpm | 305 kB 00:00:00 (7/28): docker-engine-selinux-1.11.2-1.el7.centos.noarch.rpm | 28 kB 00:00:00 (8/28): device-mapper-persistent-data-0.5.5-1.el7.x86_64.rpm | 350 kB 00:00:00 (9/28): dracut-config-rescue-033-360.el7_2.x86_64.rpm | 49 kB 00:00:00 (10/28): dracut-033-360.el7_2.x86_64.rpm | 311 kB 00:00:00 (11/28): dracut-network-033-360.el7_2.x86_64.rpm | 90 kB 00:00:00 (12/28): libgudev1-219-19.el7_2.9.x86_64.rpm | 66 kB 00:00:00 (13/28): initscripts-9.49.30-1.el7_2.2.x86_64.rpm | 429 kB 00:00:00 (14/28): libcgroup-0.41-8.el7.x86_64.rpm | 64 kB 00:00:00 (15/28): kmod-20-5.el7.x86_64.rpm | 114 kB 00:00:00 (16/28): libsemanage-python-2.1.10-18.el7.x86_64.rpm | 94 kB 00:00:00 (17/28): libsemanage-2.1.10-18.el7.x86_64.rpm | 123 kB 00:00:00 (18/28): libtool-ltdl-2.4.2-21.el7_2.x86_64.rpm | 49 kB 00:00:00 (19/28): lvm2-2.02.130-5.el7_2.2.x86_64.rpm | 1.0 MB 00:00:00 (20/28): docker-engine-1.11.2-1.el7.centos.x86_64.rpm | 13 MB 00:00:02 (21/28): policycoreutils-2.2.5-20.el7.x86_64.rpm | 803 kB 00:00:00 (22/28): lvm2-libs-2.02.130-5.el7_2.2.x86_64.rpm | 872 kB 00:00:00 (23/28): python-IPy-0.75-6.el7.noarch.rpm | 32 kB 00:00:00 (24/28): setools-libs-3.3.7-46.el7.x86_64.rpm | 485 kB 00:00:00 (25/28): policycoreutils-python-2.2.5-20.el7.x86_64.rpm | 435 kB 00:00:00 (26/28): systemd-libs-219-19.el7_2.9.x86_64.rpm | 358 kB 00:00:00 (27/28): systemd-sysv-219-19.el7_2.9.x86_64.rpm | 53 kB 00:00:00 (28/28): systemd-219-19.el7_2.9.x86_64.rpm | 5.1 MB 00:00:01 ------------------------------------------------------------------------------------------------------------------- 总计 5.9 MB/s | 25 MB 00:00:04 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在更新 : systemd-libs-219-19.el7_2.9.x86_64 1/46 正在更新 : dracut-033-360.el7_2.x86_64 2/46 正在更新 : kmod-20-5.el7.x86_64 3/46 正在更新 : systemd-219-19.el7_2.9.x86_64 4/46 正在更新 : 7:device-mapper-1.02.107-5.el7_2.2.x86_64 5/46 正在更新 : 7:device-mapper-libs-1.02.107-5.el7_2.2.x86_64 6/46 正在更新 : 7:device-mapper-event-libs-1.02.107-5.el7_2.2.x86_64 7/46 正在安装 : libcgroup-0.41-8.el7.x86_64 8/46 正在更新 : libsemanage-2.1.10-18.el7.x86_64 9/46 正在更新 : policycoreutils-2.2.5-20.el7.x86_64 10/46 正在安装 : libsemanage-python-2.1.10-18.el7.x86_64 11/46 正在更新 : 7:device-mapper-event-1.02.107-5.el7_2.2.x86_64 12/46 正在更新 : 7:lvm2-libs-2.02.130-5.el7_2.2.x86_64 13/46 正在安装 : checkpolicy-2.1.12-6.el7.x86_64 14/46 正在安装 : audit-libs-python-2.4.1-5.el7.x86_64 15/46 正在更新 : device-mapper-persistent-data-0.5.5-1.el7.x86_64 16/46 正在安装 : libtool-ltdl-2.4.2-21.el7_2.x86_64 17/46 正在安装 : python-IPy-0.75-6.el7.noarch 18/46 正在安装 : setools-libs-3.3.7-46.el7.x86_64 19/46 正在安装 : policycoreutils-python-2.2.5-20.el7.x86_64 20/46 正在安装 : docker-engine-selinux-1.11.2-1.el7.centos.noarch 21/46 restorecon: lstat(/var/lib/docker) failed: No such file or directory 警告:%post(docker-engine-selinux-1.11.2-1.el7.centos.noarch) 脚本执行失败,退出状态码为 255 Non-fatal POSTIN scriptlet failure in rpm package docker-engine-selinux-1.11.2-1.el7.centos.noarch 正在安装 : docker-engine-1.11.2-1.el7.centos.x86_64 22/46 正在更新 : 7:lvm2-2.02.130-5.el7_2.2.x86_64 23/46 Created symlink from /etc/systemd/system/sysinit.target.wants/lvm2-lvmpolld.socket to /usr/lib/systemd/system/lvm2-lvmpolld.socket. 正在更新 : initscripts-9.49.30-1.el7_2.2.x86_64 24/46 正在更新 : systemd-sysv-219-19.el7_2.9.x86_64 25/46 正在更新 : dracut-config-rescue-033-360.el7_2.x86_64 26/46 正在更新 : dracut-network-033-360.el7_2.x86_64 27/46 正在更新 : libgudev1-219-19.el7_2.9.x86_64 28/46 清理 : 7:lvm2-2.02.115-3.el7_1.1.x86_64 29/46 清理 : 7:lvm2-libs-2.02.115-3.el7_1.1.x86_64 30/46 清理 : 7:device-mapper-event-1.02.93-3.el7_1.1.x86_64 31/46 清理 : libgudev1-208-20.el7_1.6.x86_64 32/46 清理 : initscripts-9.49.24-1.el7.x86_64 33/46 清理 : systemd-sysv-208-20.el7_1.6.x86_64 34/46 清理 : dracut-network-033-241.el7_1.5.x86_64 35/46 清理 : dracut-config-rescue-033-241.el7_1.5.x86_64 36/46 清理 : dracut-033-241.el7_1.5.x86_64 37/46 清理 : 7:device-mapper-event-libs-1.02.93-3.el7_1.1.x86_64 38/46 清理 : 7:device-mapper-1.02.93-3.el7_1.1.x86_64 39/46 清理 : 7:device-mapper-libs-1.02.93-3.el7_1.1.x86_64 40/46 清理 : systemd-208-20.el7_1.6.x86_64 41/46 清理 : policycoreutils-2.2.5-15.el7.x86_64 42/46 清理 : libsemanage-2.1.10-16.el7.x86_64 43/46 清理 : kmod-14-10.el7.x86_64 44/46 清理 : systemd-libs-208-20.el7_1.6.x86_64 45/46 清理 : device-mapper-persistent-data-0.4.1-2.el7.x86_64 46/46 验证中 : 7:device-mapper-libs-1.02.107-5.el7_2.2.x86_64 1/46 验证中 : initscripts-9.49.30-1.el7_2.2.x86_64 2/46 验证中 : libsemanage-python-2.1.10-18.el7.x86_64 3/46 验证中 : setools-libs-3.3.7-46.el7.x86_64 4/46 验证中 : libsemanage-2.1.10-18.el7.x86_64 5/46 验证中 : docker-engine-selinux-1.11.2-1.el7.centos.noarch 6/46 验证中 : kmod-20-5.el7.x86_64 7/46 验证中 : python-IPy-0.75-6.el7.noarch 8/46 验证中 : 7:lvm2-2.02.130-5.el7_2.2.x86_64 9/46 验证中 : docker-engine-1.11.2-1.el7.centos.x86_64 10/46 验证中 : 7:device-mapper-1.02.107-5.el7_2.2.x86_64 11/46 验证中 : dracut-config-rescue-033-360.el7_2.x86_64 12/46 验证中 : policycoreutils-python-2.2.5-20.el7.x86_64 13/46 验证中 : libcgroup-0.41-8.el7.x86_64 14/46 验证中 : libtool-ltdl-2.4.2-21.el7_2.x86_64 15/46 验证中 : device-mapper-persistent-data-0.5.5-1.el7.x86_64 16/46 验证中 : 7:device-mapper-event-libs-1.02.107-5.el7_2.2.x86_64 17/46 验证中 : dracut-network-033-360.el7_2.x86_64 18/46 验证中 : audit-libs-python-2.4.1-5.el7.x86_64 19/46 验证中 : dracut-033-360.el7_2.x86_64 20/46 验证中 : systemd-sysv-219-19.el7_2.9.x86_64 21/46 验证中 : libgudev1-219-19.el7_2.9.x86_64 22/46 验证中 : checkpolicy-2.1.12-6.el7.x86_64 23/46 验证中 : policycoreutils-2.2.5-20.el7.x86_64 24/46 验证中 : systemd-219-19.el7_2.9.x86_64 25/46 验证中 : 7:lvm2-libs-2.02.130-5.el7_2.2.x86_64 26/46 验证中 : systemd-libs-219-19.el7_2.9.x86_64 27/46 验证中 : 7:device-mapper-event-1.02.107-5.el7_2.2.x86_64 28/46 验证中 : 7:lvm2-2.02.115-3.el7_1.1.x86_64 29/46 验证中 : dracut-config-rescue-033-241.el7_1.5.x86_64 30/46 验证中 : 7:device-mapper-libs-1.02.93-3.el7_1.1.x86_64 31/46 验证中 : 7:lvm2-libs-2.02.115-3.el7_1.1.x86_64 32/46 验证中 : systemd-sysv-208-20.el7_1.6.x86_64 33/46 验证中 : kmod-14-10.el7.x86_64 34/46 验证中 : 7:device-mapper-1.02.93-3.el7_1.1.x86_64 35/46 验证中 : dracut-033-241.el7_1.5.x86_64 36/46 验证中 : policycoreutils-2.2.5-15.el7.x86_64 37/46 验证中 : device-mapper-persistent-data-0.4.1-2.el7.x86_64 38/46 验证中 : initscripts-9.49.24-1.el7.x86_64 39/46 验证中 : libsemanage-2.1.10-16.el7.x86_64 40/46 验证中 : dracut-network-033-241.el7_1.5.x86_64 41/46 验证中 : libgudev1-208-20.el7_1.6.x86_64 42/46 验证中 : 7:device-mapper-event-libs-1.02.93-3.el7_1.1.x86_64 43/46 验证中 : 7:device-mapper-event-1.02.93-3.el7_1.1.x86_64 44/46 验证中 : systemd-208-20.el7_1.6.x86_64 45/46 验证中 : systemd-libs-208-20.el7_1.6.x86_64 46/46 已安装: docker-engine.x86_64 0:1.11.2-1.el7.centos 作为依赖被安装: audit-libs-python.x86_64 0:2.4.1-5.el7 checkpolicy.x86_64 0:2.1.12-6.el7 docker-engine-selinux.noarch 0:1.11.2-1.el7.centos libcgroup.x86_64 0:0.41-8.el7 libsemanage-python.x86_64 0:2.1.10-18.el7 libtool-ltdl.x86_64 0:2.4.2-21.el7_2 policycoreutils-python.x86_64 0:2.2.5-20.el7 python-IPy.noarch 0:0.75-6.el7 setools-libs.x86_64 0:3.3.7-46.el7 更新完毕: dracut.x86_64 0:033-360.el7_2 initscripts.x86_64 0:9.49.30-1.el7_2.2 作为依赖被升级: device-mapper.x86_64 7:1.02.107-5.el7_2.2 device-mapper-event.x86_64 7:1.02.107-5.el7_2.2 device-mapper-event-libs.x86_64 7:1.02.107-5.el7_2.2 device-mapper-libs.x86_64 7:1.02.107-5.el7_2.2 device-mapper-persistent-data.x86_64 0:0.5.5-1.el7 dracut-config-rescue.x86_64 0:033-360.el7_2 dracut-network.x86_64 0:033-360.el7_2 kmod.x86_64 0:20-5.el7 libgudev1.x86_64 0:219-19.el7_2.9 libsemanage.x86_64 0:2.1.10-18.el7 lvm2.x86_64 7:2.02.130-5.el7_2.2 lvm2-libs.x86_64 7:2.02.130-5.el7_2.2 policycoreutils.x86_64 0:2.2.5-20.el7 systemd.x86_64 0:219-19.el7_2.9 systemd-libs.x86_64 0:219-19.el7_2.9 systemd-sysv.x86_64 0:219-19.el7_2.9 完毕! |
原来有文章提到过,Centos7上多个进程可以同时listen同一个端口,起到负载均衡的效果,也方便实现服务的无缝升级; 但是Centos6上多个进程同时listen同一个端口的情况怎么理解呢?
首先,这事儿并不新鲜,正常情况下php-fpm的每个子进程都在listen中父进程集成下来的9000端口的,这个并不冲突;但是下图有显示ssh和fpm同时listen 9000端口:
何故?会有问题吗?
进程说明: web server通过fpm提供了一个命令执行的功能,通过shell_exec()执行的,命令执行的是一个ssh命令,执行时间比较长;该ssh进程继承了父进程的文件描述符 *:9000 就被listen了,显然,该ssh进程其实是不会去accept该 *:9000 端口的,所以正常请求不会被ssh意外处理的。
似乎没啥问题,但是确实有问题:
fpm master派生新的子进程后,新的子进程不能正常accept该文件描述符,strace跟踪部分输出如下:
我们发现,fpm子进程accept(0,…) 报“资源临时不可用”,然后直接退出,然后fpm-master继续派生新的子进程,然后再退出,迅速重复该过程,结果:
问题:
附:
服务器版本信息:
参考: http://www.tutorialspoint.com/c_standard_library/c_macro_va_start.htm (这的代码可以执行的哦)
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 |
#include<stdarg.h> #include<stdio.h> int sum(int, ...); int main(void) { printf("Sum of 10, 20 and 30 = %d\n", sum(3, 10, 20, 30) ); printf("Sum of 4, 20, 25 and 30 = %d\n", sum(4, 4, 20, 25, 30) ); return 0; } int sum(int num_args, ...) { int val = 0; va_list ap; int i; va_start(ap, num_args); for(i = 0; i < num_args; i++) { val += va_arg(ap, int); } va_end(ap); return val; } |
在Linux中,中断当前运行的进程的方法有两种: