LINUX集群部署(2)
时间:2007-04-05 来源:kingp999
二 配置LVS
1 Piranha 配置工具设置口令
piranha-passwd
2 启动 Piranha 配置工具服务
service piranha-gui start
3 限制对 Piranha 配置工具的使用
/etc/sysconfig/ha/web/secure/.htaccess
Order deny,allow
Deny from all
Allow from 127.0.0.1
4启用分组转发
/etc/sysctl.conf 中的 net.ipv4.ip_forward = 0 这一行改为:
net.ipv4.ip_forward = 1
5 分配防火墙标记
iptables -t mangle -A PREROUTING -p tcp -d n.n.n.n/32 --dport 80 -j MARK --set-mark 80
三 Piranha 配置工具
1 登陆 打开 http://localhost:3636
2 GLOBAL SETTINGS
Primary server public IP
主 LVS 节点的可公开选路的真正IP地址
Primary server private IP
主 LVS 节点上的另一个网络接口的真正 IP 地址
NAT Router IP
浮动 IP 地址
NAT Router netmask
子网掩码
NAT Router device
浮动 IP 地址的网络接口的设备名称
3 REDUNDANCY 备份 LVS 路由器节点
Redundant server public IP
备份 LVS 路由器节点的公共真正 IP 地址。
Redundant server private IP
备份节点的专用真正 IP 地址。
Heartbeat Interval (seconds)
设置为心跳之间的时间
Assume dead after (seconds)
备份 LVS 路由器节点失效转移的时间。
Heartbeat runs on port
主 LVS 节点的心跳通信端口
4 VIRTUAL SERVERS
Name虚拟服务器名称。
Application port
监听端口号
Protocol
UDP 或 TCP
Virtual IP Address
虚拟服务器的浮动 IP 地址。
Virtual IP Network Mask
虚拟服务器子网掩码。
Firewall Mark
防火墙标记
Device
浮动 IP 地址绑定的网络设备
Re-entry Time
失效重新加载真正服务器的时间
Service Timeout
失效剔除真正服务器的时间
Quiesce server
防止了新服务器在进入群集的大量连接
Load monitoring tool
监视各个真正服务器的载量
Scheduling
调度算式
Persistence
连接超时前所允许经过的不活跃期间的秒数
Persistence Network Mask
限制某个特定子网的持续性的子网掩码。
5 REAL SERVER
Name
真正服务器
Address
真正服务器的 IP
Weight
主机权值
6同步配置文件
scp /etc/sysconfig/ha/lvs.cf n.n.n.n:/etc/sysconfig/ha/lvs.cf
scp /etc/sysconfig/iptables n.n.n.n:/etc/sysconfig/
四 LVS部署
1 路由转发
vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
sysctl –p
2 iptables标记
iptables -t mangle -A PREROUTING -p tcp -d 211.144.137.131/32 --dport 80 -j MARK --set-mark 81
iptables -t mangle -A PREROUTING -p tcp -d 211.144.137.232/32 --dport 80 -j MARK --set-mark 82
iptables -t mangle -A PREROUTING -p tcp -d 211.144.137.233/32 --dport 80 -j MARK --set-mark 83
iptables -t mangle -A PREROUTING -p tcp -d 211.144.137.234/32 --dport 80 -j MARK --set-mark 84
iptables -t mangle -A PREROUTING -p tcp -d 211.144.137.235/32 --dport 80 -j MARK --set-mark 85
3 配置lvs.cf
serial_no = 40
primary = 211.144.137.130
primary_private = 211.144.137.130
service = lvs
backup_active = 0
backup = 0.0.0.0
heartbeat = 1
heartbeat_port = 539
keepalive = 6
deadtime = 18
network = nat
nat_router = 192.168.70.254 eth1
debug_level = NONE
virtual [server_coolh] {
active = 1
address = 211.144.137.131 eth0:1
vip_nmask = 255.255.255.224
fwmark = 81
port = 80
send = "GET / HTTP/1.0\r\n\r\n"
expect = "HTTP"
use_regex = 0
load_monitor = none
scheduler = wlc
protocol = tcp
timeout = 12
reentry = 30
quiesce_server = 0
server [node01] {
address = 192.168.70.11
active = 1
weight = 1
}
server [node02] {
address = 192.168.70.21
active = 1
weight = 1
}
server [node03] {
address = 192.168.70.31
active = 1
weight = 1
}
server [node04] {
address = 192.168.70.41
active = 1
weight = 1
}
server [node05] {
address = 192.168.70.51
active = 1
weight = 1
}
server [node06] {
address = 192.168.70.61
active = 1
weight = 1
}
}
virtual [server_ccg] {
active = 1
address = 211.144.137.132 eth0:2
vip_nmask = 255.255.255.224
fwmark = 82
port = 80
send = "GET / HTTP/1.0\r\n\r\n"
expect = "HTTP"
use_regex = 0
load_monitor = none
scheduler = wlc
protocol = tcp
timeout = 12
reentry = 30
quiesce_server = 0
server [node01] {
address = 192.168.70.12
active = 1
weight = 1
}
server [node02] {
address = 192.168.70.22
active = 1
weight = 1
}
server [node03] {
address = 192.168.70.32
active = 1
weight = 1
}
server [node04] {
address = 192.168.70.42
active = 1
weight = 1
}
server [node05] {
address = 192.168.70.52
active = 1
weight = 1
}
server [node06] {
address = 192.168.70.62
active = 1
weight = 1
}
}
virtual [server_bbs] {
active = 1
address = 211.144.137.133 eth0:3
vip_nmask = 255.255.255.224
fwmark = 83
port = 80
send = "GET / HTTP/1.0\r\n\r\n"
expect = "HTTP"
use_regex = 0
load_monitor = none
scheduler = wlc
protocol = tcp
timeout = 12
reentry = 30
quiesce_server = 0
server [node01] {
address = 192.168.70.13
active = 1
weight = 1
}
server [node02] {
address = 192.168.70.23
active = 1
weight = 1
}
server [node03] {
address = 192.168.70.33
active = 1
weight = 1
}
server [node04] {
address = 192.168.70.43
active = 1
weight = 1
}
server [node05] {
address = 192.168.70.53
active = 1
weight = 1
}
server [node06] {
address = 192.168.70.63
active = 1
weight = 1
}
}
virtual [server_download] {
active = 1
address = 211.144.137.134 eth0:4
vip_nmask = 255.255.255.224
fwmark = 84
port = 80
send = "GET / HTTP/1.0\r\n\r\n"
expect = "HTTP"
use_regex = 0
load_monitor = none
scheduler = wlc
protocol = tcp
timeout = 12
reentry = 30
quiesce_server = 0
server [node01] {
address = 192.168.70.14
active = 1
weight = 1
}
server [node02] {
address = 192.168.70.24
active = 1
weight = 1
}
server [node03] {
address = 192.168.70.34
active = 1
weight = 1
}
server [node04] {
address = 192.168.70.44
active = 1
weight = 1
}
server [node05] {
address = 192.168.70.54
active = 1
weight = 1
}
server [node06] {
address = 192.168.70.64
active = 1
weight = 1
}
}
virtual [server_wlife] {
active = 1
address = 211.144.137.135 eth0:5
vip_nmask = 255.255.255.224
fwmark = 85
port = 80
send = "GET / HTTP/1.0\r\n\r\n"
expect = "HTTP"
use_regex = 0
load_monitor = none
scheduler = wlc
protocol = tcp
timeout = 12
reentry = 30
quiesce_server = 0
server [node01] {
address = 192.168.70.15
active = 1
weight = 1
}
server [node02] {
address = 192.168.70.25
active = 1
weight = 1
}
server [node03] {
address = 192.168.70.35
active = 1
weight = 1
}
server [node04] {
address = 192.168.70.45
active = 1
weight = 1
}
server [node05] {
address = 192.168.70.55
active = 1
weight = 1
}
server [node06] {
address = 192.168.70.65
active = 1
weight = 1
}
}
4 启动lvs服务
lvs
5 状态查看
Ipvsadm
RAM 最低256M
2 网络需求
所有GFS节点必须接入TCP/IP网络,以便于支持GFS集群和lockgulm系统
3 设备支持
HBA (Host Bus Adapter)
Fibre Channel switch
FC RAID array or JBOD
Size 最大2 TB