mysql安装前的系统准备工作(转)

一、系统环境总结:

 

二、安装yum源:

1、安装磁盘yum源:

一、安装xfs文件系统:
1、配置yum源:(光盘)
vi /etc/yum.repos.d/yum.repo
[Server]
name=server
baseurl=file:///tmp/cddir/Server/
enabled=1
gpgcheck=0
 
[ClusterStorage]
name=server
baseurl=file:///tmp/cddir/ClusterStorage/
enabled=1
gpgcheck=0

 

2、percona的yum源:

官方的yum源:
 
用yum安装:
yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm
 
 
 
3、epel源:
wget http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
或者直接
rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
 
 
4、配置单个目录为yum源
a、#mkdir /root/Desktop/yum //创建一个目录
b.把你想要yum安装的软件放到创建的目录里面
c.#createrepo /root/Desktop/yum
createrepo /data/soft

4.1、如果没有createrepo命令,需要先安装:
[root@wing ~]# yum search createrepo
[root@wing ~]# yum install createrepo

4.2、修改配置文件,指定yum源的路径为我自己的yum目录
baseurl=file:///root/Desktop/yum

 

三、查看操作系统的启动方式:
who -r
 
修改启动级别为3:
vi /etc/inittab
id:3:initdefault:
 
 
 
四、禁用IPv6:
1. vi /etc/sysconfig/network
NETWORKING_IPV6=no
 

2. vi /etc/hosts 中把::开头的注释掉
#::1 localhost localhost6 localhost6.localdomain6

3.vi /etc/modprobe.d/ipv6off.cnf
alias net-pf-10 off
options ipv6 disable=1
 
 
4. 重启系统,然后确认
lsmod |grep -i ipv6
ifconfig |grep -i inet6
 
 
 
五、swappiness检查:
1、注意:
如果是RHEL7以上版本,如果vm.swappiness = 0 有可能会有oom问题。导致mysql进程被 OOM-Killer 进程杀掉。
 
2、配置方式:
vi /etc/sysctl.conf
vm.swappiness = 1
sysctl -p
 
 
六、io调度更改为dealine:
1、注意:
如果是SSD或者PCIe-SSD设备,则修改为noop。
如果表示i/o调度器采用的是cfq,而非我们要求的deadline,需要及时调整。
 
2、临时修改:
cd /sys/block/磁盘表示/queue
echo "deadline" > /sys/block/sda/queue/scheduler
 
3、永久修改:
vi /etc/grub.conf
kernel /vmlinuz-2.6.18-308.el5 ro root=LABEL=/ elevator=deadine numa=off rhgb quiet
 
4、查看i/o调度器配置:
cat /sys/block/sdb/queue/scheduler
 
5、注释:
查看支持的调度算法,和当前的:
[root@likun ~]# dmesg |grep -i schedule
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered (default)
io scheduler cfq registered
 
针对MYSQL数据库服务器的IO调度算法优化设置:
1.CFQ使用于IO大小非常均匀的场景
2.比较复杂的OLTP环境最好使用DeadLine算法
3.IO性能不是瓶颈的时候可以使用Noop算法 www.2cto.com
4.Anticipatory适合大数据顺序顺序存储的文件服务器,如ftp server和web server,不适合数据库环境,DB服务器不要使用这种算法。
5.新兴的固态硬盘比如SSD、Fusion IO上,最简单的NOOP反而可能是最好的算法,因为其他三个算法的优化是基于缩短寻道时间的,而固态硬盘没有所谓的寻道时间且IO响应时间非常短。
 
七、禁用NUMA(系统的优化)
numa禁止,否则sys cpu占用会高,伸直导致严重swap
禁用修改 /etc/grub.conf ,在kernel后面加 numa=off elevator=deadline
vi /etc/grub.conf
kernel /vmlinuz-2.6.18-308.el5 ro root=LABEL=/ elevator=deadine numa=off rhgb quiet
 
 
八、是否关闭selinux:
vi /etc/selinux/config
SELINUX=DISABLED
临时方法:
setenforce 0
 
 
九、sshd中关闭UseDNS:
vi /etc/ssh/sshd_config
修改为
UseDNS no
service sshd restart
 
 
 
十、确认安装sysstat:
rpm -qa | grep sysstat
 
 
十一、文件句柄打开数和用户最大进程数:
修改limit和max user processes
open files (-n) 40960
max user processes (-u) 7776
 
vi /etc/security/limits.conf
root soft nofile 65535
root hard nofile 65535
 
root soft nproc 7000
root hard nproc 7000
 
查看用户限制:
ulimit -a
 
临时修改:
ulimit -n 65535
ulimit -u 65535
 
 
十二、启动服务检查:
chkconfig --list |grep 3:on
显示结果:
crond,sshd,network,sysstat
 
十三、关闭iptables
service iptables stop
/etc/init.d/iptables stop
chkconfig iptables off

http://www.cnblogs.com/abobo/p/4170009.html

 

posted @ 2016-03-22 20:49  沧海一滴  阅读(558)  评论(0编辑  收藏  举报