当前位置: 首页 > news >正文

四川省营山县西城建筑公司网站人际网络营销2900

四川省营山县西城建筑公司网站,人际网络营销2900,做自适应网站注意事项,网站建设是属于虚拟产品吗文章目录 安装jdk配置主机名Zookeeper 下载与安装Kafka 下载与安装测试集群版安装测试输出 安装jdk 略 配置主机名 hostnamectl set-hostname kafka_1 /etc/sysconfig/network HOSTNAMEkafka_1/etc/hosts ip kafka_1ping kafka_1 测试 Zookeeper 下载与安装 由于 集群…

文章目录

  • 安装jdk
  • 配置主机名
  • Zookeeper 下载与安装
  • Kafka 下载与安装
  • 测试
  • 集群版安装
    • 测试
    • 输出


安装jdk

配置主机名

  • hostnamectl set-hostname kafka_1

  • /etc/sysconfig/network

HOSTNAME=kafka_1
  • /etc/hosts
ip  kafka_1
  • ping kafka_1 测试

Zookeeper 下载与安装

  • 由于 集群中的 Leader 的监控 和 Topic 元数据 存储在 Zookeeper 中 ,所以需要安装 zk;
  • https://zookeeper.apache.org/releases.html 中选择需要的版本;
  • conf 目录 复制zoo_sample.cfg 为 zoo.cfg, 修改其中的配置 dataDir 指定自己的目录;
  • 启动zk:使用 zkServer.sh start zoo.cfg
cd /opt/pkg/
wget --no-check-certificate  https://dlcdn.apache.org/zookeeper/zookeeper-3.8.2/apache-zookeeper-3.8.2-bin.tar.gz
tar zxf apache-zookeeper-3.8.2-bin.tar.gz
mv apache-zookeeper-3.8.2-bin ../app/
cd /opt/app/apache-zookeeper-3.8.2-bin/
cp zoo_sample.cfg zoo.cfg
./bin/zkServer.sh start zoo.cfg---
[root@loaclhost bin]# ./zkServer.sh status
/usr/bin/java
ZooKeeper JMX enabled by default
Using config: /opt/app/apache-zookeeper-3.8.2-bin/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Mode: standalone

Kafka 下载与安装

  • https://kafka.apache.org/downloads
cd /opt/pkg/
wget https://downloads.apache.org/kafka/3.5.1/kafka_2.13-3.5.1.tgz
tar zxf kafka_2.13-3.5.1.tgz
mv kafka_2.13-3.5.1 ../app/
cd /opt/app
cd kafka_2.13-3.5.1/
cd config/
cp server.properties server.properties.bak
vim server.properties
---
listeners=PLAINTEXT://kafka_1:9092
og.dirs=./kafka-logs
zookeeper.connect=kafka_1:2181
---cd ../
./bin/kafka-server-start.sh -daemon config/server.properties
  • 配置: config/server.properties
broker.id
listeners=PLAINTEXT://主机名:9092
log.dirs= # 日志目录
zookeeper.connect=主机名:2181
  • 启动:./bin/kafka-server-start.sh -daemon config/server.properties
  • 停止:./bin/kafka-server-stop.sh

测试

./bin/kafka-topics.sh --bootstrap-server kafka_1:9092 --create --topic topic_01 --partitions 3 --replication-factor 1 # 单机版副本因子为1 多了没有意义
./bin/kafka-console-consumer.sh --bootstrap-server kafka_1:9092 --topic topic_01 --group g1 # 消费者 查看输出
./bin/kafka-console-producer.sh --broker-list kafka_1:9092  --topic topic_01  # 开始输入

root@loaclhost kafka_2.13-3.5.1]# ./bin/kafka-topics.sh --bootstrap-server kafka_1:9092 --create --topic topic_0
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should c
WARNING: Due to limitations in metric names, topics with a period (‘.’) or underscore ('') could collide. To avo
Created topic topic_01.
[root@loaclhost kafka_2.13-3.5.1]# ./bin/kafka-console-consumer.sh --bootstrap-server kafka_1:9092 --topic topic

OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should c


root@loaclhost kafka_2.13-3.5.1]# ./bin/kafka-console-consumer.sh --bootstrap-server kafka_1:9092 --topic topic_01 --group g1
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N


在这里插入图片描述

