Hadoop create user and HDFs permissions, HDFs operations, and other common shell commands

Source: Internet
Author: User
Tags chmod safe mode hadoop fs
Add a Hadoop group
sudo addgroup Hadoop

Add the current user Larry to the Hadoop group
sudo usermod-a-G Hadoop Larry

Add Hadoop Group to Sudoer
sudo gedit etc/sudoers
Hadoop all= (All) after Root all= (all)

Modify the permissions for the Hadoop directory
sudo chown-r larry:hadoop/home/larry/hadoop< owners: Group files >

Modify permissions for HDFs
sudo chmod-r 755/home/larry/hadoop
sudo bin/hadoop dfs-chmod-r 755/
sudo bin/hadoop dfs-ls/

Modify the owner of the HDFs file
sudo bin/hadoop fs-chown-r Larry/

Unlock Hadoop's Safe mode
sudo bin/hadoop dfsadmin-safemode leave

Copy Local files to HDFs
Hadoop fs-copyfromlocal <localsrc> URI

Prints the contents of the file to the stdout
Hadoop fs-cat file:///file3/user/hadoop/file4

Change the group to which the file belongs
Hadoop FS-CHGRP [-R] GROUP URI

Changing user access rights
Hadoop Fs-chmod [-r] 755 URI

Modify the owner of a file
Hadoop Fs-chown [R] [Owner][:[group]] uri [URI]

Copy hdfs file to local
Hadoop fs-copytolocal URI LOCALDST

Copy hdfs file to other directory
Hadoop fs-cp uri [uri ...] <dest>

Displays the size of all files in the directory
Hadoop fs-du uri [uri ...]

Merging files to local directory
Hadoop fs-getmerge <src> <localdst> [ADDNL]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.