0

如何hdfs zkfc -formatZK在 ansible playbook 中执行?我尝试:

- name: format hdfs
  command: hdfs zkfc -formatZK

这是结果:

fatal: [172.16.8.231]: FAILED! => {"changed": false, "cmd": "hdfs zkfc
-formatZK", "failed": true, "msg": "[Errno 2] No existe el archivo o el
directorio", "rc": 2}
4

1 回答 1

2

我很确定您的 ansible 命令在与手动运行时不同的用户下运行。此命令需要以 hdfs 用户身份运行。

您还需要使用-nonInteractive参数运行。

- name: format ZooKeeper HA state
  command: /usr/bin/hdfs zkfc -formatZK -nonInteractive
  become: yes
  become_user: hdfs
  run_once: yes
于 2016-03-18T21:28:14.993 回答