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

Set up and configure rabbitmq cluster process

2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Since the company has built an mq environment for a long time, the test environment has a single node and a single instance. Recently, there have been frequent problems, including too many disk files, resulting in full disk, etc., so it is decided to make the middleware server cluster mode. In order to ensure smooth use after migration, the old version is used as before.

Install erlang environment

tar -xvf otp_src_17.3.tar.gz

mkdir /usr/local/erlang

make && make install

ln -s /usr/local/erlang/bin/erl /usr/local/bin/erl

ERLANG_HOME=/usr/local/erlang

PATH=$ERLANG_HOME/bin:$PATH

export ERLANG_HOME

export PATH

Install build environment

yum install perl

yum install ncurses-devel

yum -y install gcc gcc-c++

yum -y install xmlto

yum install nc zip unzip

Install rabbitmq

tar -zxvf rabbitmq-server-3.1.5.tar.gz

make

make install TARGET_DIR=/server/rabbitmq SBIN_DIR=/server/rabbitmq/sbin MAN_DIR=/server/rabbitmq/man

mkdir /etc/rabbitmq

./ rabbitmq-plugins enable rabbitmq_management

make up the cluster

Sync three.erlang. cookies, under/root

Start three/server/rabbitmq/sbin/rabbitmq-server --detached respectively

Join the cluster, name in hosts file should be consistent with host name

rabbitmqctl stop_app

rabbitmqctl reset

rabbitmqctl join_cluster rabbit@public1

rabbitmqctl start_app

The other one is the same as above, adding public1.

view status

rabbitmqctl cluster_status

So far, the cluster has been built. There is no configuration file. Everything runs according to the default mode of the system. Here, I need to modify the storage location of the disk file to a larger hard disk and add a configuration file.

vim /etc/rabbitmq/rabbitmq-env.conf

Content:

RABBITMQ_MNESIA_BASE=/server/rabbitmq/data/mnesia

RABBITMQ_LOG_BASE=/server/rabbitmq/data/logs

After writing the startup command to/etc/rc.local, it is found that the startup cannot be started. Check the log prompt node to refuse the connection. After analyzing the startup command, it is found that the startup--/home does not specify the location of the cookie file, but manual execution will automatically specify it. I don't know what the reason is. You need to explore the principle of Linux startup, temporarily ignore this problem, and modify rc.local to

su - root -c "source /etc/profile && /server/rabbitmq/sbin/rabbitmq-server --detached &"

And that's when it's done.

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: 261

*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