使用kafka-console-producer.sh向远端Kafka写入数据时遇到以下错误:

1
2
3
4
5
6
7
8
9
10
11
$ bin/kafka-console-producer.sh --broker-list 172.16.72.202:9092 --topic test
This is a message
[2017-08-24 11:47:48,286] ERROR Error when sending message to topic test with key: null, value: 17 bytes with error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for test-0: 1523 ms has passed since batch creation plus linger time
八月 24, 2017 11:50:55 上午 sun.rmi.transport.tcp.TCPTransport$AcceptLoop executeAcceptLoop
警告: RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,localport=38175] throws
java.io.IOException: The server sockets created using the LocalRMIServerSocketFactory only accept connections from clients running on the host where the RMI remote objects have been exported.
at sun.management.jmxremote.LocalRMIServerSocketFactory$1.accept(LocalRMIServerSocketFactory.java:114)
at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:400)
at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:372)
at java.lang.Thread.run(Thread.java:748)

在没有配置advertised.host.name的情况下,Kafka并没有广播我们配置的host.name,而是广播了主机配置的hostname。远端的客户端并没有配置hosts,所以自然是连接不上这个hostname的,所以在远端客户端配置hosts。在客户端/etc/hosts中添加以下内容后问题解决:

阅读全文 »

Producer向Kafka写入数据时遇到异常:org.apache.kafka.common.errors.RecordTooLargeException。该异常是因为单条消息大小超过限制导致的。解决方法是将限制参数调大:

(1)server端:server.properties
message.max.bytes参数默认值为1000012,调整为适合的值,如10485760。

(2)producer端:
设置Producer的参数max.request.size的值与server端的message.max.bytes值一致。

阅读全文 »

在远程执行的命令中如果包含特殊字符($)时需要转义,如下:

1
ssh root@remote_host "ps -ef|grep process_name | grep -v 'grep ' | awk '{print $2}'"

以上语句的本意是得到进程的ID,但实际输出会是进程的信息。应该使用如下形式:

阅读全文 »

今天在运行MR程序时遇到以下信息:

1
17/03/03 10:09:45 INFO mapreduce.Job: Job job_1488363995041_0002 failed with state KILLED due to: REDUCE capability required is more than the supported max container capability in the cluster. Killing the Job. reduceResourceRequest: <memory:4096, vCores:1> maxContainerCapability:<memory:3096, vCores:8>

原因是Reduce Task在申请资源时超过了设置的最大可申请内容量。检查yarn-site.xml中的配置项yarn.scheduler.maximum-allocation-mb,如下:

阅读全文 »
0%