Steps to install RocketMQ instance on Linux

Steps to install RocketMQ instance on Linux

1. Install JDK

1.1 Check whether the current virtual machine environment has JDK rpm -qa|grep java

1.2 Uninstall rpm -e --nodeps xxxxxx (your own openjdk)

1.3 Install JDK

Create a new java folder in /usr/local and upload the tar package to the folder

Switch to /usr/local/java and decompress it using tar -zxvf xxx

Configure the /etc/profile file and add JDK environment variables

export JAVA_HOME=/usr/local/java/jdk1.8.0_121 Replace your own path

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export PATH=$JAVA_HOME/bin:$PATH

Application file source /etc/profile

Use java -version to check the version

2. Install RocketMQ

2.1 Configure the /etc/hosts file and write the IP addresses of the two hosts

  • 192.168.42.22 rocketmq-nameserver1
  • 192.168.42.22 rocketmq-master1
  • 192.168.42.33 rocketmq-nameserver2
  • 192.168.42.33 rocketmq-master2

2.2 Restart the network card service network restart

2.3 Upload the rocketmq compressed package to /usr/local

2.4 Switch to /usr/local and decompress the rocketmq compressed package tar -zxvf xxxxxx

2.5 Change the name of the decompression folder

mv alibaba-rocketmq alibaba-rocketmq-3.2.6

2.6 Create a soft link

ln -s alibaba-rocketmq-3.2.6 rocketmq

2.7 mkdir /usr/local/rocketmq/store

mkdir /usr/local/rocketmq/store/commitlog

mkdir /usr/local/rocketmq/store/consumequeue

mkdir /usr/local/rocketmq/store/index

2.8 Upload borker-a.properties and borker-b.properties to /usr/local/recketmq/conf/2m-noslave

2.9 master01 configures borker-a.properties

brokerName=broker-a corresponds to the file name

namesrvAddr=rocketmq-nameserver1:9876;rocketmq-nameserver2:9876

master02 configures borker-b.properties

brokerName=broker-b corresponds to the file name

namesrvAddr=rocketmq-nameserver1:9876;rocketmq-nameserver2:9876

2.10 Changelog

mkdir -p /usr/local/rocketmq/logs

cd /usr/local/rocketmq/conf && sed -i 's#${user.home}#/usr/local/rocketmq#g' *.xml

2.11 Configure JVM parameters and modify them according to the actual size of your virtual machine

vi /usr/local/rocketmq/bin/runbroker.sh

JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn512m -XX:PermSize=128m -XX:MaxPermSize=320m"

vi /usr/local/rocketmq/bin/runserver.sh

JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn512m -XX:PermSize=128m -XX:MaxPermSize=320m"

2.12 Start NameServer

cd /usr/local/rocketmq/bin

Start: nohup sh mqnamesrv &

jps checks whether the JDK process has NamesrvStartup

2.13 Start BrokerServer

cd /usr/local/rocketmq/bin

master01 starts: nohup sh mqbroker -c /usr/local/rocketmq/conf/2m-noslave/broker-a.properties >/dev/null 2>&1 &

Master02 starts: nohup sh mqbroker -c /usr/local/rocketmq/conf/2m-noslave/broker-b.properties >/dev/null 2>&1 &

jps checks whether the JDK process has BrokerStartup

3. Monitor the RocketMQ status through the console

3.1 Upload the Tomcat compressed package to the virtual machine and decompress it /usr/local tar -zxvf xxxx decompression

3.2 Upload rocketmq-web-console.war to the webapps directory of Tomcat decompression directory

3.3 Start Tomcat

Switch to /usr/local/apache-tomcat-7.0.65/bin

./startup.sh starts ./shutdown.sh stops

3.4 Modify the unzipped rocketmq-web-console

/usr/local/apache-tomcat-7.0.65/webapps/rocketmq-web-console/WEB-INF/classes/config.properties configuration file

Configuration:

rocketmq.namesrv.addr=192.168.42.22:9876;192.168.42.33:9876

throwDone=true

3.5 Firewalls of both machines are turned off

systemctl stop firewalld.service

systemctl disable firewalld.service

After the configuration is completed, the web page accesses the console, and the effect is as follows

The above are all the relevant knowledge points introduced this time. You can follow them to learn. Thank you for your support of 123WORDPRESS.COM.

You may also be interested in:
  • Spring Boot elegant use of RocketMQ method example
  • Implementation of Java RocketMQ routing registration and deletion
  • Sample code for implementing delayed messages using Kotlin+RocketMQ
  • RocketMQ consumption load balancing--push consumption details
  • Detailed steps for building and deploying RocketMQ on Windows
  • Java RocketMQ Quick Start Basics
  • Detailed installation and use of RocketMQ in Docker
  • SpringBoot integrates RocketMQ and sample code for pitfalls
  • A brief talk about the experience of integrating Springboot with RocketMQ
  • RocketMQ retry mechanism and message power code example analysis

<<:  How to switch between Vue production and development environments and use filters

>>:  MySQL latest version 8.0.17 decompression version installation tutorial

Recommend

About VUE's compilation scope and slot scope slot issues

What are slots? The slot directive is v-slot, whi...

Implementation steps for setting up the React+Ant Design development environment

Basics 1. Use scaffolding to create a project and...

Example of Vue implementing fixed bottom component

Table of contents 【Effect】 【Implementation method...

Methods and steps to access Baidu Maps API with JavaScript

Table of contents 1. Baidu Map API Access 2. Usin...

Two ways to introduce svg icons in Vue

How to introduce svg icons in Vue Method 1 of int...

Native js implementation of magnifying glass component

This article example shares the specific code for...

Detailed explanation of identifying files with the same content on Linux

Preface Sometimes file copies amount to a huge wa...

5 ways to achieve the diagonal header effect in the table

Everyone must be familiar with table. We often en...

In-depth understanding of the use of r2dbc in MySQL

Introduction MySQL should be a very common databa...

Vue custom encapsulated button component

The custom encapsulation code of the vue button c...

Optimization methods when Mysql occupies too high CPU (must read)

When Mysql occupies too much CPU, where should we...