Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Build METAQ message middleware

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

I. Introduction

METAQ(full name Metamorphosis) is a complete queue model message middleware. The server is written in Java language and can be deployed on a variety of software and hardware platforms. The client supports Java and C++ programming languages. A single server can support more than 10,000 message queues. By expanding the server, the number of queues can be expanded almost arbitrarily. Each queue is persistent, unlimited in length (depending on the size of disk space), and can be consumed from any position in the queue.

MetaQ is a message middleware with distributed queue model. MetaQ has the characteristics of sequential message storage, high throughput and support for local and XA transactions. It is suitable for scenarios such as high throughput, sequential message, broadcast and log data transmission. Based on publish/subscribe mode, there are two consumption methods: Push and Pull. Strict message order, billion-level accumulation capability, message backtracking and multi-dimensional message query are supported.

Related Name Explanation:

1. Topic--The topic of the message: defined by the user and configured on the server;producer sends messages to a topic, consumer consumes information from a topic;

Offset---Each partition of the message on the broker is organized into a file list. The consumer needs to know the offset of the data in the file to pull the data. Offset is the absolute offset. The server will convert the offset into the relative offset of the specific file.

Broker---is the meta server or server, also known as broker in message middleware;

4. partition--the same topic is divided into multiple partitions;

Profile related parameters:

zk.zkEnable=true ---Register to zk, default true

zk.zkConnect=localhost:2180 ---zk's server list

zk.zkSessionTimeoutMs=30000 ---zk Heartbeat timeout in milliseconds, default 30 seconds

zk.zkConnectionTimeoutMs=30000 ---zk Connection timeout in milliseconds, default 30 seconds

brokerId ---Server ID, which must be unique within the cluster and an integer between 0 and 1024

serverPort ---Server Port

hostName ---default will take the local IP, multi-machine network card needs to be specified

dataLogPath ---Log data file path, same as dataPath by default

dataPath ---Specifies the default data storage path

deletePolicy=delete, 168 ---Data deletion policy, default more than 7 days to delete, default unit hour

deleteWhen: ---When to execute cron expression of deletion policy, default 0 0 6, 18 * *?

flushTxLogAtCommit=1 ---Synchronization settings for transaction logs

unflushThreshold ---How many messages do disk sync once per message, forcing changed data to be flushed to disk;

unflushInterval --How many milliseconds do disk sync regularly, default 10 seconds

II. Construction process

CentOS Linux release 7.6.1810 (Core)

1. jdk environment

2. Set up zookeeper(pseudo-cluster)

1)decompression

tar -zxvf zookeeper-3.4.14.tar.gz -C /usr/local/

2) Create three nodes, copy files (folders)

# mkdir -p zk1 zk2 zk3

cp -r zookeeper-3.4.14 zk1/

3) Configuration file (similar to the other two nodes)

cd zk1/zookeeper-3.4.14/

# mkdir dataDir dataLogDir

#Create ID (three nodes 1, 2, 3 respectively)

# cd dataDir

vim myid

1

##Modify configuration file

# mv conf/zoo_sample.cfg conf/zoo.cfg

# vim conf/zoo.cfg

Copy the other two nodes to the past (note to modify the ID)##Modify the relevant configuration file

# cp -rf zk1/zookeeper-3.4.14 zk2/

# cp -rf zk1/zookeeper-3.4.14 zk3/

4) Start-up service

# zk1/zookeeper-3.4.14/bin/zkServer.sh start

# zk2/zookeeper-3.4.14/bin/zkServer.sh start

# zk3/zookeeper-3.4.14/bin/zkServer.sh start

# netstat -tnlp | grep -E '2181|2182|2183'

Test connection Login:

# zk1/zookeeper-3.4.14/bin/zkCli.sh -server 127.0.0.1:2181

3. Build a metaq environment

1) Extract files

# tar -zxvf metaq-server-1.4.6.2.tar.gz -C /usr/local/

2) Configuration files

# cd /usr/local/taobao/metamorphosis-server-wrapper/

# vim conf/server.ini

3) Start-up service

./ bin/metaServer.sh start &

##Stop Command

./ bin/metaServer.sh stop

##Restart command

./ bin/metaServer.sh restart &

##Reload topic configuration

./ bin/metaServer.sh reload &

##Check server status

./ bin/metaServer.sh stats

4. Inspection section

1) View metaq registration on zookper

# zk1/zookeeper-3.4.14/bin/zkCli.sh -server 127.0.0.1:2181

###Registered, check meatq queue

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report