Linux solves NameServer startup problem in RocketMQ

For startup steps, you can view the official website, https://github.com/apache/rocketmq

Explain the problems encountered.

1: ROCKETMQ_HOME problem

Enter the mq/bin directory according to the official website prompts. You can use ./mqnamesrv to start the NameServer, but you will encounter the first problem. When downloading RocketMQ for the first time, you need to set it in the mqnamesrv file:

Be sure to find export ROCKETMQ_HOME and then add the location of your mq after it. I created a new directory under root but below it, and then changed it to a simple name rocketmq-all-5

/root/shimmer/soft/rocketmq-all-5

2: java environment issues

 The second error is reported. When you configure ROCKETMQ_HOME and execute ./mqnamesrv again, the second error will appear. The java environment is not configured.

Configure java environment code

#1. 查看当前Linux系统是否已经安装java
    rpm -qa | grep -i java
    
#2. 解压已上传的JDK压缩包,并移动到/usr/local目录下
   mkdir /usr/local/hero 
   tar -zxvf /root/jdk-8u261-linux-x64.tar.gz -C /usr/local/hero

#3. 测试jdk
    /usr/local/hero/jdk1.8.0_261/bin/java -version
    
#4. 配置环境变量
  vim /etc/profile 
  或者
  vim ~/.bashrc
     G 跳转到最后一行
     i 进入插入模式
     export JAVA_HOME=/root/shimmer/soft/jdk1.8.0_261
     export PATH=$PATH:$JAVA_HOME/bin
     esc 进入命令行模式
     :wq! 保存
  
#5. 更新环境变量
    source /etc/profile
    source ~/.bashrc
  
#6. 测试
    java -version

 echo $JAVA_HOME

Then configure the java environment into runserver.sh under the mq/bin directory, find export JAVA_HOME and configure your java address in it

export JAVA_HOME=/root/shimmer/soft/jdk_8

 Solve the second problem

3: Insufficient memory problem

If your Linux memory is less than 4g, then the problem of insufficient memory allocation will be thrown after completing the previous two questions.

 You need to set the memory size in runserver.sh to the memory size that your Linux can accommodate. 

JAVA_OPT=”${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn125m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m”


 JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"

After the setup is completed, the third problem is solved

Finally, execute ./mqnamesrv to start the NameServer in RocketMQ.

 Displaying the following means the startup is successful.

Guess you like

Origin blog.csdn.net/qq_45656077/article/details/132405253