summaryrefslogtreecommitdiff
path: root/Apache Hadoop/2.7.1/hdfs/role/tasks/status-check.yml
blob: 4d77936fff71c530cfefa19b71cdba8cc3fd8adb (plain)
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
- name: Setting node_nums variable
  set_fact: node_nums="{{groups.hdfs|length}}"
  
- name: Waiting for the HDFS start,sleep 30s
  shell: sleep 30  
  
- block:
    - name: checking JournalNode status
      shell: source /etc/profile && jps | grep JournalNode | grep -v grep | wc -l
      register: status_out

    - name: checking JournalNode
      fail:
        msg: "JournalNode节点启动异常,请登陆{{ inventory_hostname }},保留日志反馈,路径:{{ deploy_dir }}/{{ hadoop_version }}/logs/*journalnode*"
      when: status_out.stdout != '1'
      run_once: true
      delegate_to: 127.0.0.1
  when: inventory_hostname in groups['hdfs'][0:3]
  
- block:
    - name: checking DFSZKFailoverController status
      shell: source /etc/profile && jps | grep DFSZKFailoverController | grep -v grep | wc -l
      register: status_out

    - name: checking DFSZKFailoverController
      fail:
        msg: "DFSZKFailoverController节点启动异常,请登陆{{ inventory_hostname }},保留日志反馈,路径:{{ deploy_dir }}/{{ hadoop_version }}/logs/*zkfc*"
      when: status_out.stdout != '1'
      run_once: true
      delegate_to: 127.0.0.1
      
    - name: checking NameNode status
      shell: source /etc/profile && jps | grep NameNode | grep -v grep | wc -l
      register: status_out

    - name: checking NameNode
      fail:
        msg: "NameNode节点启动异常,请登陆{{ inventory_hostname }},保留日志反馈,路径:{{ deploy_dir }}/{{ hadoop_version }}/logs/*namenode*"
      when: status_out.stdout != '1'
      run_once: true
      delegate_to: 127.0.0.1
  when: inventory_hostname in groups['hdfs'][0:2]  
 
- name: checking DataNode status
  shell: source /etc/profile && jps | grep DataNode | grep -v grep | wc -l
  register: status_out

- name: checking DataNode
  fail:
    msg: "DFSZKFailoverController节点启动异常,请登陆{{ inventory_hostname }},保留日志反馈,路径:{{ deploy_dir }}/{{ hadoop_version }}/logs/*datanode*"
  when: status_out.stdout != '1'
  run_once: true
  delegate_to: 127.0.0.1