当前位置:网站首页>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
- How to query all the data in a table in the database?
- Design details of the full stack CRM development tool webclient UI workbench
- 2022年暑期及9月份CSP-J1 CSP-S1初赛 培训计划及学习要点
- Yesterday, metauniverse | Wal Mart set up an innovation department to explore metauniverse and Web3, and Dior released the metauniverse Exhibition
- Subscription publishing mode bus in JS
- Five solutions that give consideration to enterprise anti epidemic and development, from IBM
- 基于DataWorks的时效仿真平台|得物技术
- MATLB|可视化学习(plot和bar)
- 如何登录到你的 WordPress 管理仪表板
猜你喜欢
随机推荐
How to install WordPress on a web site
免费、强大、高颜值的笔记软件评测: OneNote、Heptabase、氢图、FlowUs
You have a chance to collect wool. Click "earn" and you will have a chance to earn a high commission
Coding Devops helps Sinochem information to build a new generation of research efficiency platform and drive the new future of "online Sinochem"
[tcapulusdb knowledge base] tcapulusdb technical support introduction
【尚硅谷与腾讯云官方合作】硅谷课堂项目视频发布
[laravel] about the composer installation of laravel8
【TcaplusDB知识库】TcaplusDB限制条件介绍
WPF video hard decoding, rendering and playing (no airspace) (support 4K, 8K and high frame rate video)
Design details of the full stack CRM development tool webclient UI workbench
offsetwidth\clientwidth\scrollwidth
基于DataWorks的时效仿真平台|得物技术
The future of platform as code is kubernetes extension
Tianyi cloud web application firewall (edge cloud version) passed the first batch of trusted authentication
通过setTimeout解决子组件不会销毁的问题
PotPlayer播放百度云盘视频
Slim gain (sgain) introduction and code implementation -- missing data filling based on generated countermeasure network
FS2K人脸素描属性识别
Solve the problem that subcomponents will not be destroyed through setTimeout
This simple little function saves 213 hours for our production research team in half a year









