我们希望执行以下简单命令
使用ssh登录到$hadoop\u机器
并以 hdfs fsck /
,来自用户hdfs
所以我们运行以下程序
ssh $hadoop_machine su hdfs -c 'hdfs fsck /'
但我们得到
Usage: hdfs [--config confdir] [--loglevel loglevel] COMMAND
where COMMAND is one of:
dfs run a filesystem command on the file systems supported in Hadoop.
classpath prints the classpath
namenode -format format the DFS filesystem
secondarynamenode run the DFS secondary namenode
namenode run the DFS namenode
journalnode run the DFS journalnode
zkfc run the ZK Failover Controller daemon
datanode run a DFS datanode
dfsadmin run a DFS admin client
envvars display computed Hadoop environment variables
haadmin run a DFS HA admin client
fsck run a DFS filesystem checking utility
balancer run a cluster balancing utility
jmxget get JMX exported values from NameNode or DataNode.
mover run a utility to move block replicas across
storage types
oiv apply the offline fsimage viewer to an fsimage
oiv_legacy apply the offline fsimage viewer to an legacy fsimage
oev apply the offline edits viewer to an edits file
fetchdt fetch a delegation token from the NameNode
getconf get config values from configuration
groups get the groups which users belong to
snapshotDiff diff two snapshots of a directory or diff the
current directory contents with a snapshot
lsSnapshottableDir list all snapshottable dirs owned by the current user
Use -help to see options
portmap run a portmap service
nfs3 run an NFS version 3 gateway
cacheadmin configure the HDFS cache
crypto configure HDFS encryption zones
storagepolicies list/get/set block storage policies
version print the version
Most commands print help when invoked w/o parameters.
为什么我们不能通过用户hdfs在远程机器上执行hdfs任务?
1条答案
按热度按时间xa9qqrwz1#
运行此命令时,单引号由本地shell示例处理。命令
ssh
在远程系统上运行的请求是:ssh $hadoop_machine su hdfs -c '"hdfs fsck /"'
or
ssh $hadoop_machine 'su hdfs -c "hdfs fsck /"'
su hdfs -c "hdfs fsck /"