mesos级别健康检查测试
[if !supportLists]1、[endif]测试组件版本信息
旧环境 新环境
Zookeeper:3.4.6zookeeper:3.4.6
Mesos:1.0.1mesos:1.4.2
Marathon:1.1.1marathon:1.4.12
[if !supportLists]2、[endif]健康检查协议简介
应用健康检查支持以下几种协议:http、https、tcp、command、mesos_http、mesos_tcp、mesos_https。
其中http、https、tcp属于marathon级别健康检查,这些协议的配置会在marathon的leader上执行。mesos_http、mesos_https、mesos_tcp、command属于mesos级别健康检查,这些健康检查会在启动服务的mesos代理节点上执行。
参考文档:https://github.com/mesosphere/marathon/blob/v1.3.6/docs/docs/health-checks.md
[if !supportLists]3、[endif]测试过程
首先于新旧环境marathon创建相同应用,健康检查方式同样使用marathon级别的http健康检查。mesos-salve节点使用curl -i ip:port/path 有正常的200状态吗返回,且marath应用显示绿色健康状态,此时说明启动的应用可以正常访问,且都是使用的marathon级别的http健康检查。
旧环境测试:
初始healthcheck信息如下:
{
"gracePeriodSeconds": 300,
"intervalSeconds": 60,
"timeoutSeconds": 20,
"maxConsecutiveFailures": 3,
"portIndex": 0,
"path": "/test/ok.html",
"protocol": "HTTP",
"ignoreHttp1xx": false
}
在marathon的web界面,找到对用的应用,点击“Configuration”之后点击“Edit”使用“json mode”对应用的healthcheck信息进行编辑。将protocol的“HTTP”更改为“MESOS_HTTP”后点击“change and deploy configuration”之后报错,错误信息如下。
There was problem with your configuration
·general:MESOS_HTTP is not a valid protocol
可见该版本不能够支持mesos级别的应用健康检查。
新环境测试:
初始healthcheck信息如下:
{
"gracePeriodSeconds": 300,
"intervalSeconds": 60,
"timeoutSeconds": 20,
"maxConsecutiveFailures": 3,
"portIndex": 0,
"path": "/test/ok.html",
"protocol": "HTTP",
"ignoreHttp1xx": false
}
在marathon的web界面,找到对用的应用,点击“Configuration”之后点击“Edit”使用“json mode”对应用的healthcheck信息进行编辑。将protocol的“HTTP”更改为“MESOS_HTTP”后点击“change and deploy configuration”可以正常保存。
4、故障及排查
问题1:新环境创建marathon级别的http健康检查应用,应用运行在2分钟左右,mesosagent日志报错,且会kill掉健康的应用,导致应用启动一直失败。具体报错信息如下:
Failed to update resources for container 3423da5245-asda2 of executor ‘dcos_test-less-memory.wewq2123df’running task dcos_test-less-memory.wewq213df on status update for terminal task destroying container:failed to determine cgroup for the ‘cpu’ subsystem:failed to read /proc/2754/cgroup:failed to open file :no such file or directory
处理办法:mesosslave启动脚本添加--pid=host \,重新构建mesosslave容器,发布应用后故障排除。
问题二:protocol更改为MESOS_HTTP后,应用持续显示不健康状态,查看mesosslave节点的stderr日志,有以下报错信息:
F0424 15:54:56.739850 28881 checker_process.cpp:114] failed to enter the net namespace of task (pid 28733):failed to open ‘/proc/28733/ns/net’:Permission denied
处理办法:mesosslave启动脚本添加--privileged \,重新构建mesosslave容器,发布应用后故障排除。