1、测试脚本:
./kafka-producer-perf-test.sh --topic test-ref-11 --num-records 200000 --record-size 200 --throughput 300000 --producer-props bootstrap.servers=192.168.3.15:9092,192.168.3.25:9092,192.168.3.35:9092
2、三台机器的配置如下(server.properties)
############################# Server Basics #############################
# The id of the broker. This must be set to a unique integer for each broker.
broker.id=0
############################# Socket Server Settings #############################
listeners=PLAINTEXT://:9092
# The port the socket server listens on
port=9092
# Hostname the broker will bind to. If not set, the server will bind to all interfaces
host.name=192.168.3.15
# Hostname the broker will advertise to producers and consumers. If not set, it uses the
# value for "host.name" if configured. Otherwise, it will use the value returned from
# java.net.InetAddress.getCanonicalHostName().
#advertised.host.name=<hostname routable by clients>
advertised.host.name=192.168.3.15
# The port to publish to ZooKeeper for clients to use. If this is not set,
# it will publish the same port that the broker binds to.
advertised.port=9092
# The number of threads handling network requests
num.network.threads=3
# The number of threads doing disk I/O
num.io.threads=8
# The send buffer (SO_SNDBUF) used by the socket server
socket.send.buffer.bytes=102400
# The receive buffer (SO_RCVBUF) used by the socket server
socket.receive.buffer.bytes=102400
# The maximum size of a request that the socket server will accept (protection against OOM)
socket.request.max.bytes=104857600
############################# Zookeeper #############################
# Zookeeper connection string (see zookeeper docs for details).
# This is a comma separated host:port pairs, each corresponding to a zk
# server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002".
# You can also append an optional chroot string to the urls to specify the
# root directory for all kafka znodes.
zookeeper.connect=192.168.3.15:2182,192.168.3.25:2182,192.168.3.35:2182
# Timeout in ms for connecting to zookeeper
zookeeper.connection.timeout.ms=6000
#######################Producer#####################
#批处理大小,默认值为16384
batch.size=36384
# 从发送请求到收到ACK确认等待的最长时间(超时时间),默认值为30000
request.timeout.ms = 500000
#默认值为30000
timeout.ms=500000
你的答案