My EC2 server instance is running on a infinite loop in PHPU. How do I stop it?
My server is running on 100% CPU. I开发者_如何学JAVAt is running on a infinite loop in PHP how do I kill the loop? can I reboot without loosing any data?
Using the AWS Console 'Reboot Instance' option will, unsurprisingly, reboot the VM. Presupposing that your looping process is not set to auto-start on boot, you'll regain control of the VM. You will not lose any persisted data (i.e. committed to the disk) but you may well lose any transient data that the process was working on when it was killed during the reboot (e.g. unflushed write buffers).
It makes no difference whether the dataset is on the instance ephemeral storage (the boot volume) or another EBS volume - reboot does not clear these down. Note that if you Terminate the instance instead and re-instantiate it, you'll lose any data on the ephemeral volume (but not on attached EBS - this gets detached during the termination and you can re-attach it to the new instance).
Good practice: regular volume snapshots of any attached data volumes, and routine of stop/snapshot/restart on your VM will let you back-up your ephemeral volume too.
Reboot it using the AWS console
Use ps aux
to list out your processes (ps aux | grep php
should filter your php script assuming you starting from CLI) Find the process id (pid) of the script that's causing this issue and issue a kill <pid>
to kill it.
精彩评论