改iptables让计算节点可以通过控制节点访问公网

https://linuxcluster.wordpress.com/2012/03/17/using-iptables-to-allow-compute-nodes-to-access-public-network/

vi /etc/sysconfig/iptables

# Generated by iptables-save v1.4.7 on Wed Jul 13 20:34:33 2016
*filter
:INPUT ACCEPT [585:127452]
:FORWARD DROP [52:1945]
:OUTPUT ACCEPT [611:187699]
-A INPUT -i eth4 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 1194 -m comment --comment "openvpn" -j ACCEPT 
-A FORWARD -i eth4 -j ACCEPT 
-A FORWARD -i eth3 -o eth4 -m state --state RELATED,ESTABLISHED -j ACCEPT 
COMMIT
# Completed on Wed Jul 13 20:34:33 2016
# Generated by iptables-save v1.4.7 on Wed Jul 13 20:34:33 2016
*nat
:PREROUTING ACCEPT [3186:115409]
:POSTROUTING ACCEPT [45:15680]
:OUTPUT ACCEPT [46:15756]
-A POSTROUTING -o eth3 -j MASQUERADE 
-A POSTROUTING -s 10.8.0.0/24 -j MASQUERADE 
-A POSTROUTING -o eth3 -j MASQUERADE 
COMMIT
# Completed on Wed Jul 13 20:34:33 2016

保存后执行service iptables restart即可

另外需要修改控制节点/etc/resolv.conf添加一组公共域名解析的DNS

search local hpc.org
nameserver 127.0.0.1
nameserver 114.114.114.114

此时计算节点应该可以通过控制节点自由访问公网

改DNS

挂NFS

配PATH

分账户

禁止重启自动安装

/etc/init.d/rocks-grub stop
chkconfig rocks-grub off

脚本

#!/bin/bash

# @ferstar 
# github.com

# mount nfs storage
mkdir /prodata
mkdir /resdata
chmod 1755 /prodata
chmod 1755 /resdata
mount -t nfs 10.1.1.1:/prodata /prodata
mount -t nfs 10.1.1.1:/resdata /resdata
echo "10.1.1.1:/prodata /prodata nfs defaults 0 0" >> /etc/fstab
echo "10.1.1.1:/resdata /resdata nfs defaults 0 0" >> /etc/fstab

# set path
echo "ngs=/prodata/ngs" >> /etc/bashrc
echo "export ParallelMETA=\$ngs/parallel-meta" >> /etc/bashrc
echo "export PATH=\$PATH:\$ngs/ncbi-blast/bin:\$ngs/bin:\$ngs/MUMmer:\$ngs/surpi:\$ngs/sratoolkit/bin:\$ngs/parallel-meta/bin:/prodata/miniconda2/bin" >> /etc/bashrc


# change dns server
echo "nameserver 223.5.5.5" >> /etc/resolv.conf
echo "nameserver 114.114.114.114" >> /etc/resolv.conf

# disable the rocks-gurb service
/etc/init.d/rocks-grub stop
chkconfig rocks-grub off

禁用计算节点冷启动自动重装功能

这个功能太蛋疼,计算节点一旦意外关机就会自动重装。。。


# cd /export/rocks/install
# cp rocks-dist/x86_64/build/nodes/auto-kickstart.xml \
site-profiles/6.2/nodes/replace-auto-kickstart.xml
# vi site-profiles/6.2/nodes/replace-auto-kickstart.xml
# remove this line
<package>rocks-boot-auto<package>
# cd /export/rocks/install/
# rocks create distro
# 重装计算节点
# /opt/gridengine/examples/jobs/sge-reinstall.sh
yum install boost-openmpi-devel sqlite-devel expat-devel perl-core openssl-perl openssl-devel coreutils csh python-devel ghostscript python-matplotlib perl-Time-HiRes

cpanm Statistics::Descriptive && cpanm XML::Parser && cpanm DBI && cpanm DBD::SQLite && cpanm Net::OAuth && cpanm Net::Twitter::Lite::WithAPIv1_1

启动步骤:

先启动控制节点,待控制节点完全启动后再启动计算节点

关机步骤:

先关计算节点,cluster-fork /sbin/shutdown -h now,然后关闭控制节点