-
Notifications
You must be signed in to change notification settings - Fork 6
/
init.yml
69 lines (63 loc) · 1.77 KB
/
init.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
---
- hosts: zookeepers
user: root
sudo_user: "{{zookeeper.owner}}"
sudo: true
tasks:
- name: start zookeepers
raw: source /etc/profile;zkServer.sh start
- name: format zookeeper for hdfs
raw: source /etc/profile;hdfs zkfc -formatZK -force
tags:
- init_zookeeper
- hosts: journalnodes
user: root
sudo_user: "{{hadoop.owner}}"
sudo: true
tasks:
- name: start journalnodes
raw: source /etc/profile;hadoop-daemon.sh start journalnode
ignore_errors: True
tags:
- init_hadoop
- hosts: namenodes[0]
user: root
sudo_user: "{{hadoop.owner}}"
sudo: true
tasks:
- name: format first namenode
raw: source /etc/profile;hdfs namenode -format -force
- name: init share edits
raw: source /etc/profile;hdfs namenode -initializeSharedEdits -force
- name: start first namenode
raw: source /etc/profile;hadoop-daemon.sh start namenode
tags:
- init_hadoop
- hosts: namenodes[1]
user: root
sudo_user: "{{hadoop.owner}}"
sudo: true
tasks:
- name: format seconde namenode
raw: source /etc/profile;hdfs namenode -bootstrapStandby
- name: start seconde namenode
raw: source /etc/profile;hadoop-daemon.sh start namenode
tags:
- init_hadoop
- hosts: datanodes
user: root
sudo_user: "{{hadoop.owner}}"
sudo: true
tasks:
- name: remove datanode data dir
file: >
state=absent path={{item}}
owner={{zookeeper.owner}}
group={{zookeeper.group}}
mode=755
with_items:
- "{{hadoop.hdfs_site.dfs_data_dir}}"
tags:
- init_hadoop
# 初始化完成后,停止所有启动的进程。以免调用启动命令的时候出现进程重复
- include: stop.yml