天天看點

[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 使配置生效

繼續閱讀