권장사항대로 hadoop용 사용자를 따로 생성해서 하는게 제일 좋겠지만,
어떤 사정이 있거나 귀찮거나 여하튼 root로 굳이 하려는데,
sbin/start-all.sh 등을 실행시키면 아래와 같은 에러가 발생함.
# sbin/stop-all.sh 실행
Stopping namenodes on [namenode1 namenode2]
ERROR: Attempting to operate on hdfs namenode as root
ERROR: but there is no HDFS_NAMENODE_USER defined. Aborting operation.
Stopping datanodes
ERROR: Attempting to operate on hdfs datanode as root
ERROR: but there is no HDFS_DATANODE_USER defined. Aborting operation.
Stopping journal nodes [journalnode1 journalnode2 journalnode3]
ERROR: Attempting to operate on hdfs journalnode as root
ERROR: but there is no HDFS_JOURNALNODE_USER defined. Aborting operation.
Stopping ZK Failover Controllers on NN hosts [zkfc1 zkfc2]
ERROR: Attempting to operate on hdfs zkfc as root
ERROR: but there is no HDFS_ZKFC_USER defined. Aborting operation.
Stopping nodemanagers
ERROR: Attempting to operate on yarn nodemanager as root
ERROR: but there is no YARN_NODEMANAGER_USER defined. Aborting operation.
Stopping resourcemanagers on [ resourcemanager1 resourcemanager2]
ERROR: Attempting to operate on yarn resourcemanager as root
ERROR: but there is no YARN_RESOURCEMANAGER_USER defined. Aborting operation.
이럴 경우 etc/hadoop/hadoop-env.sh 에 각 사용자를 root로 등록해주면 됨.
export HDFS_NAMENODE_USER=root
export HDFS_DATANODE_USER=root
export HDFS_JOURNALNODE_USER=root
export HDFS_ZKFC_USER=root
export YARN_NODEMANAGER_USER=root
export YARN_RESOURCEMANAGER_USER=root