-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDNconfig.py
32 lines (22 loc) · 1.23 KB
/
DNconfig.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
import subprocess
NNip=input("Enter Name-Node IP ...>>> ")
os.system('rm -rf /datanode')
os.system('mkdir /datanode')
os.system('cp /root/fileUpdate/core-site.xml /etc/hadoop/core-site.xml')
os.system('echo "<configuration>" >> /etc/hadoop/core-site.xml')
os.system('echo "<property>" >> /etc/hadoop/core-site.xml')
os.system('echo "<name>fs.default.name</name>" >> /etc/hadoop/core-site.xml')
os.system(f'echo "<value>hdfs://{NNip}:9001</value>" >> /etc/hadoop/core-site.xml')
os.system('echo "</property>" >> /etc/hadoop/core-site.xml')
os.system('echo "</configuration>" >> /etc/hadoop/core-site.xml')
os.system('echo " " >> /etc/hadoop/core-site.xml')
os.system('cp /root/fileUpdate/hdfs-site.xml /etc/hadoop/hdfs-site.xml')
os.system('echo "<configuration>" >> /etc/hadoop/hdfs-site.xml')
os.system('echo "<property>" >> /etc/hadoop/hdfs-site.xml')
os.system('echo "<name>dfs.data.dir</name>" >> /etc/hadoop/hdfs-site.xml')
os.system(f'echo "<value>/datanode</value>" >> /etc/hadoop/hdfs-site.xml')
os.system('echo "</property>" >> /etc/hadoop/hdfs-site.xml')
os.system('echo "</configuration>" >> /etc/hadoop/hdfs-site.xml')
os.system('echo " " >> /etc/hadoop/hdfs-site.xml')
os.system('hadoop-daemon.sh start datanode')