Deployment

1 Compile and Package Project:

Enter the root directory of project and run:

  1. mvn clean package -Dmaven.test.skip

e.g. We put the TubeMQ project package at E:/, then run the above command. Compilation is complete when all subdirectories are compiled successfully.

Deployment - 图1

We can also run individual compilation in each subdirectory. Steps are the same as the whole project’s compilation.

2 Server Deployment

As example above, entry directory ..\InLong\inlong-tubemq\tubemq-server\target, we can see several JARs. apache-inlong-tubemq-server-0.9.0-incubating-SNAPSHOT-bin.tar.gz is the complete server-side installation package, including execution scripts, configuration files, dependencies, and frontend source code. apache-inlong-tubemq-server-0.9.0-incubating-SNAPSHOT.jar is a server-side processing package included in lib of the complete project installer. Consider to daily changes and upgrades are most made to server side, we place this jar separately so that we just need to replace this jar during upgrade.

Deployment - 图2

Here we have a complete package deployed onto server and we place it in /data/inlong

Deployment - 图3

3 Configuration System

There are 3 roles in server package: Master, Broker and Tools. Master and Broker can be deployed on the same or different machine. It depends on the bussiness layouts. As example below, we have 3 machine to startup a complete production and consumption cluster with 2 Masters.

MachineRoleTCP PortTLS PortWEB PortNote
9.23.27.24Master809981998080Metadata stored at /stage/meta_data
Broker812381248081Message stored at/stage/msg_data
ZooKeeper2181Offset stored at root directory/tubemq
9.23.28.24Master809981998080Metadata stored at /stage/meta_data
Broker812381248081Message stored at/stage/msg_data
9.23.27.160Producer
Consumer

|

Something should be noticed during deploying Master:

  1. Master cluster can be deployed in 1, 2 or 3 machines. 3 machines is suggested if HA is necessary so that reading/writing configuration and access to new production/consumption is still available when one of them is shutdown. In common situation, 2 machines provide readable configuration and proper state of production/consumption already registered when one is shutdown. The minimum is 1 and it provides proper state of production/consumption already registered when is shutdown.
  2. For machines with Master Role, we should promise clock synchronization. At the same time, IP address of each Master machine should be set in /etc/hosts on each Master machine.

Deployment - 图4

Take 9.23.27.24 and 9.23.28.24 as examples, if we want to deploy both Master and Broker role on them, we need to configure in /conf/master.ini, /resources/velocity.properties and /conf/broker.ini. First set up the configuration of 9.23.27.24,

Deployment - 图5

then it is 9.23.28.24.

Deployment - 图6

Note that the upper right corner is configured with Master’s web frontend configuration and configuration file.resource.loader.path in /resources/velocity.properties need to be modified according to the Master’s installation path.

4 Start up Master:

After configuration, entry directory bin of Master environment and start up master.

Deployment - 图7

We First start up 9.23.27.24, and then start up Master on 9.23.28.24. The following messages indicate that the master and backup master have been successfully started up and the external service ports are reachable.

Deployment - 图8

Visiting Master’s Administrator panel(http://9.23.27.24:8080), search operation working well indicates that master has been successfully started up.

Deployment - 图9

5 Start up Broker:

Starting up Broker is a little bit different to starting Master: Master is responsible for managing the entire TubeMQ cluster, including Broker node with Topic configuration on them, production and consumption managament. So we need to add metadata on Master before starting up Broker.

Deployment - 图10

Confirm and create a draft record of Broker.

Deployment - 图11

We try to start up the Broker.

Deployment - 图12

But we got an error message.

Deployment - 图13

Because the broker record is currently in draft status and it is not available now. Let’s go back to Master Administrator panel and publish.

Deployment - 图14

Every changing operation need to text in an Authorization Code when submited to Master. Authorization Code is defined by confModAuthToken in master.ini. If you have the Code of this cluster, we consider you as administrator and you have permission to operate the modification.

Deployment - 图15

Then we restart the Broker.

Deployment - 图16

Deployment - 图17

Check the Master Control Panel, broker has successfully registered.

Deployment - 图18

6 Topic Configuration and Activation:

Configuration of Topic is similar with Broker’s, we should add metadata on Master before using them, otherwise it will report an Not Found Error during production/consumption. For example, if we try to consum a non-existent topic test, Deployment - 图19

Demo returns error message. Deployment - 图20

First we add a topic in topic list page in Master Control Panel.

Deployment - 图21

Deployment - 图22

Choose publish scope and confirm after submit topic detail. After adding a new topic, we need to overload the topic.

Deployment - 图23

Topic is available after overload. We can see some status of topic has changed after overload.

Deployment - 图24

Note When we are executing overload opertaion, we should make it in batches. Overload operations are controlled by state machines. It would become unwritable and un readale, read-only, readable and writable in order before published. Waiting for overloads on all brokers make topic temporary unreadable and unwritable, which result in production and consumption failure, especially production failure.

7 Message Production and Consumption:

We pack Demo for test in package or tubemq-client-0.9.0-incubating-SNAPSHOT.jar can be used for implementing your own production and consumption. We run Producer Demo in below script and we can see data accepted on Broker. Deployment - 图25

Deployment - 图26

Then we run the Consumption Demo and we can see that consumption is also working properly. Deployment - 图27

As we can see, files relative to broker’s production and consumption already exist.

Deployment - 图28

Here, the compilation, deployment, system configuration, startup, production and consumption of TubeMQ has been completed! If you need to get further, please refer to “TubeMQ HTTP API” and make your appropriate configuration settings.