xinetd 的配置没有讲

来源:6-6 Haproxy部署详解

菜鸟精髓

2018-10-18

10:40秒那和前一秒没有连接上,10:40秒直接跳到了service.xml ,上一秒还在安装呢。被剪掉了么????????

写回答

1回答

sqlercn

2018-10-18

我和慕课网的人反馈一下看看是什么情况.为了不影响学习,先把相关的配置方法提供给你。

[root@node1 haproxy]# yum install xinetd -y

[root@node1 log]# vi /etc/xinetd.d/mycatchk

service mycatchk

{

flags = REUSE

socket_type = stream

port = 48700

wait = no

user = root

server =/usr/local/bin/mycat_status

log_on_failure += USERID

disable = no

}

###########################################

#增加/usr/local/bin/mycat_status脚本

#########################################

#!/bin/bash

#/usr/local/bin/mycat_status

# This script checks if a mycat server is healthy running on localhost. It will

# return:

#

# "HTTP/1.x 200 OK\r" (if mycat is running smoothly)

#

# "HTTP/1.x 503 Internal Server Error\r" (else)

mycat=`/usr/local/mycat/bin/mycat status |grep 'not running'| wc -l`

if [ "$mycat" = "0" ];

then

    /bin/echo -en "HTTP/1.1 200 OK\r\n" 

    /bin/echo -en "Content-Type: text/plain\r\n" 

    /bin/echo -en "Connection: close\r\n" 

    /bin/echo -en "Content-Length: 40\r\n" 

    /bin/echo -en "\r\n" 

    /bin/echo -en "MyCAT  Cluster Node is synced.\r\n" 

    exit 0

else

    /bin/echo -en "HTTP/1.1 503 Service Unavailable\r\n" 

    /bin/echo -en "Content-Type: text/plain\r\n" 

    /bin/echo -en "Connection: close\r\n" 

    /bin/echo -en "Content-Length: 44\r\n" 

    /bin/echo -en "\r\n" 

    /bin/echo -en "MyCAT Cluster Node is not synced.\r\n" 

    exit 1

fi

#########################################################

#在/etc/services中加入mycat_status服务

######################################################

[root@node1 bin]# vi /etc/services 

mycatchk        48700/tcp               # mycat check

#重启xinetd服务

centos6:[root@node1 bin]# service xinetd restart

centos7:[root@node1 bin]# systemctl restart xinetd

#验证mycatchk服务是否启动成功

[root@node1 bin]# netstat -nltp | grep 48700

#在node1节点绑定VIP

[root@node1 bin]# ifconfig eth0:1 10.102.13.248/24

#启动haproxy

[root@node1 xinetd.d]# haproxy -f /etc/haproxy/haproxy.cfg 

#测试通过haproxy连接MyCAT

[root@node3 ~]# mysql -uroot -p -h10.102.13.248 -P8096 


0
4
sqlercn
回复
自由邪帝
mycat_status是一个shell脚本,可以通过课程的git下载
2020-01-03
共4条回复

MyCAT+MySQL搭建高可用企业级数据库集群

国内顶级DBA亲授,精讲企业级MyCAT应用

816 学习 · 223 问题

查看课程