Author: Sun Hangda, a Middleware Development Engineer from the Intelligent Cloud Department of Li Auto, currently responsible for the development and operation of Apache RocketMQ, ShardingSphere Proxy, and full data migration middleware
Li Auto is a new energy vehicle manufacturer. What makes us special in the general Internet business is the addition of the Internet of Things. As the company grows, business capacity is getting larger. In this process, service has higher requirements on the infrastructure. The main problems we face include limited expansion of single cloud resources, disaster recovery in the single cloud and single region, strong dependence on single cloud providers, and single-point access to the Internet of Things.
The multi-cloud and multi-active architecture (as a reliable and highly available deployment architecture) has become the primary choice of major Internet companies to keep the core service continuity, enhance anti-risk capabilities, and achieve a resilient architecture.
The service is unitized and deployed on different cloud VDC systems. Users can use SDE to pull up VDC with one click, quickly deploy infrastructure, middleware, and business applications, and create various resources. Apache RocketMQ is an important basic middleware. Its deployment capability affects the pull-up speed of VDC.
The usual procedure for deploying an ApacheRocketMQ cluster is listed below:
If a large-scale ApacheRocketMQ cluster is deployed manually, the deployment time will be hours or days. Li Auto uses Terraform (an orchestration tool for infrastructure automation) to orchestrate the entire deployment process. The Apache RocketMQ cluster is deployed as the atomic capability and is implemented using Ansible Playbook.
You only need to fill in a few parameters on the control platform (such as the cluster name, namesrv and broker deployment scale, and machine configuration) to deploy a complete set of ApacheRocketMQ and achieve rapid cluster deployment.
During deployment, Terraform calls the cluster information from the control platform and accesses it on the interface to complete the entire deployment process.
Finally, the Apache RocketMQ Exporter has been successfully registered on the consul cluster of Prometheus.
Apache RocketMQ Playbook can deploy a complete Apache RocketMQ cluster (including Apache RocketMQ Exporter). Apache RocketMQ Playbook is idempotent and does not restart the running process during repeated execution. Scaling out the Apache RocketMQ cluster online is supported. Since the scale-in of an Apache RocketMQ cluster involves data contraction, it is generally not supported in Apache RocketMQ Playbook. Apache RocketMQ Playbook integrates tasks (such as deployment environment initialization, runnable package download, OS parameter tuning, optimal broker configuration, Apache RocketMQ cluster deployment, Apache RocketMQ Exporter deployment, and adding an automatic startup mechanism) to automate large-scale cluster deployment.
Ansible is GitHub's most popular automated O&M tool in recent years. It can perform configuration management and application deployment. It realizes the functions of batch system configuration, batch program deployment, batch running commands, etc. Installation Documentation: https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html
The Apache RocketMQ Playbook entry file is rocketmq.yml. rocketmq.yml contains three files: namesrv.yml, broker.yml, and exporter.yml. These three files are used to deploy Apache RocketMQ Namesrv, Apache RocketMQBroker, and Apache RocketMQ Exporter, respectively. rocketmq.yml can be executed separately to deploy a complete Apache RocketMQ cluster, or each file can be executed separately. The hosts file includes the deployed machine list and the Apache RocketMQ configuration information. Download URL: https://github.com/apache/rocketmq-externals/tree/master/rocketmq-ansible
# Deployed machine list of ApacheRocketmq Namesrv
# Deployed machine list and the role configuration of each machine of ApacheRocketmq Broker
127.0.0.3brokerName=broker-a brokerId=0 brokerRole=ASYNC_MASTER
127.0.0.4brokerName=broker-a brokerId=1 brokerRole=SLAVE
# Public configurations of ApacheRocketmq Broker [rocketmq_broker:vars]
# Deployed machine list of ApacheRocketmq Exporter
# Public configurations of ApacheRocketmq Exporter
vars/main.yml configures the deployment path and data path of Apache RocketMQ. You need to adjust according to your company's deployment specifications.
# Theglobal variable
namesrv/vars/main.yml is configured with the download URL of the Apache RocketMQ executable file, the namerv deployment path (which can be a subpath of a global variable), and the namesrv log path.
broker/vars/main.yml is configured with the download URL of the Apache RocketMQ executable file, the broker deployment path (which can be a subpath of a global variable), and the broker log path.
exporter /vars/main.yml is configured with the download URL of the Apache RocketMQ Exporter executable file and the ApacheRocketMQ Exporter deployment directory.
Note: ApacheRocketMQ Exporter needs to be edited and packaged by yourself and uploaded to the company intranet.
#exporterneed build by yourself
ansible-playbook/path/rocketmq.yml -i /path/hosts
Note: /path needs to be modified based on the actual path. The redundant configuration of the deployment path is to allow the three sub-playbooks to be executed separately.
# Start and stop ApacheRocketMQ Broker
# Start and stop ApacheRocketMQ Namesrv
# Start and stop ApacheRocketMQ Exporter
Based on the deployment capability of Apache RocketMQ Playbook, you can encapsulate the deployment interface with minimal parameters into the control platform. Finally, you can use a visualized interface to deploy large-scale Apache RocketMQ clusters in minutes.
Join the Apache RocketMQ community: https://github.com/apache/rocketmq
Alibaba Cloud Native Community - January 6, 2023
Alibaba Cloud Native Community - January 5, 2023
Alibaba Cloud Native Community - March 20, 2023
Alibaba Cloud Native Community - March 20, 2023
Aliware - July 3, 2020
Alibaba Cloud Native Community - July 4, 2023
ApsaraMQ for RocketMQ is a distributed message queue service that supports reliable message-based asynchronous communication among microservices, distributed systems, and serverless applications.Learn More
Super Computing Service provides ultimate computing performance and parallel computing cluster services for high-performance computing through high-speed RDMA network and heterogeneous accelerators such as GPU.Learn More
Follow our step-by-step best practices guides to build your own business case.Learn More
A fully-managed Apache Kafka service to help you quickly build data pipelines for your big data analytics.Learn More
More Posts by Alibaba Cloud Native Community