Installation
Install on CentOS 7
/etc/yum.repos.d/MariaDB.repo
# MariaDB 10.5 CentOS repository list - created 2021-05-08 02:51 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.5/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
安裝開始
yum install MariaDB-server MariaDB-client
Starting MariaDB
systemctl start mariadb.service
systemctl enable mariadb.service
systemctl status mariadb.service
Securing MariaDB
mysql_secure_installation
OS Optimization
Linux Kernel Settings – IO Scheduler
# A temporary change can be done by issuing the following command
echo noop > /sys/block/sda/queue/scheduler
# To make it persistent, you’ll need to configure it in GRUB’s configuration
# file as shown below in /etc/default/grub , rebuild GRUB, and reboot the system.
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=noop"
Resource Limits – Open Files Limit, Core File Size
# /etc/security/limits.conf
mysql soft nofile 65535
mysql hard nofile 65535
mysql soft core unlimited
mysql hard core unlimited
Configure Swappiness
# /etc/sysctl.conf
vm.swappiness = 1
Filesystem Optimizations
# /etc/fstab
/dev/sdb /var/lib/mysql ext4 defaults,noatime 0 0
DB Optimization