lvs

[root@rhel6 ~]#  wget http://classroom.example.com/content/ula/cluster/clusterinit.sh
[root@rhel6 ~]# bash clusterinit.sh lvs1-f15.example.com
Stopping NetworkManager daemon:                            [  OK  ]
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
[root@rhel6 ~]#  reboot
[kiosk@foundation15 Desktop]$ ssh root@172.25.15.14
root@172.25.15.14's password: 
Last login: Thu Sep 29 14:56:31 2016 from 172.25.15.250
[root@lvs1-f15 ~]# vim /etc/sysctl.conf 
# Controls IP packet forwarding
net.ipv4.ip_forward = 1
[root@lvs1-f15 ~]# sysctl -p
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
----------------------------------------------------------
[kiosk@foundation15 Desktop]$ ssh root@172.25.15.15
root@172.25.15.15's password: 
Last login: Thu Sep 29 14:55:30 2016 from 172.25.15.250
[root@lvs2-f15 ~]#  vim /etc/sysctl.conf 
[root@lvs2-f15 ~]# sysctl -p
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
[root@lvs2-f15 ~]# yum groupinstall "load Balancer"
[root@lvs2-f15 ~]# service pluse start
[root@lvs2-f15 ~]# ipvsadm -L -n


------------------------------------
[root@lvs1-f15 ~]# yum grouplist
[root@lvs1-f15 ~]# yum groupinstall "load Balancer"
[root@lvs1-f15 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.25.15.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 eth2
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1004   0        0 eth2
0.0.0.0         172.25.15.254   0.0.0.0         UG    0      0        0 eth0
[root@lvs1-f15 ~]# cat /proc/sys/net/ipv4/ip_forward 
1
[root@lvs1-f15 ~]# service piranha-gui start
Starting piranha-gui:                                      [  OK  ]
[root@lvs1-f15 ~]# chkconfig piranha-gui on
[root@lvs1-f15 ~]# piranha-passwd
New Password: 
Verify: 
Adding password for user piranha


--------------------------------------------
[root@node1-f15 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT=no
vim /etc/sysconfig/network-scripts/ifcfg-eth2
GATEWAY=192.168.122.254
[root@node1-f15 ~]# echo node1-f15 > /var/www/html/index.html
[root@node1-f15 ~]# yum install httpd -y
[root@node1-f15 ~]# service httpd start
Starting httpd:                                            [  OK  ]




[root@node2-f15 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT=no
[root@node2-f15 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth2
GATEWAY=192.168.122.254
[root@node2-f15 ~]# yum install httpd -y
[root@node2-f15 ~]#  service httpd start
Starting httpd:                                            [  OK  ]


-------------------------------------------------






























[root@lvs1-f15 ~]# yum -y install links
[root@lvs2-f15 ~]# yum install links -y  #!!!!!!!!!!!


[root@lvs1-f15 ~]# links http://192.168.122.40 -dump 1
   node1-f15
[root@lvs1-f15 ~]# links http://192.168.122.41 -dump 1
   node2-f15.example.com
[root@lvs1-f15 ~]# vim /bin/testlink.sh
#!/bin/bash


links http://$1 -dump 1 &> /dev/null
if [ $? -eq 0 ]
then
        echo ok
else
        echo no
fi






[root@lvs1-f15 ~]# bash /bin/testlink.sh 192.168.122.41
ok
[root@lvs1-f15 ~]# chmod +x /bin/testlink.sh 
[root@lvs1-f15 ~]# scp /bin/testlink.sh lvs2-f15:/bin
[root@lvs1-f15 ~]# scp /etc/sysconfig/ha/lvs.cf lvs2-f15:/etc/sysconfig/ha/lvs.cf
root@lvs2-f15's password: 
lvs.cf                                           100%  922     0.9KB/s   00:00    
[root@lvs1-f15 ~]#  service pulse start
Starting pulse:                                            [  OK  ]
[root@lvs1-f15 ~]# ipvsadm -L -n
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
TCP  172.25.15.100:80 wlc
  -> 192.168.122.40:80            Masq    1      0          8         
  -> 192.168.122.41:80            Masq    1      0          8     

posted @ 2016-10-06 16:38  希曼博客  阅读(128)  评论(0编辑  收藏  举报