CentOS virtual memory (swap) tutorial

Source: Internet
Author: User
Tags memory usage mysql in centos

I didn't expect Alibaba Cloud hosts to have no swap partition, but is it difficult to buy large memory hosts?
Mysql5.6.27 cannot run on an ECS instance of M. This problem has plagued me for a long time.

At first, no error is reported when mysql is started, but it cannot be started. After the host is restarted, an error message is reported.
The error message is a memory allocation error, as shown below:

15:18:23 1773 [Note] InnoDB: Initializing buffer pool, size = 128.0 M
InnoDB: mmap (137363456 bytes) failed; errno 12
15:18:23 1773 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
15:18:23 1773 [ERROR] Plugin 'innodb' init function returned error.
15:18:23 1773 [ERROR] Plugin 'innodb' registry as a storage engine failed.
15:18:23 1773 [ERROR] Unknown/unsupported storage engine: InnoDB
15:18:23 1773 [ERROR] Aborting


It seems that the memory is insufficient. Try to adjust innodb_buffer_pool_size = 64 M of mysql in my. cnf.

Whether innodb_buffer_pool_size is adjusted to a large value, it is Cannot allocate memory for the buffer pool.
Unexpectedly, only the last trick was to increase the virtual memory, that is, swap partition.
At first, use the free command to view the memory usage.
Free command

After frequent adjustments, it is as follows:


How to adjust it? The procedure is as follows:

# Dd if =/dev/zero of =/swap. data bs = 1 M count = 1024
# Mkswap/swap. data
# Swapon/swap. data
Now, we can configure the partition information to the fstab file to enable auto-start.
# Vi/etc/fstab
Add the following line:
/Swap. data swap defaults 0 0

Related Article

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.