Udev can manage files stored in the dev directory. Files are generated only after the device is connected to the corresponding device, and are automatically deleted after the device is pulled out. It also allows users to add rules for repair.
Udev can manage files stored in the/dev directory. Files are generated only after the device is connected to the corresponding device, and are automatically deleted after the device is pulled out. It also allows users to add rules for repair.
(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: The file system is bypassed, the read/write speed is improved, and the data is safer, the file system burden is reduced, and the system performance is 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
InnoDB: the directory.
InnoDB: File name/dev/mapper/mysqlvg-memory space
InnoDB: 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.rules
ACTION = "add", KERNEL = "sda5", GROUP = "dba", MODE = "0660 ", RUN + = "/bin/raw/dev/raw/raw1% N"
[Root @ odd rules. d] # cat 65-raw-permissions.rules
KERNEL = "sda5", GROUP = "dba", MODE = "0660"
Recommended reading:
RHEL6 use UDEV to modify the asm disk name
Deploy UDEV on CentOS 5
Startup, shutdown, and restoration of the InnoDB Storage Engine
MySQL InnoDB independent tablespace Configuration
Architecture of MySQL Server layer and InnoDB Engine Layer