集群版安装

  • 使用3台主机进行搭建,三台机器上都需要安装 jdk,Zookeeper,Kafka
  • 其中 /etc/hosts 都需要配置好三台主机的ip 主机名映射;
  • 需要额外注意的是,三台主机需要做一次时间同步
yum -y install ntpdate
timedatectl set-timezone Asia/Shanghai
ntpdate ntp1.aliyun.com # aliyun 有ntp1~7, 或者 cn.pool.ntp.org
  • 复制文件到 另外两台主机
[root@kafka_1 pkg]# pwd
/opt/pkg
scp kafka_2.13-3.5.1.tgz root@kafka_2:/opt/pkg 
scp kafka_2.13-3.5.1.tgz root@kafka_3:/opt/pkg
scp apache-zookeeper-3.8.2-bin.tar.gz root@kafka_3:/opt/pkg
scp apache-zookeeper-3.8.2-bin.tar.gz root@kafka_2:/opt/pkg
  • 配置 zoo.cfg:
# 数据目录 每个机器中,此目录下 需要创建 myid文件内容 和server.id 对应 , 可以指定一个绝对目录
dataDir=/opt/app/cluster/apache-zookeeper-3.8.2/dataDir server.1=kafka_1:2888:3888
server.2=kafka_2:2888:3888
server.3=kafka_3:2888:3888
4lw.commands.whitelist=*
  • myid生成: echo 1 > /opt/app/cluster/apache-zookeeper-3.8.2/dataDir/myid # 1,2,3

  • 配置: config/server.properties

broker.id=0 # 需要修改 1,2 
listeners=PLAINTEXT://kafka_1:9092 # 主机名和当前机器对应
log.dirs=/opt/app/cluster/kafka_2.13-3.5.1/log_dirs # 日志目录
zookeeper.connect=kafka_1:2181,kafka_2:2181,kafka_3:2181
  • 启动zk 和 kafka:
cd /opt/app/cluster/apache-zookeeper-3.8.2/
./bin/zkServer.sh start zoo.cfg
cd /opt/app/cluster/kafka_2.13-3.5.1
./bin/kafka-server-start.sh -daemon config/server.properties
  • 报错:

Using config: /opt/app/cluster/apache-zookeeper-3.8.2/bin/…/conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Error contacting service. It is probably not running.

  • 原因是防火墙没关:
 systemctl status firewalld
#● firewalld.service - firewalld - dynamic firewall daemon
#   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
#   Active: active (running) since Sun 2023-08-27 19:48:04 CST; 2h 32min ago
#     Docs: man:firewalld(1)
# Main PID: 649 (firewalld)
#   CGroup: /system.slice/firewalld.service
#           └─649 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
#           
systemctl disable firewalld

测试

./bin/kafka-topics.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --create --topic topic01 --partitions 3 --replication-factor 3  # 创建 topic
./bin/kafka-topics.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --create --topic topic02 --partitions 3 --replication-factor 3  # 创建 topic
./bin/kafka-topics.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --list # 查看
./bin/kafka-topics.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --describe --topic topic02 # 查看详细描述
./bin/kafka-topics.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --alter --topic topic02 --partitions 4   # 修改分区数量,只能增不能减,设置小于3则报错
./bin/kafka-topics.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --delete --topic topic02  # 删除topic---
# 消息的生产与消费/订阅
./bin/kafka-console-producer.sh --broker-list kafka_1:9092,kafka_2:9092,kafka_3:9092 --topic topic01 # 生产
./bin/kafka-console-consumer.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --topic topic01 --group g1 --property print.key=true  --property print.value=true  --property key.separator=, # 消费
---
# 查看消费组信息
./bin/kafka-consumer-groups.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --list g1  # 查看
./bin/kafka-consumer-groups.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --describe --group g1  # 查看详情

输出

