HDFS NFS locations using weird numerical username values for directory permissions

前端 未结 1 1690
旧巷少年郎
旧巷少年郎 2020-12-04 03:32

Seeing nonsense values for user names in folder permissions for NFS mounted HDFS locations, while the HDFS locations themselves (using Hortonworks HDP 3.1) appear fine. Eg.<

相关标签:
1条回答
  • 2020-12-04 04:26

    After talking with someone more knowledgeable in HDP hadoop, found that the problem is that when Ambari was setup and run to initially install the hadoop cluster, there may have been other preexisting users on the designated cluster nodes.

    Ambari creates its various service users by giving them the next available UID of a nodes available block of user UIDs. However, prior to installing Ambari and HDP on the nodes, I created some users on the to-be namenode (and others) in order to do some initial maintenance checks and tests. I should have just done this as root. Adding these extra users offset the UID counter on those nodes and so as Ambari created users on the nodes and incremented the UIDs, it was starting from different starting counter values. Thus, the UIDs did not sync and caused problems with HDFS NFS.

    To fix this, I...

    1. Used Ambari to stop all running HDP services
    2. Go to Service Accounts in Ambari and copy all of the expected service users name strings
    3. For each user, run something like id <service username> to get the group(s) for each user. For service groups (which may have multiple members), can do something like grep 'group-name-here' /etc/group. I recommend doing it this way as the Ambari docs of default users and groups does not have some of the info that you can get here.
    4. Use userdel and groupdel to remove all the Ambari service users and groups
    5. Then recreate all the groups across the cluster
    6. Then recreate all the users across the cluster (may need to specify UID if nodes have other users not on others)
    7. Restart the HDP services (hopefully everything should still run as if nothing happend, since HDP should be looking for the literal string (not the UIDs))

    For the last parts, can use something like clustershell, eg.

    # remove user
    $ clush -ab userdel <service username>
    # check that the UID you want to use is actually available on all nodes
    $ clush -ab id <some specific UID you want to use>
    # assign that UID to a new service user
    $ clush -ab useradd --uid <the specific UID> --gid <groupname> <service username>
    

    To get the lowest common available UID from each node, used...

    # for UID
    getent passwd | awk -F: '($3>1000) && ($3<10000) && ($3>maxuid) { maxuid=$3; } END { print maxuid+1; }'
    # for GID
    getent passwd | awk -F: '($4>1000) && ($4<10000) && ($4>maxuid) { maxuid=$4; } END { print maxuid+1; }'
    

    Ambari also creates some /home dirs for users. Once you are done recreating the users, will need to change the permissions for the dirs (can also use something like clush there as well).

    * Note that this was a huge pain and you would need to manually correct the UIDs of users whenever you added another cluster node. I did this for a test cluster, but for production (or even a larger test) you should just useKerberos or SSSD + Active Directory.

    0 讨论(0)
提交回复
热议问题