After building the HeartBeat, I found that Nginx and VIP can’t start normally.

Introduction to the problem

After setting up heartbeat and running, I found that nginx and VIP cannot start normally. After checking the log, I found that nginx has been started but then stopped. I think through the error on the error log After a long time, I found that port 80 was occupied when I restarted nginx. Then I checked the process and found that port 80 was occupied by tomcat. After stopping tomcat and restarting the heartbeat service, I found that the problem was solved. Through this matter, we must learn from future studies and work. Be careful, don’t reduce work efficiency due to low-level mistakes! At the same time, it also shows that I have insufficient experience, so I have to study hard in the future!

[root@webserver 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]]#ps aux|grep nginx //Found that nginx did not start
root 13813 0.0 0.0 5980 748 pts/1 S+ 22:47 0:00 grep nginx

[[email protected]]# ifconfig //Mobile IP also No
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
r: fe 20c:29ff:fee6:9edf/64 Scope: Link
UP BROADCAST RUNNING MULTICAST MTU: 1500 Metric:1 RX packets: 3960 errors:0 dropped:0 overruns:0 3154 errors:0dropped:0overruns:0carrier:0
collisions:0 txqueuelen:1000
RXbytes:361574(353.0KiB)TXbytes:1111055(1.0MiB)
dress: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.25
: Fe80::20c:29ff:fee6:9ee9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RXpackets:14294errors:0dropped:0overruns:0overruns > TX packets: 15011 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RXbytes:2645965(2.5MiB)728BTXbyte Inet addr: 127.0.0.1 Mask: 255.0.0.0
Inet6 addr: UP: 1/128 Scope inet6 addr: UP: 1/128 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
0 txqueuelen:0
RX bytes:155375 (151.7KiB)TX byte s:155375 (151.7 KiB)

[root@webserver~]#less /var/log/ha-log //Check the log and find that the nginx service has started and stopped

< p>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

p>

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]]# service nginx start //First start nginx and find the port number is occupied
Starting 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: Ad dress already in use)
nginx: [emerg]still could not bind()
check[website][website][website][website][website][website][http://www.cn-articles.com the port number is jdk to occupy
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

[root @ webserver ha.d] # ps aux | grep tomcat // find tomcat is running
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/loc al/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 0.0 5980 748 pts/ 1 S+ 23:14 0:00 grep tomcat

[root@webserver Ha.d]# service tomcat stop //Stop tomcat
UsingCATALINA_BASE:/usr/local/tomcat
UsingCATALINA_HOME : /Usr/local/tomcat
UsingCATALINA_TMPDIR: /usr/local/tomcat/temp
UsingJRE_HOME:/usr/local/jdk1.8.0_45
Using CLASSPATH:cat/local/tom/usr/local/tom /bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar

[[email protected]]#/etc/init.d/heartbeatrestart //Restart the service
Stopping High-Availability services: Done.

Waiting to allow resource takeover to complete:Done.

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

[[email protected]]#ps aux|grep nginx //nginx starts normally
root 15707 0.0 0.1 15668 1216 Ss 23:16 0:00 nginx: x masters bin process/us -c /etc/nginx/ngin x.conf
nginx 15709 0.0 0.1 15824 1796 pt 23:16 0:00 nginx: worker process 0: 0 748 rep 23: 16 s 15 + 0.0 br> root 0 rep: 5 0.0 @webserverha.d]# ifconfig //Mobile IP also appears 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.25 t add: 192.168.1.255 Mask: 255.255.25 fe80::20c:29ff:fee6:9edf/64 Scope: Link UP BROADCAST RUNNING MULTICAST MTU: 1500 RX packets: 5436 errors: 0 380 drops: 0 ped 0 overruns: 0 frame:0 4 dropped:0 overruns:0 0 overruns:0 carrier:0collisions:0txqueuelen:1000RXbytes:499152(487.4KiB)TXbytes:1788479(1.7MiB)Ethernet:19BaseAddress:0x2000Ethernet:29EthLink:19BaseAddress:0x2000 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:LinkICAUP RUNBULTM RO ST MTU: 1500 Metric: 1 RX packets: 16351 errors: 0 dropped:0 overruns:0 frame:0 TX packets: 17077 errors:0 dropped:0 overruns:0collisions:0 788bytes( 303 RX: 21000bytes: 21000 2.8 MiB TX bytes: 3121711 (2.9 MiB) Interrupt: 19 Base address: 0x2080 eth1:0 Link encap:Ethernet HWaddr 00:0C:29:E6:9E:E9 addMask:0.0.10Mask:0.0.10. 255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU: 1500 Metric: 1 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: 635 errors: 0 dropped:0 overruns:0 frame:0 TX packets: 635 errors:0 dropped:0 overruns:0 carriers:0 157bytes:0 txqueries:0 153.5 KiB) TX bytes: 157199 (153.5 KiB)

Leave a Comment

Your email address will not be published.