yanglgzh 发表于 2018-12-22 11:23:50

php与bonding

  bonding:
  # cat /boot/config-2.6.18-194.el5 | grep BONDING
CONFIG_BONDING=m
# modprobe bonding
# lsmod | grep bonding
bonding                968730
ipv6                  27030527 bonding
# cd /etc/sysconfig/network-scripts/
# ls
ifcfg-eth0    ifdown-ipv6    ifup          ifup-isdn    ifup-tunnel
ifcfg-eth1    ifdown-isdn    ifup-aliasesifup-plip    ifup-wireless
ifcfg-lo      ifdown-post    ifup-bnep   ifup-plusb   init.ipv6-global
ifdown      ifdown-ppp   ifup-eth      ifup-post    net.hotplug
ifdown-bnep   ifdown-routesifup-ippp   ifup-ppp   network-functions
ifdown-eth    ifdown-sit   ifup-ipsec    ifup-routesnetwork-functions-ipv6
ifdown-ippp   ifdown-sl      ifup-ipv6   ifup-sit
ifdown-ipsecifdown-tunnelifup-ipx      ifup-sl
# cp ifcfg-eth0 ifcfg-eth1
cp:是否覆盖“ifcfg-eth1”? y
# cp ifcfg-eth0 ifcfg-bond0
#
# vim ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
SLAVE=yes
MASTER=bond0
IPV6INIT=no
USERCTL=no
# vim ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
SLAVE=yes
MASTER=bond0
IPV6INIT=no
USERCTL=no
# vim ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
IPADDR=172.17.16.5
NETMASK=255.255.255.0
GATEWAY=172.17.16.100
TYPE=Ethernet
IPV6INIT=no
USERCTL=no
  # vim /etc/modprobe.d/bond.conf
alias bond0 bonding
options bond0 miimon=50 mode=1
  # service network restart
正在关闭接口 eth0:                                        [确定]
正在关闭接口 eth1:                                        [确定]
关闭环回接口:                                             [确定]
弹出环回接口:                                             [确定]
弹出界面 bond0:                                           [确定]
# ifconfig
# init 6重启计算机
  #
# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)
  Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 50
Up Delay (ms): 0
Down Delay (ms): 0
  Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:07:95:8c
  Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:07:95:96
#
  关闭网卡eth1:
# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)
  Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 50
Up Delay (ms): 0
Down Delay (ms): 0
  Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:07:95:8c
  Slave Interface: eth1
MII Status: down
Link Failure Count: 1
Permanent HW addr: 00:0c:29:07:95:96
#

  安装php:
  # tar fvxj httpd-2.2.22.tar.bz2
# ls
anaconda-ks.cfghttpd-2.2.22          install.log         php-5.4.10.tar.bz2
Desktop          httpd-2.2.22.tar.bz2install.log.syslogvmware-tools-distrib
# cd httpd-2.2.22
#
# ./configure --prefix=/usr/local/http --enable-so
# make && make install
启动httpd
# /usr/local/http/bin/httpd
在浏览器中输入:http://172.17.17.6/
It works!
  # cd /usr/local/http/
# ls
bin    cgi-binerror   icons    lib   man   modules
buildconf   htdocsincludelogsmanual
# cd htdocs/
# ls
index.html
#
# vim index.html
修改文件:
today is monday!
  在浏览器中输入:http://172.17.17.6/
today is monday!
  # vim phpinfo.php
输入:
  安装php
# cd
# ls
anaconda-ks.cfghttpd-2.2.22          install.log         php-5.4.10.tar.bz2
Desktop          httpd-2.2.22.tar.bz2install.log.syslogvmware-tools-distrib
# tar fvxj php-5.4.10.tar.bz2
# cd php-5.4.10
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/http/bin/apxs
安装libxml2-devel 在httpd.conf中生成php模块:
# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
# yum install libxml2-devel -y
  配置:
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/http/bin/apxs
编译:
# make && make install
  修改httpd.conf文件:
# cd /usr/local/http/
# cd conf/
# ls
extrahttpd.confmagicmime.typesoriginal
#vim httpd.conf
在# LoadModule foo_module modules/mod_foo.so下添加:
  AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
  重启服务:
  # /usr/local/http/bin/httpd
在浏览器中输入:
http://172.17.17.6/phpinfo.php
观察运行结果。



页: [1]
查看完整版本: php与bonding