网站做内嵌,深圳网站,深圳社保个人网页,网络营销模式目录 一.先安装zookeeper并启动
二.安装kafka 一.先安装zookeeper并启动
1.下载 https://www.apache.org/dyn/closer.lua/zookeeper/zookeeper-3.8.2/apache-zookeeper-3.8.2-bin.tar.gz
2.上传到Linux任意目录下
3.解压到/user/local/文件夹下
[rootlocalhost app]# tar …目录 一.先安装zookeeper并启动
二.安装kafka 一.先安装zookeeper并启动
1.下载 https://www.apache.org/dyn/closer.lua/zookeeper/zookeeper-3.8.2/apache-zookeeper-3.8.2-bin.tar.gz
2.上传到Linux任意目录下
3.解压到/user/local/文件夹下
[rootlocalhost app]# tar -zxvf ./apache-zookeeper-3.8.2-bin.tar.gz -C /usr/local/
4.切换到/usr/local/下
[rootlocalhost app]# cd /usr/local/
5.修改文件改名 [rootlocalhost local]# mv ./apache-zookeeper-3.8.2-bin/ ./apache-zookeeper-3.8.2/
6.在安装目录下创建文件夹 [rootlocalhost local]# cd ./apache-zookeeper-3.8.2/[rootlocalhost apache-zookeeper-3.8.2]# mkdir data[rootlocalhost apache-zookeeper-3.8.2]# mkdir logs[rootlocalhost apache-zookeeper-3.8.2]# lsbin conf data docs lib LICENSE.txt logs NOTICE.txt README.md README_packaging.md
7.修改配置文件
[rootlocalhost conf]# vim ./zoo_sample.cfg# The number of milliseconds of each ticktickTime2000# The number of ticks that the initial# synchronization phase can takeinitLimit10# The number of ticks that can pass between# sending a request and getting an acknowledgementsyncLimit5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just# example sakes.dataDir/usr/local/apache-zookeeper-3.8.2/data # 修改按照刚新建文件夹的目录dataLogDir/usr/local/apache-zookeeper-3.8.2/log # 新增按照刚新建文件夹的目录# the port at which the clients will connectclientPort2181# the maximum number of client connections.# increase this if you need to handle more clients#maxClientCnxns60## Be sure to read the maintenance section of the# administrator guide before turning on autopurge.## https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance## The number of snapshots to retain in dataDir#autopurge.snapRetainCount3# Purge task interval in hours# Set to 0 to disable auto purge feature#autopurge.purgeInterval1## Metrics Providers## https://prometheus.io Metrics Exporter#metricsProvider.classNameorg.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider#metricsProvider.httpHost0.0.0.0#metricsProvider.httpPort7000#metricsProvider.exportJvmInfotrue
8.修改配置文件名称 [rootlocalhost conf]# mv ./zoo_sample.cfg ./zoo.cfg
7.启动zookeeper [rootlocalhost conf]# /usr/local/apache-zookeeper-3.8.2/bin/zkServer.sh start/usr/bin/javaZooKeeper JMX enabled by defaultUsing config: /usr/local/apache-zookeeper-3.8.2/bin/../conf/zoo.cfgStarting zookeeper ... STARTED
9.查看zookeeper状态 [rootlocalhost conf]# /usr/local/apache-zookeeper-3.8.2/bin/zkServer.sh status/usr/bin/javaZooKeeper JMX enabled by defaultUsing config: /usr/local/apache-zookeeper-3.8.2/bin/../conf/zoo.cfgClient port found: 2181. Client address: localhost. Client SSL: false.Mode: standalone
10.连接服务 [rootlocalhost conf]# /usr/local/apache-zookeeper-3.8.2/bin/zkCli.sh 服务停止命令扩展命令 [rootlocalhost conf]# /usr/local/apache-zookeeper-3.8.2/bin/zkServer.sh stop/usr/bin/javaZooKeeper JMX enabled by defaultUsing config: /usr/local/apache-zookeeper-3.8.2/bin/../conf/zoo.cfgStopping zookeeper ... STOPPED
二.安装kafka
1.下载kafka https://kafka.apache.org/downloads下载的是3.5.0Scala 2.12 - kafka_2.12-3.5.1.tgz (asc, sha512)
2.解压到/usr/local文件夹下并改文件夹的名称 [rootlocalhost app]# tar -zxvf ./kafka_2.12-3.5.1.tgz -C /usr/local/
3.进入Kafka新建日志文件夹 [rootlocalhost local]# cd /usr/local/kafka_2.12-3.5.1[rootlocalhost kafka_2.12-3.5.1]# mkdir ./log/
4.修改配置文件 [rootlocalhost kafka_2.12-3.5.1]# vim ./config/server.properties需要改一下信息# broker的编号如果集群中有多个broker,则每个broker的编号需要设置的不同同zookeeper一致就可以broker.id0# 存放消息日志文件地址log.dirs/usr/local/kafka_2.12-3.5.1/log/# broker对外提供服务的入口地址advertised.listenersPLAINTEXT://192.168.154.128:9092 (192.168.154.128是我虚拟机的IP地址)
5.单机形式启动kafka [rootlocalhost kafka_2.12-3.5.1]# bin/kafka-server-start.sh -daemon config/server.properties
6.停止kafka [rootlocalhost kafka_2.12-3.5.1]bin/kafka-server-stop.sh