我的Solr / Jetty在Ubuntu 12.04上运行良好。 我试图连接我的监视器来监视它,但连接到服务时遇到问题。
我有在端口8983上运行的Solr,可以通过http://localhost:8983/solr/连接,但是无法通过localhost , 127.0.0.1或0.0.0.0在我的监视configuration文件中连接。
Monit conf文件:
check process solr with pidfile "/var/run/jetty.pid" start program = "/usr/sbin/service jetty start" stop program = "/usr/sbin/service jetty stop" if failed host 127.0.0.1 port 8983 protocol http then restart if totalmem is greater than 7268 MB for 10 cycles then restart if 5 restarts within 5 cycles then timeout
用netstat:
root@ip-10-110-37-29:~# netstat -lnp | grep 8983 tcp 0 0 0.0.0.0:8983 0.0.0.0:* LISTEN 16033/java
我已经尝试了不同的排列, if failed线路,但总是在我的日志中得到以下monit错误:
'solr' failed, cannot open a connection to INET[localhost:8983] via TCP
我在这里做错了什么?
我相信问题在于,新的(er)Solrnetworking接口使用了大量的Javascript和其他redirect,这可能是基本的monit http检查器无法处理的。 原来在http://localhost:8983/admin/ping有一个特殊页面,或者在我的多核设置中, http://localhost:8983/solr/<MY_COLLECTION_NAME>/admin/ping
docker启动延误也存在一个问题。 我使用monit来启动docker,在docker启动并能够响应之前马上检查并重新启动。 由于我的周期时间太短(10),docker停止计划命令是在docker开始之前运行的!
所以,向前迈进,我通过在安装monit脚本之前自行启动jetty服务器来解决这个问题,然后调整monit脚本以便在失败的http连接上重新启动的次数减less:
check process solr with pidfile "/var/run/jetty.pid" start program = "/usr/sbin/service jetty start" stop program = "/usr/sbin/service jetty stop" if failed host localhost port 8983 protocol http and request "/solr/<MY_COLLECTION_NAME>/admin/ping" for 3 cycles then restart if totalmem is greater than 1024 MB for 15 cycles then restart if 5 restarts within 15 cycles then timeout