关于在OpenShift节点上建立NFS Server

yum install nfs-utils

mkdir /var/nfsshare

chmod -R 777 /var/nfsshare/

在/etc/exports中加入内容

/var/nfsshare 192.168.174.0/24(insecure,rw,sync,no_root_squash,no_all_squash)

记住这个192.168.174.0/24是访问端的地址,也可以直接设置成*

systemctl enable rpcbind
systemctl enable nfs-server
systemctl enable nfs-lock
systemctl enable nfs-idmap
systemctl start rpcbind
systemctl start nfs-server
systemctl start nfs-lock
systemctl start nfs-idmap

exportfs

本地mount测试一下

mkdir -p /mnt/nfs/var/nfsshare

mount -t nfs 192.168.174.10:/var/nfsshare /mnt/nfs/var/nfsshare/

 

因为涉及到iptables问题,需要在Server端开通防火墙如下,此处折腾太长时间,感谢同事的脚本。

cp /etc/sysconfig/iptables /etc/sysconfig/iptables.bak.$(date "+%Y%m%d%H%M%S");

sed -i '/.*--dport 22 -j ACCEPT.*/a\-A INPUT -p tcp -m state --state NEW -m tcp --dport 20048 -j ACCEPT' /etc/sysconfig/iptables;
sed -i '/.*--dport 22 -j ACCEPT.*/a\-A INPUT -p tcp -m state --state NEW -m tcp --dport 111 -j ACCEPT' /etc/sysconfig/iptables;
sed -i '/.*--dport 22 -j ACCEPT.*/a\-A INPUT -p tcp -m state --state NEW -m tcp --dport 2049 -j ACCEPT' /etc/sysconfig/iptables;
sed -i '/.*--dport 22 -j ACCEPT.*/a\-A INPUT -p udp --dport 20048 -j ACCEPT' /etc/sysconfig/iptables;
sed -i '/.*--dport 22 -j ACCEPT.*/a\-A INPUT -p udp --dport 111 -j ACCEPT' /etc/sysconfig/iptables;
sed -i '/.*--dport 22 -j ACCEPT.*/a\-A INPUT -p udp --dport 2049 -j ACCEPT' /etc/sysconfig/iptables;

systemctl restart iptables;

 

posted @ 2020-01-02 17:35  ericnie  阅读(544)  评论(0编辑  收藏  举报