永久修改
- vi /boot/grub/grub.conf
- 更改到如下内容:
- kernel /boot/vmlinuz-2.6.18-8.el5 ro root=LABEL=/ elevator=deadline rhgb quiet
5、系统参数调整
Linux系统内核参数优化:
- vim/etc/sysctl.conf
- net.ipv4.ip_local_port_range = 1024 65535:# 用户端口范围
- net.ipv4.tcp_max_syn_backlog = 4096
- net.ipv4.tcp_fin_timeout = 30
- fs.file-max=65535:# 系统最大文件句柄,控制的是能打开文件最大数量
用户限制参数(MySQL可以不设置以下配置):
- vim/etc/security/limits.conf
- * soft nproc 65535
- * hard nproc 65535
- * soft nofile 65535
- * hard nofile 65535
6、应用优化
业务应用和数据库应用独立;
防火墙:iptables、selinux等其他无用服务(关闭):
- chkconfig --level 23456 acpid off
- chkconfig --level 23456 anacron off
- chkconfig --level 23456 autofs off
- chkconfig --level 23456 avahi-daemon off
- chkconfig --level 23456 bluetooth off
- chkconfig --level 23456 cups off
- chkconfig --level 23456 firstboot off
- chkconfig --level 23456 haldaemon off
- chkconfig --level 23456 hplip off
- chkconfig --level 23456 ip6tables off
- chkconfig --level 23456 iptables off
- chkconfig --level 23456 isdn off
- chkconfig --level 23456 pcscd off
- chkconfig --level 23456 sendmail off
- chkconfig --level 23456 yum-updatesd off
安装图形界面的服务器不要启动图形界面runlevel 3。
另外,思考将来我们的业务是否真的需要MySQL,还是使用其他种类的数据库。用数据库的最高境界就是不用数据库。
五、数据库优化
SQL优化方向:执行计划、索引、SQL改写。
架构优化方向:高可用架构、高性能架构、分库分表。
1、数据库参数优化
调整
实例整体(高级优化,扩展):
- thread_concurrency:# 并发线程数量个数
- sort_buffer_size:# 排序缓存
- read_buffer_size:# 顺序读取缓存
- read_rnd_buffer_size:# 随机读取缓存
- key_buffer_size:# 索引缓存
- thread_cache_size:# (1G—>8, 2G—>16, 3G—>32, >3G—>64)
连接层(基础优化) (编辑:晋中站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|