环(循环)缓冲区和队列之间有什么区别?两者都支持FIFO所以在什么情况下我应该在队列中使用环形缓冲区为什么?
与Hadoop的相关性
映射阶段使用环形缓冲区来存储中间密钥值对.在队列中进行此选择的原因是什么?
我正在运行运行MRv1(CDH5)与LocalFileSystem配对的测试集群,并且我能够运行作业的唯一用户是mapred(因为mapred是启动jobtracker/tasktracker守护进程的用户).以任何其他用户身份提交作业时,作业会失败,因为jobtracker/tasktracker无法在.staging目录下找到job.jar.
当与LocalFileSystem配对时,我与YARN(MRv2)有完全相同的问题,即当由'yarn'以外的用户提交作业时,应用程序主机无法在.staging目录下找到job.jar.
在检查提交作业的用户的.staging目录时,我发现job.jar存在于.staging //目录下,但是和.staging目录的权限设置为700(drwx ------)和因此,应用程序master/tasktracker无法访问job.jar和支持文件.
我们使用LocalFileSystem运行测试集群,因为我们在生产设置中仅使用与OCFS配对的Hadoop项目的MapReduce部分.
在这方面的任何援助都将非常有帮助.
我使用Java编写Map reduce Job.设置配置
Configuration configuration = new Configuration();
configuration.set("fs.defaultFS", "hdfs://127.0.0.1:9000");
configuration.set("mapreduce.job.tracker", "localhost:54311");
configuration.set("mapreduce.framework.name", "yarn");
configuration.set("yarn.resourcemanager.address", "localhost:8032");
Run Code Online (Sandbox Code Playgroud)
使用不同的案例运行
案例1:"使用Hadoop和Yarn命令":成功完成工作
案例2:"使用Eclipse":成功做好工作
案例3:"删除所有configuration.set()后使用Java -jar":
Configuration configuration = new Configuration();
Run successful but not display Job status on Yarn (default port number 8088)
Run Code Online (Sandbox Code Playgroud)
案例4:"使用Java -jar":错误
Find stack trace:Exception in thread "main" java.io.IOException: Cannot initialize Cluster. Please check your configuration for mapreduce.framework.name and the correspond server addresses.
at org.apache.hadoop.mapreduce.Cluster.initialize(Cluster.java:120)
at org.apache.hadoop.mapreduce.Cluster.<init>(Cluster.java:82)
at org.apache.hadoop.mapreduce.Cluster.<init>(Cluster.java:75)
at org.apache.hadoop.mapreduce.Job$9.run(Job.java:1255)
at org.apache.hadoop.mapreduce.Job$9.run(Job.java:1251)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1556)
at …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Hive(0.13)msck repair table命令来恢复分区,它只列出未添加到Metastore的分区,而不是将它们添加到Metastore中.
这是命令的输出
partitions not in metastore externalexample:CreatedAt=26 04%3A50%3A56 UTC 2014/profileLocation="Chicago"
Run Code Online (Sandbox Code Playgroud)
这是我如何创建外部表
CREATE EXTERNAL TABLE IF NOT EXISTS ExternalExample(
tweetId BIGINT, username STRING,
txt STRING, CreatedAt STRING,
profileLocation STRING,
favc BIGINT,retweet STRING,retcount BIGINT,followerscount BIGINT)
COMMENT 'This is the Twitter streaming data'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
STORED AS TEXTFILE
location '/user/hue/exttable/';
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?
我正在尝试将我的HBase连接到HDFS.我运行了hdfs namenode(bin/hdfs namenode)和datnode(/ bin/hdfs datanode).我也可以启动我的Hbase(sudo ./bin/start-hbase.sh)和本地区域服务器(sudo ./bin/local-regionservers.sh start 1 2).但是当我尝试从Hbase shell执行命令时,它会出现以下错误:
cis655stu@cis655stu-VirtualBox:/teaching/14f-cis655/proj-dtracing/hbase/hbase-0.99.0-SNAPSHOT$ ./bin/hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.99.0-SNAPSHOT, rUnknown, Sat Aug 9 08:59:57 EDT 2014
hbase(main):001:0> list
TABLE
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/teaching/14f-cis655/proj-dtracing/hbase/hbase-0.99.0-SNAPSHOT/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/teaching/14f-cis655/proj-dtracing/hadoop-2.6.0/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
2015-01-19 13:33:07,179 WARN [main] util.NativeCodeLoader: Unable to load …Run Code Online (Sandbox Code Playgroud) 我是Spark和MLlib的新手,我正试图从我的java应用程序调用StreamingKMeans,我得到一个我似乎不理解的异常.这是我转换训练数据的代码:
JavaDStream<Vector> trainingData = sjsc.textFileStream("/training")
.map(new Function<String, Vector>() {
public DenseVector call(String line) throws Exception {
String[] lineSplit = line.split(",");
double[] doubleValues = new double[lineSplit.length];
for (int i = 0; i < lineSplit.length; i++) {
doubleValues[i] = Double.parseDouble(lineSplit[i] != null ? !""
.equals(lineSplit[i]) ? lineSplit[i] : "0" : "0");
}
DenseVector denseV = new DenseVector(doubleValues);
if (denseV.size() != 16) {
throw new Exception("All vectors are not the same size!");
}
System.out.println("Vector length is:" + denseV.size());
return denseV;
}
});
Run Code Online (Sandbox Code Playgroud)
这里是我调用trainOn方法的代码: …
我正在将数据迁移到Hive 1.2,我意识到默认情况下,我不再被允许使用保留字作为列名。如果要使用保留字,则需要显式设置以下设置:
hive.support.sql11.reserved.keywords=false
Run Code Online (Sandbox Code Playgroud)
我的问题是,更改此默认值是否会导致任何意外的问题?更改之前我应该注意什么问题?
顺便说一下,此更改记录在此票证中:https : //issues.apache.org/jira/browse/HIVE-6617
我正在尝试在Hive中编写一个简单的查询(只是一个INSERT),但是我对如何配置MapReduce作业有疑问。容器已正确分配,但我的作业永远无法运行。
看来他们联系不正确。我已经验证(通过JPS)我的ResourceManager确实正在运行,并且正在hadoop1.personal所有服务器在/ etc / hosts中都有引用的主机名上运行。问题看起来像这样:
2016-09-27 09:41:55,223 INFO [main] org.apache.hadoop.ipc.CallQueueManager: Using callQueue class java.util.concurrent.LinkedBlockingQueue
2016-09-27 09:41:55,224 INFO [Socket Reader #1 for port 45744] org.apache.hadoop.ipc.Server: Starting Socket Reader #1 for port 45744
2016-09-27 09:41:55,230 INFO [IPC Server Responder] org.apache.hadoop.ipc.Server: IPC Server Responder: starting
2016-09-27 09:41:55,230 INFO [IPC Server listener on 45744] org.apache.hadoop.ipc.Server: IPC Server listener on 45744: starting
2016-09-27 09:41:55,299 INFO [main] org.apache.hadoop.mapreduce.v2.app.rm.RMContainerRequestor: nodeBlacklistingEnabled:true
2016-09-27 09:41:55,300 INFO [main] org.apache.hadoop.mapreduce.v2.app.rm.RMContainerRequestor: maxTaskFailuresPerNode is 3
2016-09-27 09:41:55,300 INFO [main] org.apache.hadoop.mapreduce.v2.app.rm.RMContainerRequestor: blacklistDisablePercent is …Run Code Online (Sandbox Code Playgroud) 我的MapReduce必须从HBase读取记录并需要写入zip文件.我们的客户特别询问减速器输出文件应该只是.zip文件.
为此,我编写了ZipFileOutputFormat包装来压缩记录并写入zip文件.
此外,我们不能使用缓冲区并将所有行保留到缓冲区然后迭代,因为某些文件包含19GB的记录,那时它将抛出一个java.lang.OutOfMemoryError.
一切似乎都好,但有一个问题:
该.zip是越来越为每个键创建的文件.在我的输出文件中,我可以看到许多输出文件,这些是每行键分隔文件.我不知道如何将它组合在zip文件中.
这是我的实施 ZipFileOutputFormat.java
public class ZipFileOutputFormat<K, V> extends FileOutputFormat<K, V> {
public static class ZipRecordWriter<K, V> extends org.apache.hadoop.mapreduce.RecordWriter<K, V> {
private ZipOutputStream zipOut;
public ZipRecordWriter(FSDataOutputStream fileOut) {
zipOut = new ZipOutputStream(fileOut);
}
@Override
public void close(TaskAttemptContext context) throws IOException, InterruptedException {
// TODO Auto-generated method stub
zipOut.closeEntry();
zipOut.finish();
zipOut.close();
zipOut.flush();
}
@Override
public void write(K key, V value) throws IOException {
String fname = null;
if (key instanceof …Run Code Online (Sandbox Code Playgroud) 我正在向YARN(在spark 2.1.1 + kafka 0.10.2.1上)提交一份工作,该工作连接到一个安全的hbase集群.当我在"本地"模式下运行时,这项工作表现得很好(spark.master = local [*]).
但是,只要我将master作为YARN提交作业(并将部署模式作为客户端),我就会看到以下错误消息 -
Caused by: javax.security.auth.login.LoginException: Unable to obtain password from user
Run Code Online (Sandbox Code Playgroud)
我正在按照hortonworks的建议向纱线集群提供关于HBase和keytab等的信息.遵循这篇kb文章 - https://community.hortonworks.com/content/supportkb/48988/how-to-run-spark-job-to -interact与-固定-hbas.html
什么指针可能会发生什么?
登录HBase的机制:
UserGroupInformation.setConfiguration(hbaseConf)
val keyTab = "keytab-location")
val principal = "kerberos-principal"
val ugi = UserGroupInformation.loginUserFromKeytabAndReturnUGI(principal, keyTab)
UserGroupInformation.setLoginUser(ugi)
ugi.doAs(new PrivilegedExceptionAction[Void]() {
override def run: Void = {
hbaseCon = Some(ConnectionFactory.createConnection(hbaseConf))
null
}
})
Run Code Online (Sandbox Code Playgroud)
此外,我尝试了登录的替代机制,如下所示:
UserGroupInformation.loginUserFromKeytab(principal, keyTab)
connection=ConnectionFactory.createConnection(hbaseConf)
Run Code Online (Sandbox Code Playgroud)
请建议.
hbase kerberos apache-spark hadoop2 spark-structured-streaming
hadoop2 ×10
hadoop ×6
apache-spark ×2
hadoop-yarn ×2
hbase ×2
hive ×2
java ×2
mapreduce ×2
bigdata ×1
cloudera-cdh ×1
eclipse ×1
hdfs ×1
hiveql ×1
kerberos ×1
zip ×1