基于 Dubbo 的分布式系统架构视频教程
龙果学院 http://www.roncoo.com ,作者:吴水成
3
龙果学院:http://www.roncoo.com ,微信公众号:RonCoo_com
六、配置 MyCat 状态检查服务(在 MyCat 节点主机上配置)
MyCat 服务主机(edu-mycat-01、edu-mycat-02)上需要增加 mycat 服务的状态检测脚本,并开放相
应的检测端口,以 提供给 HAProxy 对 MyCat 的服务状态进行检测判断。可 以使用 xinetd 来实现,通过 xinetd,
HAProxy 可以用 httpchk 来检测 MyCat 的存活状态。(xinetd 即 extended internet daemon,xinetd 是新
一代的网络守护进程服务程序,又叫超级 Internet 服务器。经常用来管理多种轻量级 Internet 服务。
xinetd 提供类似于 inetd+tcp_wrapper 的功能,但是更加强大和安全。xinetd 为 linux 系统的基础服务)
1、如果 xinetd 还没有安装,可使用如下命令安装:
# yum install xinetd
2、检查/etc/xinetd.conf 的末尾是否有 includedir /etc/xinetd.d ,没有就加上
# vi /etc/xinetd.conf
3、检查 /etc/xinetd.d 目录是否存在,不存在刚创建
# mkdir /etc/xinetd.d/
4、增加 MyCat 存活状态检测服务配置
# touch /etc/xinetd.d/mycat_status
# vi /etc/xinetd.d/mycat_status
增加以下内容:
service mycat_status
{
flags = REUSE
## 使用该标记的 socket_type 为 stream,需要设置 wait 为 no
socket_type = stream ## 封包处理方式,Stream 为 TCP 数据包
port = 48700 ## 服务监听端口
wait = no ## 表示不需等待,即服务将以多线程的方式运行
user = root ## 执行此服务进程的用户
server =/usr/local/bin/mycat_status ## 需要启动的服务脚本
log_on_failure += USERID ## 登录失败记录的内容
disable = no ## 要启动服务,将此参数设置为 no
}