In this post I will share my feelings on working with the virtualization system OpenVZ. Since I have little experience as an administrator, I first met OpenVZ when I came to work at
centos-admin.ru . Previously, I had the opinion that such systems are used mainly as part of hosting providers, but as it turned out, virtualization is very useful in the daily work of the system administrator.
')
What is OpenVZ
Some material from Wikipedia to understand what is at stake.
OpenVZ - implementation of virtualization technology at the operating system level, which is based on the Linux kernel. OpenVZ allows you to run multiple, isolated copies of the operating system called Virtual Private Servers (VPS) or Virtual Environments (VE) on a single physical server.
OpenVZ consists of a modified Linux kernel and user tools.
It is believed that virtualization adds significant overhead resources, but due to the fact that OpenVZ is only a kernel add-on, if you do not specifically limit the resources, the difference between the physical server and the VPS container is almost imperceptible.
Case on the example of our client 101XP
How long will it take to run 5-10 physical servers, each of which will have 2-3 containers with different software without using virtualization? Working on the tasks of our client, the international publisher of gaming applications
101XP , I am in one hand doing this volume in 1 day. Of course, there are all sorts of chef and puppet, but there is not always time and resources to configure and debug them.
Activity in social games either grows rapidly or, on the contrary, decreases, which requires the constant addition or removal of new sites, and OpenVZ gives you tremendous flexibility. For example, just a few days after the launch of the game “Favorite” licensed in Russia on Odnoklassniki, traffic increased to 195000 DAU (Daily Active Users), and the use of virtualization made it possible to quickly add new capacities.
Expanding containers from a template
The first thing that I noticed is the simplicity of container deployment: just copy the ready container template to the physical server, set the ip and hostname in the configuration file and the server is almost ready to work. For different types of servers (web, database, etc.) you can prepare your own container templates, which also saves a lot of time.
Copy / Move Containers
For large, scalable projects, it is often necessary to duplicate an identical container on another physical server. It is enough to copy the container using rsync (it is important to specify the --numeric-ids key so that the rights are not confused inside the container). Copy the container files, the vz.conf configuration file, in which we write the new ip and hostname. New container is ready to go!
Local and remote backups
Another important plus: from a physical machine (if you do not use ploop), containers are ordinary folders with the structure of the operating system. It is very convenient to make a backup of the entire container, either locally or remotely, directly “to the hot” (or with chkpnt). In the future, it will not be difficult to deploy from backup both the entire virtual machine and individual files.
Conclusion
Use virtualization - it allows the sysadmin to sleep soundly at night. After all, even if your server is completely burned, you can quickly restore the project from a remote backup.