[ https://issues.apache.org/jira/browse/HADOOP-14976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16219394#comment-16219394 ]
Allen Wittenauer commented on HADOOP-14976: ------------------------------------------- bq. allow multi-versioning Ignoring the whole Linux alternatives bits, it's probably easier to write a custom hdfs wrapper that does this. e.g.: /usr/bin/hdfs = wrapper /usr/hadoop-3.0.0/bin/hdfs = 3.0.0 hdfs /usr/hadoop-3.1.0/bin/hdfs = 3.1.0 hdfs /usr/hadoop-default symlink to hadoop-3.0.0 wrapper basically adds --version parameter: hdfs --version 3.0.0 foo => exec /usr/hadoop-3.0.0/bin/hdfs hdfs --version 3.1.0 foo => exec /usr/hadoop-3.1.0/bin/hdfs hdfs foo => exec /usr/hadoop-default/bin/hdfs Plus this works with any version of Hadoop.... and it's a relatively simple script. (10 lines max?) You can also cheat and use .hadoop-env / .hadooprc to do some of the same sorts of things for individual users, but that's a bit more complicated. > Allow overriding HADOOP_SHELL_EXECNAME > -------------------------------------- > > Key: HADOOP-14976 > URL: https://issues.apache.org/jira/browse/HADOOP-14976 > Project: Hadoop Common > Issue Type: Improvement > Reporter: Arpit Agarwal > > Some Hadoop shell scripts infer their own name using this bit of shell magic: > {code} > 18 MYNAME="${BASH_SOURCE-$0}" > 19 HADOOP_SHELL_EXECNAME="${MYNAME##*/}" > {code} > e.g. see the > [hdfs|https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs#L18] > script. > The inferred shell script name is later passed to _hadoop-functions.sh_ which > uses it to construct the names of some environment variables. E.g. when > invoking _hdfs datanode_, the options variable name is inferred as follows: > {code} > # HDFS + DATANODE + OPTS -> HDFS_DATANODE_OPTS > {code} > This works well if the calling script name is standard {{hdfs}} or {{yarn}}. > If a distribution renames the script to something like foo.bar, , then the > variable names will be inferred as {{FOO.BAR_DATANODE_OPTS}}. This is not a > valid bash variable name. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org