sysctl mysql_MySQL的Linux环境设置

MySQL的Linux环境设置

关闭selinux

查看selinux状态:

[root@betacat selinux]# sestatus

SELinux status: enabled

SELinuxfs mount: /sys/fs/selinux

SELinux root directory: /etc/selinux

Loaded policy name: targeted

Current mode: enforcing

Mode from config file: disabled

Policy MLS status: enabled

Policy deny_unknown status: allowed

Max kernel policy version: 28

在配置文件中设置关闭selinux:

vi /etc/selinux/config

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

# enforcing - SELinux security policy is enforced.

# permissive - SELinux prints warnings instead of enforcing.

# disabled - No SELinux policy is loaded.

SELINUX=enforcing

# SELINUXTYPE= can take one of three two values:

# targeted - Targeted processes are protected,

# minimum - Modification of targeted policy. Only selected processes are protected.

# mls - Multi Level Security protection.

SELINUXTYPE=targeted

将SELINUX=enforcing改成SELINUX=disabled

系统IO调度模式改为deadline

查看当前模式:

[root@betacat ~]# dmesg | grep -i scheduler

[ 0.334857] io scheduler noop registered

[ 0.334860] io scheduler deadline registered

[ 0.334899] io scheduler cfq registered (default)

如果默认已经是deadline就不需要改。

修改:

[root@betacat ~]# grubby --update-kernel=ALL --args="elevator=deadline"

重启系统

上面两点都是需要重启系统后才生效的:

[root@betacat ~]# reboot

设备swap分区大小

查看:

[root@betacat ~]# cat /proc/sys/vm/swappiness

20

[root@betacat ~]# sysctl -a | grep swap

sysctl: reading key "net.ipv6.conf.all.stable_secret"

sysctl: reading key "net.ipv6.conf.default.stable_secret"

sysctl: reading key "net.ipv6.conf.ens33.stable_secret"

sysctl: reading key "net.ipv6.conf.lo.stable_secret"

vm.swappiness = 20

修改:

[root@betacat ~]# vi /etc/sysctl.conf

# sysctl settings are defined through files in

# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.

#

# Vendors settings live in /usr/lib/sysctl.d/.

# To override a whole file, create a new file with the same in

# /etc/sysctl.d/ and put new settings there. To override

# only specific settings, add a file with a lexically later

# name in /etc/sysctl.d/ and put new settings there.

#

# For more information, see sysctl.conf(5) and sysctl.d(5).

vm.swappiness=30

修改操作系统限制

查看:

[root@betacat ~]# ulimit -a

core file size (blocks, -c) 0

data seg size (kbytes, -d) unlimited

scheduling priority (-e) 0

file size (blocks, -f) unlimited

pending signals (-i) 7215

max locked memory (kbytes, -l) 64

max memory size (kbytes, -m) unlimited

open files (-n) 1024 ###

pipe size (512 bytes, -p) 8

POSIX message queues (bytes, -q) 819200

real-time priority (-r) 0

stack size (kbytes, -s) 8192

cpu time (seconds, -t) unlimited

max user processes (-u) 7215 ###

virtual memory (kbytes, -v) unlimited

file locks (-x) unlimited

修改系统的软硬限制:

[root@betacat ~]# vi /etc/security/limits.conf

加入以下内容,然后重启系统:

#

#

#

#* soft core 0

#* hard rss 10000

#@student hard nproc 20

#@faculty soft nproc 20

#@faculty hard nproc 50

#ftp hard nproc 0

#@student - maxlogins 4

* soft nproc 65535

* hard nproc 65535

* soft nofile 65535

* hard nofile 65535

# End of file

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值