Mysql-php realize whether the machine is online or not.

Source: Internet
Author: User
There are machines, PHP do the backstage, the machine will access the server when booting, this time will be the status of "on-line", but the offline because a lot of machines are direct power outages, so do not access the background, so how to modify the state of the machine?

Reply content:

There are machines, PHP do the backstage, the machine will access the server when booting, this time will be the status of "on-line", but the offline because a lot of machines are direct power outages, so do not access the background, so how to modify the state of the machine?

Machine in operation, regularly send the background heartbeat packet, tell the backstage I also online, backstage every time to do a check, the seizure to the heartbeat packet machine as offline processing, do not know whether this can meet your needs

(1) Offline detection: On the service side open a crontab, every once in a while to the machine list polling to send a ping packet, and then put off the line of the machine into the offline state.
(2) Real-time detection: If the background is only used to show whether the machine is still online status, you can display the machine list, the real-time ping packet detection machine is online. This approach only satisfies the need for real-time display of machines online and has performance issues.

Make a regular poll!

You can use the 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.