Shobhit
Shobhit

Reputation: 23

How to create new user in hadoop

I am new to hadoop. I have done apache hadoop multinode installation and the user name is hadoop. I am using total 3 nodes: 1 namenode and 2 datanodes

I have to create new user for data isolation. I have found few links on google, but those are not working and I am unable to access the hdfs.

**[user1@datanode1~]# hdfs dfs -ls -R /

bash: hdfs: command not found...**

Can someone help me with the steps to create the new user which can access hdfs for data isolation. And on which node I should create the new user.

Thanks

Upvotes: 1

Views: 2316

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191738

Hadoop doesn't have users like Linux does. Users are generally managed by external LDAP/Kerberos systems. By default, there is not even security features, all user-names are based on the HADOOP_USER_NAME environment variable, and can be overriden by export command. Also, by default, the user used is the current username, for example, your command user1@datanode1 # hdfs dfs -ls would actually run hdfs dfs -ls /user/user1, and return an error if that folder doesn't first exist.

However, your actual error is saying that your OS PATH variable does not include $HADOOP_HOME/bin, for example. Edit your .bashrc to fix this.

You'd create an HDFS folder for "user" username with

hdfs dfs -mkdir /user/username
hdfs dfs -chown username /user/username
hdfs dfs -chmod -R 770 /user/username 

And you also should run useradd command on the namenode machine to make sure it knows about a user named "username"

Upvotes: 1

Related Questions