使用iRules在F5 LTM上实现根据不同时间段选择不同资源池
2017-10-09 11:59
986 查看
when RULE_INIT {
array set static::timerange {
Sunday {}
Monday {"08:30:01" "14:00"}
Tuesday {"08:30:01" "14:00"}
Wednesday {"08:30:01" "14:00"}
Thursday {"08:30:01" "14:00"}
Friday {"08:30:01" "14:00"}
Saturday {}
}
}
when HTTP_REQUEST {
set now [clock seconds]
set current_day [clock format $now -format {%A}]
set start [lindex $static::timerange($current_day) 0]
set end [lindex $static::timerange($current_day) 1]
if {($start ne "") && ($end ne "") && ($now >= [clock scan $start]) && ($now < [clock scan $end])} {
set worktime 1
} else {set worktime 1 }
unset start end
if {$worktime } {
if {[active_members pool www-Silo2Master] > 0} {
pool pool www-Silo2Master
} else {pool www-Silo1Master}
} else {
if {[active_members pool www-Silo1Master] > 0} {
pool pool www-Silo1Master
} else {pool www-Silo1Master}
}
}
https://devcentral.f5.com/questions/irule-help-46614
array set static::timerange {
Sunday {}
Monday {"08:30:01" "14:00"}
Tuesday {"08:30:01" "14:00"}
Wednesday {"08:30:01" "14:00"}
Thursday {"08:30:01" "14:00"}
Friday {"08:30:01" "14:00"}
Saturday {}
}
}
when HTTP_REQUEST {
set now [clock seconds]
set current_day [clock format $now -format {%A}]
set start [lindex $static::timerange($current_day) 0]
set end [lindex $static::timerange($current_day) 1]
if {($start ne "") && ($end ne "") && ($now >= [clock scan $start]) && ($now < [clock scan $end])} {
set worktime 1
} else {set worktime 1 }
unset start end
if {$worktime } {
if {[active_members pool www-Silo2Master] > 0} {
pool pool www-Silo2Master
} else {pool www-Silo1Master}
} else {
if {[active_members pool www-Silo1Master] > 0} {
pool pool www-Silo1Master
} else {pool www-Silo1Master}
}
}
https://devcentral.f5.com/questions/irule-help-46614
相关文章推荐
- 通过F5 LTM iRule实现根据URL进行流量分发
- try{}catch(){}//根据异常信息使用不同的方法要怎么实现
- table+webusercontrol实现左边treeview,右边根据节点选择不同加载不同页面
- 使用Maven的Profile实现根据不同环境选用不同配置
- ASP.NET提示框,且根据用户选择执行不同代码的实现
- 前端控制器是整个MVC框架中最为核心的一块,它主要用来拦截符合要求的外部请求,并把请求分发到不同的控制器去处理,根据控制器处理后的结果,生成相应的响应发送到客户端。前端控制器既可以使用Filter实现(Struts2采用这种方式),也可以使用Servlet来实现(spring MVC框架)。
- 通过F5 LTM iRule实现根据URL进行流量分发
- 使用Flash Professional CS5.5实现不同源文件之间库资源共享
- 使用 根据语言环境不同 而显示不同的 资源本地化 ASP.NET 网页
- 使用 根据语言环境不同 而显示不同的 资源本地化 ASP.NET 网页
- 在MFC GridCtrl中使用CGridCellCheck类根据GetCheck()状态做不同处理的实现
- 怎样根据使用环境需求来选择不同参数的光模块
- SpringMVC之ContentNegotiatingViewResolver实现根据请求资源名选择视图
- python-如何根据用户选择实现不同函数功能
- html <select> <option> 实现根据选择不同的option,调用不同的方法功能
- vbscript实现的根据不同时间段显示不同的欢迎语
- 根据用户的选择输出不同的结果--函数指针的使用
- 使用Maven的Profile实现根据不同环境选用不同配置
- 在MFC GridCtrl中使用CGridCellCheck类根据GetCheck()状态做不同处理的实现
- [代码结构设计]根据不同条件使用不同实现类的业务代码设计