本篇内容介绍了“MySQL在Linux平台安装前需要做哪些准备”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
需要开启slew time。
vi /etc/sysconfig/ntpd
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"
service ntpd restart
chkconfig ntpd on
配置NTP服务
# vi /etc/ntp.conf
server <NTP_SERVER_ADDR> iburst
停止NTP服务,手动同步时间。
service ntpd stop
ntpdate -b <NTP_SERVER_ADDR>
service ntpd start
时钟写回主板
hwclock --systohc
hwclock;date
使用Chrony服务
vi /etc/chrony.conf server <NTP_SERVER_ADDR> iburst
重启时间同步服务:
systemctl restart chronyd.service
systemctl enable chronyd.service
查看时间同步源:
chronyc sources -v
时钟写回主板
hwclock --systohc
hwclock;date
#vi /etc/hosts
127.0.0.1 localhost
<IP ADDRESS> <hostname>
cat>>/etc/security/limits.conf<<EOF
mysql soft nofile 1024
mysql hard nofile 65536
mysql soft nproc 4095
mysql hard nproc 16384
mysql soft stack 10240
mysql hard stack 32768
EOF
cat>>/etc/security/limits.d/90-nproc.conf<<EOF
mysql soft nproc 4095
mysql hard nproc 16384
EOF
service iptables stop
chkconfig iptables off
service ip6tables stop
chkconfig ip6tables off
shmmax和shmall的设置
shmmax指的是单个内存段的最大值,单位为bytes
shmall指的是能使用的最大内存大小,单位为pages,
pages大小可通过 getconf PAGE_SIZE 命令查询,一般操作系统page大小为4096 bytes
如操作系统内存为8G,给80%给Oracle使用,则
kernel.shmmax=(8 * 0.8 * 1024 * 1024 * 1024 )=6871947673
kernel.shmall=kernel.shmmax/4096=1677721
如默认值比较大 请保持默认值
cat>>/etc/sysctl.conf<<EOF
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
fs.aio-max-nr = 1048576
# vm.min_free_kbytes = 524288
vm.swappiness= 5
# vm.nr_hugepages =1024
# vm.hugetlb_shm_group = 2000
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.ip_local_port_range = 1024 65500
使其生效
# sysctl -p
默认128,可以加大至512. 根据需求可不加
# vi /etc/rc.local
echo 512 > /sys/block/sda/queue/nr_requests
# chmod +x /etc/rc.local
添加noatime,nodiratime选项 根据需求可不添加
# vi /etc/fstab
/dev/mapper/centos-app /app xfs defaults,noatime,nodiratime 0 0
重新挂载后确认
# mount|grep noatime
/dev/mapper/centos-app on /app type xfs
(rw,noatime,nodiratime,attr2,inode64,noquota)
reboot
好了 MySQL安装前的准备就到这了,下节为如何安装
“MySQL在Linux平台安装前需要做哪些准备”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!
亿速云「云数据库 MySQL」免部署即开即用,比自行安装部署数据库高出1倍以上的性能,双节点冗余防止单节点故障,数据自动定期备份随时恢复。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
原文链接:http://blog.itpub.net/28413242/viewspace-2650269/