kafka安装
2016-01-11 16:52
190 查看
vim /etc/rc.local /usr/local/kafka0/bin/kafka-server-start.sh -daemon /usr/local/kafka0/config/server.properties & /usr/local/kafka1/bin/kafka-server-start.sh -daemon /usr/local/kafka1/config/server.properties & /usr/local/kafka2/bin/kafka-server-start.sh -daemon /usr/local/kafka2/config/server.properties & 注意:启动参数要加daemon ps aux|grep -v grep| grep kafka ps aux|grep -v grep| grep kafka |awk '{print $2}'|xargs kill -9
#!/bin/bash setup_dir="/usr/local/" kafkaVersion="kafka_2.11-0.9.0.1" localIP=`ifconfig |awk -F'[: ]+' NR==2'{print $4}'` cd $setup_dir wget http://mirror.bit.edu.cn/apache/kafka/0.9.0.1/kafka_2.11-0.9.0.1.tgz tar zxvf ${kafkaVersion}.tgz mv ${kafkaVersion}/config/server.properties ${kafkaVersion}/config/server.properties.bak mkdir ${kafkaVersion}/logs cp -a ${kafkaVersion} kafka0 cp -a ${kafkaVersion} kafka1 cp -a ${kafkaVersion} kafka2 echo "# kafka" >>/etc/rc.local echo "nohup /usr/local/kafka0/bin/kafka-server-start.sh /usr/local/kafka0/config/server.properties &" >>/etc/rc.local echo "nohup /usr/local/kafka1/bin/kafka-server-start.sh /usr/local/kafka1/config/server.properties &" >>/etc/rc.local echo "nohup /usr/local/kafka2/bin/kafka-server-start.sh /usr/local/kafka2/config/server.properties &" >>/etc/rc.local ################################################################################################################# ################################################################################################################# cat >> ${setup_dir}kafka0/config/server.properties << eof ############################# 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=$localIP # 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 ############################# Log Basics ############################# # A comma seperated list of directories under which to store log files log.dirs=${setup_dir}kafka0/logs # The default number of log partitions per topic. More partitions allow greater # parallelism for consumption, but this will also result in more files across # the brokers. num.partitions=1 # The number of threads per data directory to be used for log recovery at startup and flushing at shutdown. # This value is recommended to be increased for installations with data dirs located in RAID array. num.recovery.threads.per.data.dir=1 ############################# Log Retention Policy ############################# # The minimum age of a log file to be eligible for deletion log.retention.hours=168 # A size-based retention policy for logs. Segments are pruned from the log as long as the remaining # segments don't drop below log.retention.bytes. #log.retention.bytes=1073741824 # The maximum size of a log segment file. When this size is reached a new log segment will be created. log.segment.bytes=1073741824 # The interval at which log segments are checked to see if they can be deleted according # to the retention policies log.retention.check.interval.ms=300000 # If log.cleaner.enable=true is set the cleaner will be enabled and individual logs can then be marked for log compaction. log.cleaner.enable=false ############################# Zookeeper ############################# # root directory for all kafka znodes. zookeeper.connect=127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183 # Timeout in ms for connecting to zookeeper zookeeper.connection.timeout.ms=6000 eof ################################################################################################################# ################################################################################################################# cat >> ${setup_dir}kafka1/config/server.properties << eof ############################# Server Basics ############################# # The id of the broker. This must be set to a unique integer for each broker. broker.id=1 ############################# Socket Server Settings ############################# listeners=PLAINTEXT://:9093 # The port the socket server listens on port=9093 # Hostname the broker will bind to. If not set, the server will bind to all interfaces host.name=$localIP # 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 ############################# Log Basics ############################# # A comma seperated list of directories under which to store log files log.dirs=${setup_dir}kafka1/logs # the brokers. num.partitions=1 # The number of threads per data directory to be used for log recovery at startup and flushing at shutdown. # This value is recommended to be increased for installations with data dirs located in RAID array. num.recovery.threads.per.data.dir=1 ############################# Log Retention Policy ############################# # The minimum age of a log file to be eligible for deletion log.retention.hours=168 # The maximum size of a log segment file. When this size is reached a new log segment will be created. log.segment.bytes=1073741824 # The interval at which log segments are checked to see if they can be deleted according # to the retention policies log.retention.check.interval.ms=300000 # By default the log cleaner is disabled and the log retention policy will default to just delete segments after their retention expires. # If log.cleaner.enable=true is set the cleaner will be enabled and individual logs can then be marked for log compaction. log.cleaner.enable=false ############################# Zookeeper ############################# # root directory for all kafka znodes. zookeeper.connect=127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183 # Timeout in ms for connecting to zookeeper zookeeper.connection.timeout.ms=6000 eof ################################################################################################################# ################################################################################################################# cat >> ${setup_dir}kafka2/config/server.properties << eof ############################# Server Basics ############################# # The id of the broker. This must be set to a unique integer for each broker. broker.id=2 ############################# Socket Server Settings ############################# listeners=PLAINTEXT://:9094 # The port the socket server listens on port=9094 # Hostname the broker will bind to. If not set, the server will bind to all interfaces host.name=$localIP # 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 ############################# Log Basics ############################# # A comma seperated list of directories under which to store log files log.dirs=${setup_dir}kafka2/logs # The default number of log partitions per topic. More partitions allow greater # parallelism for consumption, but this will also result in more files across # the brokers. num.partitions=1 # The number of threads per data directory to be used for log recovery at startup and flushing at shutdown. # This value is recommended to be increased for installations with data dirs located in RAID array. num.recovery.threads.per.data.dir=1 ############################# Log Retention Policy ############################# # The minimum age of a log file to be eligible for deletion log.retention.hours=168 # The maximum size of a log segment file. When this size is reached a new log segment will be created. log.segment.bytes=1073741824 # The interval at which log segments are checked to see if they can be deleted according # to the retention policies log.retention.check.interval.ms=300000 # By default the log cleaner is disabled and the log retention policy will default to just delete segments after their retention expires. # If log.cleaner.enable=true is set the cleaner will be enabled and individual logs can then be marked for log compaction. log.cleaner.enable=false ############################# Zookeeper ############################# # server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002". # root directory for all kafka znodes. zookeeper.connect=127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183 # Timeout in ms for connecting to zookeeper zookeeper.connection.timeout.ms=6000 eof rm -rf ${kafkaVersion}
相关文章推荐
- 扛住100亿次请求 如何做一个“有把握”的春晚红包系统?
- xib正确创建可滑动的UIScrollView
- 2015 岁末 祝福 感恩
- 穷举递归和回溯算法终结篇
- Ubuntu下ceph集群配置共享RBD设备
- 兼容各浏览器的强制换行,不论中英文。。。。单词,长串等
- 中文排序哈哈
- 学习Sqlite3 (一)
- MySQL数据库的优化(一)
- 小明交换牌(C语言版)
- C# FTP常用操作
- IOS基础类
- [电视与电脑]电视广告的价值
- Python使用wxPython报错解决方法
- 最长回文子串
- android service 总结(1)
- Android 控件UI自适应解决方案
- spring循环依赖问题分析
- 第七章 数组
- Android之 compileSdkVersion, minSdkVersion, and targetSdkVersion