Hadoop中创建的HDFS目录在哪里?(Where are HDFS directories created in Hadoop?)
我在伪分布模式下运行一个简单的,我的脚湿的地图缩减工作,如下所示:
bin/hadoop jar tm.jar TestMap input output
它第一次运行正常,但在第二次运行时,我得到以下内容:
Exception in thread "main" org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory hdfs://localhost:9000/user/tom/output already exists
创建HDFS目录的初始命令使用hadoop命令:
$ bin/hdfs dfs -mkdir /user $ bin/hdfs dfs -mkdir /user/<username>
几个问题:
- 这些HDFS目录在哪里创建并且可以删除,如果已经存在的话?
- 什么是避免这种情况的最佳做法?
I am running a simple, get-my-feet-wet, map reduce job, in pseudo-distributed mode as so:
bin/hadoop jar tm.jar TestMap input output
It ran fine the first time but on the second run, I am getting the following:
Exception in thread "main" org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory hdfs://localhost:9000/user/tom/output already exists
The initial commands that created the HDFS directories, use a hadoop command:
$ bin/hdfs dfs -mkdir /user $ bin/hdfs dfs -mkdir /user/<username>
A few questions:
- Where are these HDFS directories created and can they be deleted, if already exsist?
- What's best practice for avoiding this?
原文:https://stackoverflow.com/questions/41807917
最满意答案
你忘了使用
^
(字符串的开头)和$
(字符串的结尾)所以,它应该是
/^([a-z]+)(,\s*[a-z]+)*$/i
如果没有
^
,$
它将匹配字符串之间的任何位置..与^
,$
你使它完全匹配You forgot to use
^
(start of the string) and$
(end of the string)So,it should be
/^([a-z]+)(,\s*[a-z]+)*$/i
Without
^
,$
it would match anywhere in between the string..With^
,$
you are making it match exactly
相关问答
更多-
Javascript正则表达式分隔逗号分隔的字符串中的单词(Javascript regex splitting words in a comma separated string)[2022-06-13]
使用否定字符类: /([^,]+)/g 将匹配非逗号组。 < a = 'hi,mr.007,bond,12:25PM' > "hi,mr.007,bond,12:25PM" < b=/([^,]+)/g > /([^,]+)/g < a.match(b) > ["hi", "mr.007", "bond", "12:25PM"] Use a negated character class: /([^,]+)/g will match groups of non-commas. < a = 'hi,mr ... -
你可以用regex /,[^,]+$/和replace()来匹配最后一个字符串 var str = "a,b,c,d,e,old"; var res = str.replace(/,[^,]+$/, ",new"); // or you can just use // var res = str.replace(/[^,]+$/, "new"); document.write(res); 或者你可以使用正则表达式 str.replace(/[^,]+$/, "new"); var str = "a, ...
-
我不知道,单独的值应该是什么样的,但这可能是有用的,可以帮助你 $value = '[0-9 A-Z]+'; $match = "~^$value(,$value)*$~i"; 如果您知道,您的值应该是什么样的,您可以更改$value 。 更新 从问题中获取此评论 我试图禁止0-9,但允许aZ,因为,正如我所说,它应该只是一个单词列表,没有空格,只是单个单词列表。 只需改变$value $value = '[A-Z]+'; 注意,我在$match使用i -modifier,它也包括所有小写字母。 但是, ...
-
使用命名的捕获组并使用(DEFINE)为子模式命名,以大大提高可读性。 #! /usr/bin/env perl use strict; use warnings; use 5.10.0; # for named capture buffer and (?&...) my $second_trimmed_field_pattern = qr/ (?&FIRST_FIELD) (?&SEP) (?
(?&SECOND_FIELD)) (?(DEFINE) # The sepa ... -
正则表达式逗号分隔电子邮件(Regex Comma Separated Emails)[2024-04-18]
正如Pablo所说,你可以通过首先分割逗号来大大简化事情,然后重复应用正则表达式来验证每封电子邮件。 你也可以指出一个不好的 - 但是有一个很大的警告。 在比较电子邮件地址验证正则表达式一文中查看正则表达式 。 还有一个我刚才找不到的更好的正则表达式,但关键是检查电子邮件的正确正则表达非常复杂,因为RFC中指定的有效电子邮件地址的规则非常复杂。 在你的身上,这部分(\.[az]{2,3})+跳了出来; 两三个字母组{2,3}我经常将其视为尝试验证顶级域名,但(1)您的正则表达式允许这些组中的一个或多个 ,以 ... -
要验证整个字符串处理由逗号分隔的多个值,只需添加一个带*乘数的组: ^\+\d{8,11}(,\+\d{8,11})*$ To validate the whole string handling mulitple values sepparated by comma just add an group with * multiplier: ^\+\d{8,11}(,\+\d{8,11})*$
-
伊兰,哦,你终于用vim标记了这个问题,真好! ^ _ ^ vim可以格式化一下,我写了一个小函数: 请注意,我使用\r作为换行符,如果它不适合您,请更改为\n function! ExpandMap() let s = line('.') exec 'silent s/(/(\r/g' let e = line('.') exec 'silent '.s.','.e.'s/),\=/\r&\r/g' let e = line('.') exec 'silen ...
-
使用正则表达式验证逗号分隔的单词串的格式(Validate the format of a string of comma separated words with regex)[2023-12-17]
你忘了使用^ (字符串的开头)和$ (字符串的结尾) 所以,它应该是 /^([a-z]+)(,\s*[a-z]+)*$/i 如果没有^ , $它将匹配字符串之间的任何位置..与^ , $你使它完全匹配 You forgot to use ^(start of the string) and $(end of the string) So,it should be /^([a-z]+)(,\s*[a-z]+)*$/i Without ^,$ it would match anywhere in betwe ... -
您可以使用以下模式检查字符串结构: ^(?:(?:^|\s*[&|]{2}\s*)\([^|)]+(?:\s*\|\|\s*[^|)]+)*\))*$ 如果&&也可以在括号内,你可以使用: ^(?:(?:^|\s*[&|]{2}\s*)\([^&|)]+(?:\s*[&|]{2}\s*[^&|)]+)*\))*$ 如果您的替换模式是好的,您不需要检查父项和“子”是否具有相同的结构。 注意:如果要允许空括号,请将所有+量词替换为* You can check your string structure w ...
-
逗号分隔字符串的正则表达式(2个字符串以逗号分隔)(regex for comma separated string (2 strings separated by comma))[2022-08-20]
string1和string2都只能包含字母表。 [a-zA-Z] -用于表示字符类中的范围。 在这里我们说,它可以是a和z或A和Z之间a任何字母表。 string1和string2的长度不得超过20 string1和string2不能为空 [a-zA-Z]{1,20} 这意味着,匹配最小1和最多20个字母。 只能出现2个字符串(string1,string2,string应无效) /^[a-zA-Z]{1,20},[a-zA-Z]{1,20}$/ ^表示字符串的开头, $表示字符串的结尾。 您可以检 ...