防火墙操作
· service iptables start
打开防火墙
· service iptables stop
关闭防火墙
· service iptables status
查看防火墙状态
· chkconfig iptables off
设置防火墙开机不启动
· chkconfig iptables on
设置防火墙开机自启动
· chkconfig iptables --list
查看状态
文件最大打开数
· ulimit -n 数字
临时修改
· 永久修改 vi /etc/security/limits.conf
最后添加下面两行,然后重新登录或者连接
# "*"代表所有用户
* soft nofile 1048576
* hard nofile 1048576
改主机名和增加映射
· vi /etc/sysconfig/network
修改主机名
在文件内增加或者修改HOSTNAME的属性值为node1,如图所示:
修改后执行:hostname node1
,在重新连接
· 主机映射vi /etc/hosts
在文件内增加所有服务器的IP与主机名的映射关系,如图:
配置无密码访问
· 在所有服务器上执行ssh-keygen -t rsa
遇到输入内容时直接回车就行
· cp id_rsa.pub ./authorized_keys
方法1:将所有的服务器的 id_rsa.pub内容粘贴到authorized_keys文件中(注:一行粘贴一个公钥内容),然后将authorized_keys文件发送给所有的服务器/root/.ssh/下即可
方法2:ssh-copy-id 主机名或IP
将公钥在其他服务器上拷贝一份