0
点赞
收藏
分享

微信扫一扫

[Linux基础]-- linux下设置强制访问和打开文件数


1、如果安装cdh版本的hadoop,则需要设置

   SELinux的命令

 

从​​fedora​​​ core 2开始, 2.6​​内核​​​的版本都支持se​​linux​​.我们看看 Fedora core 5 里的/etc/sysconfig/selinux标准设定吧。

# 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 - SELinux is fully disabled.

SELINUX=enforcing

#SELINUX=disabled

# SELINUXTYPE= type of policy in use. Possible values are:

# targeted - Only targeted network daemons are protected.

# strict - Full SELinux protection.

SELINUXTYPE=targeted

SELINUX有「disabled」「permissive」,「enforcing」3种选择。

选择:enforcing

 

2、修改linux的最大文件句柄数限制的方法:

      1)ulimit -n 65535  

            在当前session有效,用户退出或者系统重新后恢复默认值

      2)修改profile文件:在profile文件中添加:ulimit -n 65535 

           只对当个用户有效

      3)修改文件:/etc/security/limits.conf,在文件中添加:(立即生效-当前session中运行ulimit -a命令无法显示)

* soft nofile 32768 #限制单个进程最大文件句柄数(到达此限制时系统报警)  

* hard nofile 65536 #限制单个进程最大文件句柄数(到达此限制时系统报错)

            4)修改文件:/etc/sysctl.conf。在文件中添加:

           fs.file-max=655350

            运行命令:/sbin/sysctl -p 使配置生效

 

 

 

举报

相关推荐

0 条评论