Configure bare devices for Linux udev and MySQL InnoDB shared tablespace

Source: Internet
Author: User
(1) udev Basics

Udev can manage files stored in the/dev directory. Files are generated only after the device is connected, and are automatically deleted after the device is pulled out.
It also allows you to add rules to modify the default name and permissions in/dev, and save the rules in the/etc/udev/rules. d/directory.


(2) bind MySQL to a bare Device

Only InnoDB can use bare Devices

Advantage: with the file system bypassed, the read/write speed will be improved, data will be safer, the file system burden will be reduced, and the system performance will be improved.
Disadvantages: too secure. Many backup tools may not be available. dd can be considered.

The following describes how to bind a bare device to a MySQL shared tablespace.

(I) bare Devices

# Fdisk/dev/SDA
==>/Dev/sda5
# Partprobe
# Fdisk-l
# Pvcreate/dev/sda5
# Vgcreate-s 16 m mysqlvg/dev/sda5
# Lvcreate-L 90 m-N memory space mysqlvg
# Vim/etc/sysconfig/rawdevices
==>/Dev/raw/raw1/dev/mysqlvg/Spatial Space
# Service rawdevices start
# Chkconfig rawdevices on
# Chown-r MYSQL: DBA/dev/mapper/mysqlvg-memory space

(Ii) Configure MySQL

① Specify the newraw attribute

Innodb_data_home_dir =
Innodb_data_file_path =/dev/mapper/mysqlvg-memory space: 60 mnewraw

② Restart the MySQL service. After completing partition initialization, disable the MySQL service.
③ Modify raw attributes

Innodb_data_home_dir =
Innodb_data_file_path =/dev/mapper/mysqlvg-memory space: 60 mraw

④ Restart the MySQL Service


If the entire system is restarted and the permissions of bare devices are revoked, MySQL cannot be enabled.

The official website is described as follows:

will fail after the next reboot, if the /dev-tree is dynamically created by, e.g. udev, a MAKEDEV-script or similar. After reboot, the device will regain its former permission, typically excluding access by mysql.

The alert alarm is as follows:

130719 20:42:43  InnoDB: Operating system error number 13 in a file operation.InnoDB: The error means mysqld does not have the access rights toInnoDB: the directory.InnoDB: File name /dev/mapper/mysqlvg-sharespaceInnoDB: File operation call: 'open'.InnoDB: Cannot continue operation.

In this case, the following options are available:
1) write a simple initialization script and automatically authorize upon restart
2) Configure udev entries,

[root@odd rules.d]# pwd/etc/udev/rules.d[root@odd rules.d]# cat 60-raw.rulesACTION=="add", KERNEL=="sda5", GROUP=="dba", MODE=="0660", RUN+="/bin/raw /dev/raw/raw1 %N"[root@odd rules.d]# cat 65-raw-permissions.rulesKERNEL=="sda5", GROUP="dba", MODE="0660"

By waterbin

2013-07-20

Good luck

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.