当前位置:网站首页>MetaQ安装部署文档
MetaQ安装部署文档
2022-06-28 16:41:00 【星哥玩云】
一.MetaQ安装部署情况:
地点 | IP | Broker ID | Master/Slave | Slave ID:Group |
|---|---|---|---|---|
合肥 | 192.168.52.23 | 1 | Slave | 1:meta-slave-group-hf |
北京 | 192.168.51.33 | 1 | Master | / |
广州 | 192.168.70.157 | 1 | Slave | 2:meta-slave-group-gz |
二.MetaQ安装
1. 前提
已有安装了ZooKeeper的机器,且三地的MetaQ都可以访问到,即三个IP都可以ping通安装了ZooKeeper的机器。ZooKeeper是用来注册MetaQ的broker、topic、pub、sub信息,用来做负载均衡的,起到协调作用。
我在上述三地都安装了ZooKeeper,目前使用的是北京192.168.51.33:2181作为ZooKeeper服务器。
Zookeeper使用Ubuntu的deb包的dpkg方式安装。
启动ZooKeeper:
Service zookeeper start
2. 下载MetaQserver 1.4.6.2
下载链接:https://meta-queue.googlecode.com/files/metaq-server-1.4.6.2.tar.gz,下载metaq-server-1.4.6.2.tar.gz复制到三地的/usr/lib目录下。
3. 部署
解压tar zxvfmetaq-server-1.4.6.2.tar.gz,将解压出来的taobao/metamorphosis-server-wrapper文件夹移动到/usr/lib下,并重命名为metaq。
Metaq的文件结构:
l bin: metaq的命令文件夹./meteServer.sh执行metaq命令
l conf:metaq的配置文件夹,async_slave.properties异步复制配置,server.ini配置broker,samsa_master.properties同步复制配置。
l lib:metaq依赖的jar包
l provided: 开发者自己开发的程序
4. master/slave集群配置
使用异步复制架构。
修改北京192.168.51.33机器的/usr/lib/metaq/conf/server.ini文件为:
[system]
;; brokerId mustbe unique, the slave should be the same with master
brokerId=1
;; topicpartitions default set to 1, I changed it to 16, it should not be too large
numPartitions=16
serverPort=8123
dashboardHttpPort=8120
unflushThreshold=0
unflushInterval=10000
maxSegmentSize=1073741824
;default 1048576
maxTransferSize=104857600
deletePolicy=delete,168
deleteWhen=0 0 6,18 * * ?
flushTxLogAtCommit=1
stat=true
putProcessThreadCount=100
;; Update consumers offsets tocurrent max offsets when consumers offsets are out of range of current broker'smessages.
;; It must be false inproduction.But recommend to be true in development or test.
updateConsumerOffsets=true
;; your zookeeperserver
[zookeeper]
zk.zkConnect=192.168.51.33:2181
zk.zkSessionTimeoutMs=30000
zk.zkConnectionTimeoutMs=30000
zk.zkSyncTimeMs=5000
;; Topics section
[topic=test]
[topic=meta-test]
;; add your topicshere before use it
[topic=oct29]
因为使用master/slave模式,因此要时刻保持合肥192.168.52.23和广州192.168.70.157的server.ini文件保持和北京192.168.51.33相同,即使添加了新的topic,也要手动向server.ini中注册。
修改三地的conf/async_slave.properties,北京的保持不变,合肥的修改为
#slave编号,大于等于0表示作为slave启动,同一个master下的slave编号应该设不同值.
slaveId=1
#作为slave启动时向master订阅消息的group,如果没配置则默认为meta-slave-group
#不同的slaveId请使用不同的group
slaveGroup=meta-slave-group
#slave数据同步的最大延时,单位毫秒
slaveMaxDelayInMills=500
#是否自动从master同步server.ini, 1.4.2新增选项
#第一次仍然需要自己拷贝server.ini,后续可以通过设置此选项为true来自动同步
autoSyncMasterConfig=true
广州的conf/async_slave.properties修改为:
#slave编号,大于等于0表示作为slave启动,同一个master下的slave编号应该设不同值.slaveId=2
#作为slave启动时向master订阅消息的group,如果没配置则默认为meta-slave-group#不同的slaveId请使用不同的groupslaveGroup=meta-slave-group-gz
#slave数据同步的最大延时,单位毫秒slaveMaxDelayInMills=500#是否自动从master同步server.ini, 1.4.2新增选项#第一次仍然需要自己拷贝server.ini,后续可以通过设置此选项为true来自动同步autoSyncMasterConfig=true5. 启动MetaQ集群
首先启动两个slave:
合肥和广州将目录切换到/usr/lib/metaq/bin下,使用slave模式启动MetaQ:
./metaServer.sh start slave &
北京启动master:
./metaServer.sh start &
三.问题
1. Topic的默认分区到底去多少好?即server.ini中numPartitions的配置,目前为16,当使用1024的时候很多会导致磁盘效率太低,message发送失败几率升高。
2. 异步复制的slave将参与消费者的消费活动,消息消费者可以从slave中获取消息并消费,消费者会随机从master和slaves中挑选一台作为消费broker。如何指定consumer从slave中消费message而不跑去消费master的呢?
3. 可以添加一个topic而不重启MetaQ吗?
四.参考
MetaQ HA: https://github.com/killme2008/Metamorphosis/wiki/HA
MetaQ源码分析:https://github.com/killme2008/Metamorphosis/wiki/%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%90
MetaQ Wiki:https://github.com/killme2008/Metamorphosis/wiki
MetaQ用户指南:http://www.linuxidc.com/Linux/2013-11/92750.htm
分布式发布订阅消息系统 Kafka 架构设计 http://www.linuxidc.com/Linux/2013-11/92751.htm
边栏推荐
- 软件快速交付真的需要以安全为代价吗?
- 【Hot100】1. Sum of two numbers
- QQ appears large-scale number theft, why is this? Is there no solution?
- [force button] 977 Square of ordered array
- 清华大佬耗时3天总结出的'常见网络协议汇总'
- Steps to be taken for successful migration to the cloud
- 【Hot100】2. Add two numbers
- 共享主机和 WordPress 主机之间的区别
- Potplayer play Baidu Cloud disk video
- 【TcaplusDB知识库】查看业务密码
猜你喜欢

