搭建heartbeat运行后发现nginx及VIP不能正常启动

时间:16-07-07 来源: 作者: 点击:

搭建heartbeat运行后发现nginx及VIP不能正常启动

问题简介

搭建heartbeat运行后发现nginx及VIP不能正常启动,在查看日志后发现nginx已经启动了但是随后有停止了,通过错误日志上的错误我想了半天在重启nginx时发现80端口被占用,随后查看进程发现tomcat占用了80端口,在停止掉tomcat后并重启heartbeat服务后发现问题解决,通过这件事要学习到今后学习及工作中一定要细心,不要因为低级的错误导致工作效率的降低!同时也说明了自己的经验不足,所以在以后的日子还要努力学习!

[[email protected] ha.d]# /etc/init.d/heartbeat restart
Stopping High-Availability services: Done.

Waiting to allow resource takeover to complete:Done.

Starting High-Availability services: INFO: Resource is stopped
Done.

[[email protected] ha.d]# ps aux |grep nginx //发现nginx没有启动
root 13813 0.0 0.0 5980 748 pts/1 S+ 22:47 0:00 grep nginx

[[email protected] ha.d]# ifconfig //流动IP也没有出现
eth0 Link encap:Ethernet HWaddr 00:0C:29:E6:9E:DF
inet addr:192.168.1.111 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fee6:9edf/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3960 errors:0 dropped:0 overruns:0 frame:0
TX packets:3154 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:361574 (353.0 KiB) TX bytes:1111055 (1.0 MiB)
Interrupt:19 Base address:0x2000

eth1 Link encap:Ethernet HWaddr 00:0C:29:E6:9E:E9
inet addr:192.168.217.111 Bcast:192.168.217.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fee6:9ee9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:14294 errors:0 dropped:0 overruns:0 frame:0
TX packets:15011 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2645965 (2.5 MiB) TX bytes:2728129 (2.6 MiB)
Interrupt:19 Base address:0x2080

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:601 errors:0 dropped:0 overruns:0 frame:0
TX packets:601 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:155375 (151.7 KiB) TX bytes:155375 (151.7 KiB)

[[email protected] ~]# less /var/log/ha-log //查看日志发现nginx服务启动了又停止了

ResourceManager(default)[14554]: 2015/06/08_23:09:43 info: Running /etc/ha.d/resource.d/IPaddr 192.168.1.110/24/eth1:0 start

IPaddr(IPaddr_192.168.1.110)[14710]: 2015/06/08_23:09:43 INFO: Adding inet address 192.168.1.110/24 to device eth1 (with label eth1:0)

IPaddr(IPaddr_192.168.1.110)[14710]: 2015/06/08_23:09:43 INFO: Bringing device eth1 up

IPaddr(IPaddr_192.168.1.110)[14710]: 2015/06/08_23:09:43 INFO: /usr/libexec/heartbeat/send_arp -i 200 -r 5 -p /var/run/resource-agents/send_arp-192.168.1.110 eth1 192.168.1.110 auto not_used not_used

/usr/lib/ocf/resource.d//heartbeat/IPaddr(IPaddr_192.168.1.110)[14684]: 2015/06/08_23:09:43 INFO: Success

ResourceManager(default)[14554]: 2015/06/08_23:09:43 info: Running /etc/init.d/nginx start

ResourceManager(default)[14554]: 2015/06/08_23:09:46 ERROR: Return code 1 from /etc/init.d/nginx

ResourceManager(default)[14554]: 2015/06/08_23:09:46 CRIT: Giving up resources due to failure of nginx

ResourceManager(default)[14554]: 2015/06/08_23:09:46 info: Releasing resource group: webserver 192.168.1.110/24/eth1:0 nginx

ResourceManager(default)[14554]: 2015/06/08_23:09:46 info: Running /etc/init.d/nginx stop

ResourceManager(default)[14554]: 2015/06/08_23:09:46 info: Running /etc/ha.d/resource.d/IPaddr 192.168.1.110/24/eth1:0 stop

[[email protected] ha.d]# service nginx start //首先启动nginx发现端口号被占用
正在启动 nginx:nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
[失败]

[[email protected] ha.d]# netstat -lnp |grep 80 //查看到端口号被jdk给占用
tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 1224/java
tcp 0 0 :::8009 :::* LISTEN 1224/java
tcp 0 0 :::80 :::* LISTEN 1224/java

[[email protected] ha.d]# ps aux |grep tomcat //发现tomcat正在运行
root 1224 0.3 5.6 342016 57900 ? Sl 19:28 0:53 /usr/local/jdk1.8.0_45/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat/endorsed -classpath /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start
root 15050 0.0 0.0 5980 748 pts/1 S+ 23:14 0:00 grep tomcat

声明:本文转载于网络,文章链接:http://www.nd9p.com/3705.html