| 93 | f.close() |
| 94 | |
| 95 | def start_hdfs(args): |
| 96 | cmd_prefix = '/opt/hadoop-1.2.1/bin/hadoop-daemon.sh --config /opt/hadoop-1.2.1/' |
| 97 | if args.mode == 'master': |
| 98 | p = subprocess.Popen('/opt/hadoop-1.2.1/bin/hadoop namenode -format', stdout=subprocess.PIPE, shell=True) |
| 99 | print p.stdout.read() |
| 100 | p = subprocess.Popen(cmd_prefix + 'conf start namenode', stdout=subprocess.PIPE, shell=True) |
| 101 | print p.stdout.read() |
| 102 | p = subprocess.Popen(cmd_prefix + 'conf --hosts masters start secondarynamenode', stdout=subprocess.PIPE, shell=True) |
| 103 | print p.stdout.read() |
| 104 | else: |
| 105 | p = subprocess.Popen(cmd_prefix + 'conf start datanode', stdout=subprocess.PIPE, shell=True) |
| 106 | print p.stdout.read() |
| 107 | |
| 108 | def doing_nothing(): |
| 109 | while True: |