Difference between revisions of "Instructor of Booting Alluxio"
From IIIS-Systems
Chentianjia (Talk | contribs) |
Chentianjia (Talk | contribs) |
||
Line 8: | Line 8: | ||
= 对于一台新的物理机加到集群中 = | = 对于一台新的物理机加到集群中 = | ||
+ | |||
+ | 首先需要把所有的虚拟机都绑定外网地址,这样他们才能跟Alluxio的Master180互通有无。下面是脚本: | ||
+ | |||
+ | import os | ||
+ | import re | ||
+ | import pexpect | ||
+ | import time | ||
+ | for i in range(1,31): | ||
+ | data='' | ||
+ | ii=i+XX | ||
+ | with open('/etc/sysconfig/network-scripts/ifcfg-enp3s0f0', 'r+') as f: | ||
+ | for line in f.readlines(): | ||
+ | if(line.find('DEVICE') == 0): | ||
+ | line = 'DEVICE=%s' % ('ifcfg-enp3s0f0:%s' %i,) + '\n' | ||
+ | if(line.find('IPADDR') == 0): | ||
+ | line = 'DEVICE=%s' % ('10.1.X.%s' %ii,) + '\n' | ||
+ | data += line | ||
+ | file_object = open('/etc/sysconfig/network-scripts/ifcfg-enp3s0f0:%s' %i, 'w') | ||
+ | file_object.writelines(data) | ||
+ | file_object.close( ) | ||
+ | 其中XX跟X是虚拟机的IP地址,请在这个表格里面看还剩下什么IP地址。https://pan.baidu.com/s/1pLmivLh 。密码是 | ||
+ | |||
+ | [[Image:key.png]] | ||
+ | |||
+ | 然后记得重启网络,或者你可以用命令行加一个暂时的。然后是添加iptables | ||
+ | |||
+ | import os | ||
+ | import re | ||
+ | import pexpect | ||
+ | import time | ||
+ | for i in range(1,31): | ||
+ | ip=i+XX | ||
+ | ip2=i+1 | ||
+ | ll='172.17.0.%s' %ip2 | ||
+ | command1='iptables -t nat -A PREROUTING -d 10.1.3.%s -p tcp -m tcp --dport 1:65535 -j DNAT --to-destination %s:1-65535' %(ip,ll) | ||
+ | command2='iptables -t nat -A POSTROUTING -d %s -p tcp -m tcp --dport 1:65535 -j SNAT --to-source 172.17.0.1' %ll | ||
+ | command3='ifconfig enp3s0f0:%s 10.1.X.%s/16' %(i,ip) | ||
+ | os.system(command1) | ||
+ | os.system(command2) | ||
+ | os.system(command3) | ||
+ | |||
+ | 跟上面一样XX跟X是虚拟机的IP地址。 |
Revision as of 16:45, 20 November 2017
本指导知道大家以及以后的我怎么在一台新的服务器上部署Alluxio服务
对于Docker的虚拟机
Docker虚拟机在咱们的网站http://10.1.1.1:81
申请虚拟机的时候在Json文件请填写"image": "10.1.0.180/alluxio/ubuntu_14.04.5:latest"即可。
对于一台新的物理机加到集群中
首先需要把所有的虚拟机都绑定外网地址,这样他们才能跟Alluxio的Master180互通有无。下面是脚本:
import os import re import pexpect import time for i in range(1,31): data= ii=i+XX with open('/etc/sysconfig/network-scripts/ifcfg-enp3s0f0', 'r+') as f: for line in f.readlines(): if(line.find('DEVICE') == 0): line = 'DEVICE=%s' % ('ifcfg-enp3s0f0:%s' %i,) + '\n' if(line.find('IPADDR') == 0): line = 'DEVICE=%s' % ('10.1.X.%s' %ii,) + '\n' data += line file_object = open('/etc/sysconfig/network-scripts/ifcfg-enp3s0f0:%s' %i, 'w') file_object.writelines(data) file_object.close( )
其中XX跟X是虚拟机的IP地址,请在这个表格里面看还剩下什么IP地址。https://pan.baidu.com/s/1pLmivLh 。密码是
然后记得重启网络,或者你可以用命令行加一个暂时的。然后是添加iptables
import os import re import pexpect import time for i in range(1,31): ip=i+XX ip2=i+1 ll='172.17.0.%s' %ip2 command1='iptables -t nat -A PREROUTING -d 10.1.3.%s -p tcp -m tcp --dport 1:65535 -j DNAT --to-destination %s:1-65535' %(ip,ll) command2='iptables -t nat -A POSTROUTING -d %s -p tcp -m tcp --dport 1:65535 -j SNAT --to-source 172.17.0.1' %ll command3='ifconfig enp3s0f0:%s 10.1.X.%s/16' %(i,ip) os.system(command1) os.system(command2) os.system(command3)
跟上面一样XX跟X是虚拟机的IP地址。