
SQL Database you often suddenly collapsed and you have to up the manual? Is Clamav scanner running on your server fails? It could be because your server is less ram hehehe. Maybe this is a sign you need to upgrade to a server with a spec on it. But if your wallet is still not given the green light, then the solution is to create a swap file.
Some VPS provider does not provide Swap, for example Digitalocean. If you check with the command free -m seen Swap is zero which means no swap.
You can also use a spell check with swapon -s and if there is no output then swap is not enabled alias does not exist on the server page. If there is no Swap and you lack the ram while frequent application crashes, the database down, etc ... So make the swap. It's super easy
- Login to your server terminal
- Run the command: dd if = / dev / zero of = / swap.file bs = 1024 count = 1024K (this is an example of command if your server ram is 512 and you want to create a 1GB swap. As a great record Swap is 2x ram server. Change 1024K if you want to make a swap with other sizes)
- waiting
- Now create a swap file mkswap /swap.file
- Turn swapon /swap.file
- Give permission chmod 0600 /swap.file
- Setup swapiness sysctl vm.swappiness = 10 (The magnitude of the number 10 here is the level of usage rate swaps by the server. The greater the -maks 100- then the server will be more diligent use Swap. Recommended is 10 only)
- Now edit the fstab file vim / etc / fstab
- Add this line to the bottom of the course: /swap.file swap swap defaults 0 0
- Finished! Now swap is activated and you can check back with spells swapon -s or free -m above.
Congratulations ... you now own server Swap. So, if you have often less ram which resulted in the cessation of SQL databases, etc., then the presence of these swap things mentioned above will not occur. At least this that I have ever experienced at a droplet 512 that I use.



No comments:
Post a Comment