linux集羣實施與部署-----Nginx

 

 ( 1 ) 配置基本環境html

//安裝虛擬工具
#cd /media/VMware\ Tools/
#cp VMwareTools-10.0.6-3595377.tar.gz/tmp/  
#cd /tmp/
#tar-xvzf VMwareTools-10.0.6-3595377.tar.gz
#cd vmware-tools-distrib/
#./vmware-install.pl

 中止和關閉NetworkManager服務:#service NetworkManager statusnode

#service NetworkManager stop
#chkconfig--level 2345 NetworkManager off
臨時關閉SELinux: #setenforce 0
永久關閉SELinux: #vi /etc/selinux/config     //7 SELINUX=disabled 
#iptables -F                    //清除防火牆規則
#service iptables save

修改主機名linux

#vi /etc/hosts
1  127.0.0.1   localhost node1 node1.edu.cn
2  ::1            localhost node1 node1.edu.cn
#vi /etc/sysconfig/network

2  HOSTNAME=node1.edu.cn

配置本地YUM源web

#cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.ba #vi /etc/yum.repos.d/CentOS-Base.repo
                     1  [dvd]
                     2  name=install dvd
                     3  baseurl=file:///media/Centos_6.5_Final
                     4  enable=1
                     5  gpgcheck=1
                     6  pgpkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
          
#yum clean all
#yum makecache

(2)配置各服務器的網絡(Real一、Real2同類)服務器

[root@real1  桌面]#setup
[root@real1  桌面]#vi /etc/sysconfig/network-scripts/ifcfg-eth0  //ONBOOT=yes
[root@real1  桌面]#service network restart

 ( 3 )LVS配置IP地址,添加VIP:網絡

ifconfig eth0:0 192.168.0.100 broadcast 192.168.0.255 netmask 255.255.255.0 up

( 4 )LVS設置負載均衡條目:負載均衡

#yum install ipvsadm -y
#internet protocol virtual server admin 互聯網協議虛擬服務器管理器
#ipvsadm -A -t 192.168.1.100:80 -s rr (-A 添加 virtual server)
#ipvsadm -a -t 192.168.1.100:80 -r 192.168.1.12:80 -g
#ipvsadm -a -t 192.168.1.100:80 -r 192.168.1.13:80 -g

( 5 )LVS使配置永久生效curl

#ipvsadm -save>/etc/sysconfig/ipvsadm
#systemctl enable ipvsadm

( 6 )設置web服務器工具

給兩個web服務器上配置web服務:測試

#echo "this is real 2222"> /var/www/html/index.html
#server httpd給兩個web服務器的lo網卡配置子網掩碼爲32位的VIP:
rs1:#ifconfig lo:0 192.168.0.123/32
rs2:#ifconfig lo:0 192.168.0.123/32

給兩個web服務器設置內核參數(rs1\rs2)

#echo 1>/proc/sysconfig/network/ipv4/config/all/arp_igonre  //忽略ARP響應,不容許收
#echo 2>/proc/sysconfig/network/ipv4/config/all/arp_announce  //讓ARP發包出去,不容許發

(7)客戶端測試 (ctrl+F5)

#curl http://192.168.0.100
相關文章
相關標籤/搜索