标签:www 单机版 cnblogs -- zookeeper kafka master local software
zookeeper、kafka单机版安装
| 已经安装了jdk1.8、zookeeper3.6.3 |
| |
| 主机名:master |
| 映射:192.168.128.129 master |
| # 将apache-zookeeper-3.6.3-bin.tar.gz上传到服务器 |
| # 解压 |
| tar -zxvf apache-zookeeper-3.6.3-bin.tar.gz |
| # 移动 |
| mv /home/apache-zookeeper-3.6.3-bin/* /usr/local/software/zookeeper-3.6.3 |
| |
| # 配置 |
| vi /etc/profile |
| # 添加如下 |
| export ZOOKEEPER_HOME=/usr/local/software/zookeeper-3.6.3 |
| export PATH=$ZOOKEEPER_HOME/bin:$PATH |
| # 生效 |
| source /etc/profile |
| |
| # 复制 |
| cp /usr/local/software/zookeeper-3.6.3/conf/zoo_sample.cfg /usr/local/software/zookeeper-3.6.3/conf/zoo.cfg |
| # 编辑 |
| vi /usr/local/software/zookeeper-3.6.3/conf/zoo.cfg |
| # 修改如下 |
| dataDir=/opt/software/zookeeper-3.6.3/data |
| dataLogDir=/opt/software/zookeeper-3.6.3/logs |
| |
| # 启动 |
| [root@master conf]# zkServer.sh start |
| ZooKeeper JMX enabled by default |
| Using config: /usr/local/software/zookeeper-3.6.3/bin/../conf/zoo.cfg |
| Starting zookeeper ... STARTED |
| # 查看进程 |
| [root@master conf]# jps |
| 7890 QuorumPeerMain |
| # 查看状态 |
| [root@master conf]# zkServer.sh status |
| ZooKeeper JMX enabled by default |
| Using config: /usr/local/software/zookeeper-3.6.3/bin/../conf/zoo.cfg |
| Client port found: 2181. Client address: localhost. Client SSL: false. |
| Mode: standalone |
| # 停止 |
| zkServer.sh stop |
| # 将kafka_2.12-2.2.1.tgz上传到服务器 |
| # 解压 |
| tar -zxvf kafka_2.12-2.2.1.tgz |
| # 移动 |
| mv /home/kafka_2.12-2.2.1/* /usr/local/software/kafka-2.2.1 |
| |
| # 配置 |
| vi /etc/profile |
| # 配置如下 |
| export KAFKA_HOME=/usr/local/software/kafka-2.2.1 |
| export PATH=$KAFKA_HOME/bin:$PATH |
| # 生效 |
| source /etc/profile |
| |
| # 备份文件 |
| cp /usr/local/software/kafka-2.2.1/config/server.properties /usr/local/software/kafka-2.2.1/config/server.properties.bak |
| # 编辑 |
| vi /usr/local/software/kafka-2.2.1/config/server.properties |
| # 修改如下 |
| log.dirs=/opt/software/kafka-2.2.1/data |
| |
| # 先启动zookeeper |
| # 启动kafka |
| kafka-server-start.sh -daemon $KAFKA_HOME/config/server.properties |
| # 停止 |
| kafka-server-stop.sh |
| # 查看 |
| [root@master config]# jps |
| 8278 Kafka |
| |
| # 测试,创建主题 |
| kafka-topics.sh --create --bootstrap-server master:9092 --topic mytopic01 --partitions 1 --replication-factor 1 |
| # 创建生产者 |
| [root@master config]# kafka-console-producer.sh --broker-list master:9092 --topic mytopic01 |
| >11 |
| >22 |
| # 新开窗口,创建消费者 |
| [root@master ~]# kafka-console-consumer.sh --bootstrap-server master:9092 --topic mytopic01 --from-beginning 1 |
| 11 |
| 22 |
| [root@master config]# kafka-topics.sh --create --bootstrap-server master:9092 --topic mytopic01 --partitions 1 --replication-factor 1 |
| Exception in thread "main" joptsimple.UnrecognizedOptionException: bootstrap-server is not a recognized option |
| at joptsimple.OptionException.unrecognizedOption(OptionException.java:108) |
| at joptsimple.OptionParser.handleLongOptionToken(OptionParser.java:510) |
| at joptsimple.OptionParserState$2.handleArgument(OptionParserState.java:56) |
| at joptsimple.OptionParser.parse(OptionParser.java:396) |
| at kafka.admin.TopicCommand$TopicCommandOptions.<init>(TopicCommand.scala:361) |
| at kafka.admin.TopicCommand$.main(TopicCommand.scala:44) |
| at kafka.admin.TopicCommand.main(TopicCommand.scala) |
| |
| # 解决方案:安装kafka_2.12-2.2.1.tgz及以上的版本 |
原文链接:https://www.cnblogs.com/dogleftover/p/17899088.html
标签:www,
单机版,
cnblogs,
--,
zookeeper,
kafka,
master,
local,
software
From: https://www.cnblogs.com/sunny3158/p/18330139