2

I wrote the following cli in order to write version to HDFS on remote machine

Note - The following CLI is also create the file - /user/version

echo $version 
0.21

ssh $remote_machine "su hdfs -c \"echo $version | hadoop fs -appendToFile - /user/version\" "

I give explain about the Cli

I am using ssh to remote machine in order to write the content of the variable - $version to /user/version ( while /user/version is HDFS file )

cli succeeded but this approach appending the version when cli run couple of times , and what we want is write the version without appending

example what we got ( on the remote machine )

su hdfs
$ hdfs dfs -cat /user/version
0.21
0.21
0.21

while the expected output should be

su hdfs
$ hdfs dfs -cat /user/version
0.21

summary:

cli should create the HDFS file - /user/version , and write the $version to file

jessica
  • 2,426
  • 24
  • 66

0 Answers0