[root@kafka_1 kafka_2.13-3.5.1]# ./bin/kafka-topics.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --create --topic topic01 --partitions 3 --replication-factor 3
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
Created topic topic01.
[root@kafka_1 kafka_2.13-3.5.1]# ./bin/kafka-topics.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --create --topic topic02 --partitions 3 --replication-factor 3
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
Created topic topic02.
[root@kafka_1 kafka_2.13-3.5.1]# ./bin/kafka-topics.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --list
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
topic01
topic02[root@kafka_1 kafka_2.13-3.5.1]# ./bin/kafka-topics.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --describe --topic topic02
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
Topic: topic02  TopicId: _s44mBQqTLaSmVWcZA2GTw PartitionCount: 3       ReplicationFactor: 3    Configs:Topic: topic02  Partition: 0    Leader: 2       Replicas: 2,0,1 Isr: 2,1Topic: topic02  Partition: 1    Leader: 1       Replicas: 1,2,0 Isr: 1,2Topic: topic02  Partition: 2    Leader: 0       Replicas: 0,1,2 Isr: 0,1,2[root@kafka_1 kafka_2.13-3.5.1]# ./bin/kafka-topics.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --alter --topic topic02 --partitions 4[root@kafka_1 kafka_2.13-3.5.1]# ./bin/kafka-topics.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --describe --topic topic02
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
Topic: topic02  TopicId: _s44mBQqTLaSmVWcZA2GTw PartitionCount: 4       ReplicationFactor: 3    Configs:Topic: topic02  Partition: 0    Leader: 2       Replicas: 2,0,1 Isr: 2,1Topic: topic02  Partition: 1    Leader: 1       Replicas: 1,2,0 Isr: 1,2Topic: topic02  Partition: 2    Leader: 0       Replicas: 0,1,2 Isr: 0,1,2Topic: topic02  Partition: 3    Leader: 2       Replicas: 2,1,0 Isr: 2,1[root@kafka_1 kafka_2.13-3.5.1]# ./bin/kafka-topics.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --list
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
topic01
topic02
[root@kafka_1 kafka_2.13-3.5.1]# ./bin/kafka-topics.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --delete --topic topic02
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
[root@kafka_1 kafka_2.13-3.5.1]# ./bin/kafka-topics.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --list
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
topic01---
# 生产者
[root@kafka_1 kafka_2.13-3.5.1]# ./bin/kafka-console-producer.sh --broker-list kafka_1:9092,kafka_2:9092,kafka_3:9092 --topic topic01
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
>123
>123
>key=123
># 消费者
[root@kafka_1 kafka_2.13-3.5.1]# ./bin/kafka-console-consumer.sh --bootstrap-server kafka_1:9092,kafka_2:9092,kafka_3:9092 --topic topic01 --group g1 --property print.key=true  --property print.value=true  --property key.separator=,
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=Nnull,123
null,123
null,key=123
http://www.ds6.com.cn/news/3896.html

相关文章:

  • 做网站开发工资怎样搜索引擎的使用方法和技巧
  • flash 网站管理系统搜索数据
  • 电子商务网站建设与维护致谢词seo搜索引擎优化方案
  • 360网站做推广关键词优化排名要多少钱
  • 镇江做网站哪家公司好搜索引擎营销的特点包括
  • wordpress新建php页面模板陕西整站关键词自然排名优化
  • 我想弄个自己的卖货网站怎样做块链友情链接平台
  • wordpress分销平台seo网络培训
  • 网站开发 ssh 菜鸟深圳全网营销型网站
  • 盘古网做网站多少钱广州seo公司排行
  • ppt那个网站做的好班级优化大师怎么加入班级
  • 阜阳做网站有吗参考消息今天新闻
  • 建筑人才招聘网官网何鹏seo
  • 无锡网站建站公司搜索优化
  • 莱芜雪野湖图片苏州百度快照优化排名
  • 全国学校网站建设sq网站推广
  • 中国城乡与住房建设部网站贵阳网站建设制作
  • 上海网站开发设计培训手机网站百度关键词排名
  • 电商网站怎么做seo公司网站免费自建
  • 可信赖的昆明网站建设友联互换
  • 赣州网站建设价位网站关键词排名怎么优化
  • 外贸公司的网站建设爱网站查询挖掘工具
  • 网站域名绑定ip软文兼职10元一篇
  • 做ppt兼职的网站新闻10 30字
  • 建站公司做的网站侵权了网站制作
  • pycharm 做网站哪个好搜索引擎优化的作用是什么
  • 程序员做的简单的网站百度直播间
  • 网站打开是404错误代码技术短期培训班
  • 谈谈网站的开发流程谷歌推广效果好吗
  • 目前网站开发应用到的技术有什么黄山网站建设