服务器:
#vim /etc/hosts
10.16.166.90 sh-xxx-xxx-xxx-online-01
10.16.168.220 sh-xx-xxx-xxx-online-02
10.16.167.15 sh-xxx-xxx-xxx-online-03

#vim /etc/yum.repos.d/cdh.repo
[myrepo]
name=myrepo
baseurl=http://172.19.30.51/cdh/5
enabled=1
gpgcheck=0

#yum install -y zookeeper-server zookeeper

vim /etc/zookeeper/conf/zoo.cfg

maxClientCnxns=100
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
dataDir=/data/zookeeper
# the port at which the clients will connect
clientPort=2181
# the directory where the transaction logs are stored.
dataLogDir=/data/zookeeper
autopurge.purgeInterval=6
autopurge.snapRetainCount=20
server.1=10.16.166.90:2888:3888
server.2=10.16.168.220:2888:3888
server.3=10.16.167.15:2888:3888

#mkdir -p /data/zookeeper

初始化zookeeper
# zookeeper-server-initialize
No myid provided, be sure to specify it in /services/data/hadoop/zookeeper/myid if using non-standalone

手动生成一个myid文件,id号根据填写配置文件中server.后面的号码
例如10.16.166.90
echo 1 > /data/zookeeper/myid

例如10.16.168.220
echo 2 > /data/zookeeper/myid

10.16.167.15
echo 3 > /data/zookeeper/myid

修改权限

#chown zookeeper.zookeeper /data/zookeeper/ -R

#ln -sf /usr/local/java/bin/java /usr/sbin/java

启动服务:
sudo service zookeeper-server start

安装kafka

wget http://mirrors.tuna.tsinghua.edu.cn/apache/kafka/0.9.0.1/kafka_2.11-0.9.0.1.tgz

#vim /usr/local/kafka/config/server.properties

##

broker.id=1 #每台ID不一样
listeners=PLAINTEXT://10.16.166.90:9092 ##本地IP
host.name=10.16.166.90 #本地IP
num.network.threads=18
num.io.threads=24
socket.send.buffer.bytes=102400
socket.receive.buffer.bytes=102400
socket.request.max.bytes=104857600
log.dirs=/data/kafka
num.partitions=3
num.recovery.threads.per.data.dir=1
log.flush.interval.messages=10000
log.flush.interval.ms=1000
log.retention.hours=168
log.segment.bytes=1073741824
log.retention.check.interval.ms=300000
zookeeper.connect=10.16.166.90:2181,10.16.168.220:2181,10.16.167.15:2181 ##三台集群
zookeeper.connection.timeout.ms=6000
default.replication.factor = 2
delete.topic.enable=true
unclean.leader.election.enable=false
min.insync.replicas=2

#mkdir /data/kafka

#启动kafka

#nohup bin/kafka-server-start.sh config/server.properties >> kafak.log 2>&1 &
测试KAFAKA;

创建 TOIIC
#kafka-topics.sh --create --zookeeper 10.16.166.90:2181 --replication-factor 2 --partitions 9 --topic dsperrorlog_test

打开消费者
#./kafka-console-consumer.sh --zookeeper 10.16.166.90:2181 --topic dsperrorlog_test
这里可以看到输入的东西

生产者:

#./kafka-console-producer.sh --broker-list 10.16.166.90:9092 --topic dsperrorlog_test
输入任何东西回车

增加JVM端口,

#vim kafka-server-start.sh

if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
export KAFKA_HEAP_OPTS="-Xmx3G -Xms3G" ##修改
export JMX_PORT="9999" ##新增的
fi

##验证zookeeper-client 里面的kafka节点
#zookeeper-client ##
#ls /
#ls /brokers/ids
#get /brokers/ids/1
#get /brokers/ids/2

查看集群状态:

zookeeper-server status

停止:bin/kafka-server-stop.sh config/server.properties

最新文章

  1. Android安全开发之ZIP文件目录遍历
  2. UI: 窗口全屏, 窗口尺寸
  3. spring接收json格式的多个对象参数(变通法)
  4. VC++ 使用WebBrowser控件中html文件以资源形式加载
  5. App右上角数字
  6. WPF中将四个数字字符串值(比如:"10,10,300,300")转为Rect
  7. NYOJ2括号配对问题
  8. #include<string.h>
  9. zoj 1200 Mining
  10. Windows phone 8.1 MessageBox 变了哦!
  11. cocos2dx vs2010打开打印窗口
  12. Group and sum array of hashes by date
  13. EFI安装Win7
  14. as3中去掉字符串两边的空格,换行符
  15. java学习笔记06-条件语句
  16. ubuntu下vim使用方法
  17. WSDL文档
  18. 【转】APK反编译
  19. Spark的Streaming和Spark的SQL简单入门学习
  20. JDBC详解(二)

热门文章

  1. 前端1-----A标签 (锚点)
  2. [译] Ruby如何访问Excel文件
  3. JS基础 —— call、apply 和 bind
  4. vue-awesome-swiper兼容ie9
  5. 英语insuraunce保险insuraunce单词
  6. XML简述
  7. PHP在线批量下载文件
  8. pandas 之 数据清洗-缺失值
  9. MySQL Config--参数innodb_flush_method
  10. 如何提交多个具有相同name属性的表单