Using Power cycle for restart my droplet

November 1, 2015 6.8k views
DigitalOcean WordPress

If i restart my droplet, whether my database will be lost?

3 Answers

Use reboot through SSH to give it a soft reboot.

@hasayoume141 - The best way to issue a restart/reboot is to do so through the CLI. You can use reboot or the shutdown command to perform this task. You won't lose your database as a result of a restart/reboot, though the potential for corruption exists, especially if there's reading / writing taking place at the time of action (which can also result in incomplete writes). The best thing to do would be to shutdown services prior to shutting down or rebooting to ensure that reading & writing isn't taking place at the time the system finally goes down as a result of the command.

@jtittle would killall command shut down all running process then would be safe to reboot?

  • @aljuaid86

    I apologize for the delay! Hopefully you have this taken care of already, though if it's still up in the air, I wouldn't run killall unless the process simply won't die, or it needs to be killed now (i.e. runaway process that is consuming too much CPU/RAM and needs to be force-stopped).

    When you run the command to shut down the VPS, the service manager will attempt to shut them down as quickly as possible. In some cases, a service shutdown request can hang and delay the remaining service shutdowns in queue.

    The best course of action would be to simply shut down any service that needs to be prior to powering down.

    i.e

    service mysql stop
    

    or

    systemctl stop mysql
    

    That'll do a proper shutdown according to the method(s) in the script designed to perform the action. Once done, that will prevent further requests from being served from that service.

Have another answer? Share your knowledge.