UserGroupsMapping

更新时间:
复制 MD 格式

Run the UserGroupsMapping command to manage and query the mappings between users and user groups.

Prerequisites

Step 1: Configure environment variables

  1. Connect to an ECS instance. For more information, see Connect to an ECS instance.

  2. Go to the bin directory of the installed JindoSDK JAR package.

    cd jindosdk-x.x.x/bin/
    Note

    x.x.x indicates the version number of the JindoSDK JAR package.

  3. Create a configuration file named jindosdk.cfg, and then add the following parameters to the configuration file.

    [common] Retain the following default configurations. 
    logger.dir = /tmp/jindo/
    logger.sync = false
    logger.consolelogger = false
    logger.level = 0
    logger.verbose = 0
    logger.cleaner.enable = true
    hadoopConf.enable = false
    
    [jindosdk] Specify the following parameters. 
    <!-- In this example, the China (Hangzhou) region is used. Specify your actual region.  -->
    fs.oss.endpoint = cn-hangzhou.oss-dls.aliyuncs.com
    <! -- Configure the AccessKey ID and AccessKey secret that is used to access OSS-HDFS.  -->
    fs.oss.accessKeyId = yourAccessKeyId    
    fs.oss.accessKeySecret = yourAccessKeySecret                                        
  4. Configure environment variables.

    export JINDOSDK_CONF_DIR=<JINDOSDK_CONF_DIR>

    Set <JINDOSDK_CONF_DIR> to the absolute path of the jindosdk.cfg configuration file.

Step 2: Manage the mappings between users and user groups

Map users to user groups

  • Command syntax

    ./jindo admin -addUserGroupsMapping \
                    [-dlsUri <uri>] \
                    [-user <user>] \
                    [-groups <group1,group2...>]
  • Example

    The following command maps user1 to group1 and group2:

    ./jindo admin -addUserGroupsMapping \
                    -dlsUri oss://examplebucket.cn-shanghai.oss-dls.aliyuncs.com \
                    -user user1 \
                    -groups group1,group2

Query the user groups to which users are mapped

  • Command syntax

    ./jindo admin -listUserGroupsMappings \
                    [-dlsUri <dlsUri>] \
                    [-maxKeys <maxKeys>] \
                    [-marker <marker>]
  • Example

    The following command queries the user groups of up to 10 users whose names contain the string "test":

    ./jindo admin -listUserGroupsMappings \
                    -dlsUri oss://examplebucket.cn-shanghai.oss-dls.aliyuncs.com \
                    -maxKeys 10 \
                    -marker test

    The -maxKeys and -marker options are optional.

    • -maxKeys specifies the maximum number of users to return.

    • -marker filters users whose names contain the specified string.

Delete the mappings between users and user groups

  • Command syntax

    ./jindo admin -deleteUserGroupsMapping \
                     [-dlsUri <uri>] \
                     [-user <user>]
  • Example

    The following command deletes the mappings between user1 and all user groups to which user1 belongs:

    ./jindo admin -deleteUserGroupsMapping \
                    -dlsUri oss://examplebucket.cn-shanghai.oss-dls.aliyuncs.com \
                    -user user1