7-用户输入和while循环

2022年暑期及9月份CSP-J1 CSP-S1初赛 培训计划及学习要点

NOIP普及组2006-2018初赛 2019 CSP-J1 2020 CSP-J1 完善程序题

【Golang】安装 iris 的方法

You have a chance to collect wool. Click "earn" and you will have a chance to earn a high commission

天翼云Web应用防火墙(边缘云版)通过首批可信认证

大型体育赛事与犯罪风险

FS2K人脸素描属性识别

大促场景下,如何做好网关高可用防护

【TcaplusDB知识库】TcaplusDB技术支持介绍
随机推荐
General solution of island problems and DFS framework
Lucky draw animation - Carp jumps over the dragon's gate
apache 设置timeout参数
Practice of curve replacing CEPH in Netease cloud music
使用 Open Connector 进行 HubSpot 和 SAP 系统的集成工作
天翼云Web应用防火墙(边缘云版)通过首批可信认证
R 编程语言 - 简介
Tianyi cloud web application firewall (edge cloud version) passed the first batch of trusted authentication
2019 CSP J2 entry group csp-s2 improvement group round 2 video and question solution
From five capabilities to "1+5+n", Huawei makes the transformation of government and enterprises more stable
offsetwidth\clientwidth\scrollwidth
3. caller service call - dapr
如何清除 WordPress 中的缓存
This simple little function saves 213 hours for our production research team in half a year
中金证券经理给的开户链接安全吗?找谁可以开户啊?
Azure Kinect Microsoft camera unity development summary
offsetwidth\clientwidth\scrollwidth
[tcapulusdb knowledge base] Introduction to tcapulusdb restrictions
【TcaplusDB】祝大家端午安康!
Noip2011-2018 problem solving report of improvement group