Whether the mysql-PHP machine is online or not.

Source: Internet
Author: User
There are machines. PHP is used as the backend. when the machine is started, it will access the server. At this time, the status is set to "online", but the server will not be accessed because many machines are directly powered off, in this case, how can we modify the machine status? There are machines. PHP is used as the backend. when the machine is started, it will access the server. At this time, the status is set to "online", but the server will not be accessed because many machines are directly powered off, in this case, how can we modify the machine status?

Reply content:

There are machines. PHP is used as the backend. when the machine is started, it will access the server. At this time, the status is set to "online", but the server will not be accessed because many machines are directly powered off, in this case, how can we modify the machine status?

When the machine is running, it regularly sends a heartbeat packet to the background, telling the background that I am still online. The background checks the heartbeat packet once every time and treats the machine that has not received the heartbeat packet as offline, I wonder if this will meet your needs.

(1) Offline Detection: open a crontab on the server, Poll and send ping packets to the machine list at intervals of time, and set the dropped machine to offline.
(2) Real-Time Detection: if the background is only used to show whether the machine is still online, you can send a ping packet to check whether the machine is online when displaying the machine list. This method can only meet the requirement of displaying whether the machine is online in real time and has performance problems.

Make a regular round robin!

You can use socket.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.