-
Notifications
You must be signed in to change notification settings - Fork 1
/
hadoop.yml
129 lines (105 loc) · 3.04 KB
/
hadoop.yml
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
- hosts: all
tasks:
- name: "Copying JDK software"
copy:
dest: "/root"
src: "/root/jdk-8u171-linux-x64.rpm"
- name: "Copying Hadoop software"
copy:
dest: "/root"
src: "/root/hadoop-1.2.1-1.x86_64.rpm"
- name: "Installing JDK software"
command: "rpm -i jdk-8u171-linux-x64.rpm"
ignore_errors: yes
- name: "Installing Hadoop Software"
command: "rpm -i hadoop-1.2.1-1.x86_64.rpm --force"
ignore_errors: yes
#Datanode Setup
- hosts: slave
vars_prompt:
- name: "data_dir"
private: "no"
prompt: "Enter name of Data Node dir"
- name: "data_ip"
prompt: "Enter Data node IP"
private: "no"
tasks:
- name: "Creating Data Node Directory"
file:
path: "{{ data_dir }}"
state: directory
- name: "Configuring hdfs-site.xml"
blockinfile:
path: /etc/hadoop/hdfs-site.xml
insertafter: "<configuration>"
block:
<property>
<name>dfs.data.dir</name>
<value>{{ data_dir }}</value>
</property>
- name: "Configuring core-site.xml"
blockinfile:
path: /etc/hadoop/core-site.xml
insertafter: "<configuration>"
block:
<property>
<name>fs.default.name</name>
<value>hdfs://{{ data_ip }}:9001</value>
</property>
- name: "Stopping firewalld"
command: systemctl stop firewalld
- name: "Starting Datanode Services"
command: hadoop-daemon.sh start datanode
- name: "Checking status of Datanode"
shell: "jps"
register: jps
- debug:
var: jps
#Namenode Setup
- hosts: master
vars_prompt:
- name: "name_dir"
private: "no"
prompt: "Enter name of Name Node dir"
- name: "name_ip"
prompt: "Enter Name node IP"
private: "no"
tasks:
- name: "Creating Name Node Directory"
file:
path: "{{ name_dir }}"
state: directory
- name: "Configuring hdfs-site.xml"
blockinfile:
path: /etc/hadoop/hdfs-site.xml
insertafter: "<configuration>"
block:
<property>
<name>dfs.name.dir</name>
<value>{{ name_dir }}</value>
</property>
- name: "Configuring core-site.xml"
blockinfile:
path: /etc/hadoop/core-site.xml
insertafter: "<configuration>"
block:
<property>
<name>fs.default.name</name>
<value>hdfs://{{ name_ip }}:9001</value>
</property>
- name: "Formatting namenode"
shell: "echo Y | hadoop namenode -format"
register: format
- debug:
var: format
- name: "Stopping firewalld"
command: systemctl stop firewalld
- name: "Starting namenode Services"
command: hadoop-daemon.sh start namenode
- name: "Checking status of namenode"
shell: "jps"
register: jps
- debug:
var: jps
- name: "Checking Hadoop Cluster Report"
command: hadoop dfsadmin -report