Skip to content

Commit 4e300ae

Browse files
Create README.md
1 parent 8ed89fb commit 4e300ae

File tree

1 file changed

+144
-0
lines changed

1 file changed

+144
-0
lines changed

README.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Ansible Playbook For Setup Hadoop HDFS
2+
3+
## Roles Variables
4+
5+
### Installation Vars
6+
```yaml
7+
hdfs_unarchived_filename: "hadoop-3.3.3"
8+
hdfs_download_link: "https://downloads.apache.org/hadoop/common/{{hdfs_unarchived_filename}}/{{hdfs_unarchived_filename}}.tar.gz"
9+
hdfs_download_sha_sum: "9ac5a5a8d29de4d2edfb5e554c178b04863375c5644d6fea1f6464ab4a7e22a50a6c43253ea348edbd114fc534dcde5bdd2826007e24b2a6b0ce0d704c5b4f5b"
10+
hdfs_download_destination: "/opt/{{hdfs_unarchived_filename}}.tar.gz"
11+
hdfs_unarchive_destination: "/opt/"
12+
```
13+
14+
### File core-site.xml Vars
15+
```yaml
16+
hdfs_fs_defaultFS: "ha-cluster"
17+
hdfs_trash_interval: 1440
18+
hdfs_dfs_journalnode_edits_dir: "/var/lib/hadoop/journal"
19+
hdfs_ha_zookeeper_quorum:
20+
- "172.16.21.125:49162"
21+
- "172.16.21.125:49163"
22+
- "172.16.21.125:49164"
23+
```
24+
25+
### File hadoop-env.sh Vars
26+
```yaml
27+
hdfs_namenode_user: root
28+
hdfs_datanode_user: root
29+
hdfs_secondarynamenode_user: root
30+
hdfs_journalnode_user: root
31+
hdfs_zkfc_user: root
32+
hdfs_java_home: /usr
33+
hdfs_hadoop_home: /opt/hadoop
34+
hdfs_hadoop_conf_dir: /opt/hadoop/etc/hadoop
35+
hdfs_hadoop_daemon_root_logger: WARN,RFA
36+
hdfs_hadoop_heapsize_max: ''
37+
hdfs_hadoop_heapsize_min: ''
38+
hdfs_hadoop_jaas_debug: ''
39+
hdfs_hadoop_workers: ''
40+
hdfs_hadoop_log_dir: ''
41+
hdfs_hadoop_pid_dir: ''
42+
hdfs_hadoop_niceness: ''
43+
```
44+
45+
### File hdfs-site.xml Vars
46+
```yaml
47+
hdfs_dfs_replication: 1
48+
hdfs_dfs_namenode_name_dir: /var/lib/hadoop/hadoop-name-{{hostvars[inventory_hostname]['name']}}
49+
hdfs_dfs_nameservices: "ha-cluster"
50+
hdfs_dfs_datanode_data_dir: /var/lib/hadoop/hadoop-data-{{hostvars[inventory_hostname]['name']}}
51+
hdfs_ha_automatic_failover_enabled: "true"
52+
hdfs_dfs_ha_fencing_methods: "sshfence"
53+
hdfs_dfs_ha_fencing_ssh_private_key_files: /root/.ssh/id_rsa
54+
hdfs_dfs_namenode_datanode_registration_ip_hostname_check: ''
55+
```
56+
57+
### Disk Management Vars
58+
```yaml
59+
disk: /dev/sdb
60+
destination: /var/lib/hadoop
61+
filesystem: ext4
62+
allow_disk_mount: false
63+
```
64+
65+
### Dns Vars
66+
67+
```yaml
68+
dns_server: 172.16.21.128
69+
allow_dns: true
70+
```
71+
72+
## Example Playbook
73+
74+
### Inventory
75+
76+
```ini
77+
[activenamenodeserver]
78+
172.16.21.125 name=n1 rpc_port=9000 http_port=9870
79+
80+
[standbynamenodeservers]
81+
172.16.21.127 name=n2 rpc_port=9000 http_port=9870
82+
83+
[namenodeservers:children]
84+
activenamenodeserver
85+
standbynamenodeservers
86+
87+
[datanodeservers]
88+
172.16.21.128 name=n3
89+
172.16.21.129 name=n4
90+
91+
[qjournalnodeservers]
92+
172.16.21.125
93+
172.16.21.127
94+
172.16.21.128
95+
96+
[all:vars]
97+
ansible_user=root
98+
ansible_connection=ssh
99+
ansible_ssh_port=22
100+
```
101+
102+
### Installation
103+
104+
```yaml
105+
- name: install-hdfs
106+
hosts: all
107+
become: true
108+
become_user: root
109+
roles:
110+
- install-hdfs
111+
112+
- name: start journalnodes
113+
hosts: qjournalnodeservers
114+
roles:
115+
- journalnode
116+
117+
- name: start namenodes
118+
hosts: namenodeservers
119+
roles:
120+
- namenode
121+
122+
- name: start datanodes
123+
hosts: datanodeservers
124+
roles:
125+
- datanode
126+
```
127+
```
128+
ansible-playbook -i inventory.ini hdfs.yaml
129+
```
130+
131+
### Destroy Whole HDFS After Installation
132+
133+
```yaml
134+
- name: destroy-hdfs
135+
hosts: all
136+
become: true
137+
become_user: root
138+
strategy: linear
139+
roles:
140+
- destroy-hdfs
141+
```
142+
```
143+
ansible-playbook -i inventory.ini destroy.yaml
144+
```

0 commit comments

Comments
 (0)