-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnamenode.yml
75 lines (65 loc) · 1.87 KB
/
namenode.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
- hosts: namenode
gather_facts: no
vars_prompt:
- name: "dir_nn"
prompt: "NameNode directory"
private: no
- name: "IP_nn"
prompt: "NameNode IP"
private: no
tasks:
- name: "Installing jdk"
command: "rpm -ivh jdk-8u171-linux-x64.rpm"
ignore_errors: yes
register: java
- debug:
var: java.stdout
- name: "hadoop software installation"
command: "rpm -ivh hadoop-1.2.1-1.x86_64.rpm --force"
register: hadoop
ignore_errors: yes
when: java.rc==0
- debug:
var: hadoop.stdout
- name: "Configuring hdfs-site.xml"
blockinfile:
path: /etc/hadoop/hdfs-site.xml
insertafter: "<configuration>"
block:
<property>
<name>dfs.name.dir</name>
<value>{{ dir_nn }}</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://{{ IP_nn }}:9001</value>
</property>
- name: Creating a NameNode directory
file:
state: directory
path: "{{ dir_nn }}"
- name: Format NameNode directory
shell: "echo Y | hadoop namenode -format"
ignore_errors: yes
register: format
- debug:
var: format
- name: "stopping NameNode Service"
shell: "hadoop-daemon.sh stop namenode"
ignore_errors: yes
- name: "starting NameNode Service"
shell: "hadoop-daemon.sh start namenode"
ignore_errors: yes
register: service
- debug:
var: service.stdout
- name: "Checking Java Process"
shell: "jps"
register: jps
- debug:
var: jps.stdout_lines