728x90
반응형

1. erlang install

# wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
# rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
# yum install socat
# yum install erlang

2. RabbitMQ Install

# wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.17/rabbitmq-server-3.8.17-1.el7.noarch.rpm
# rpm -Uvh rabbitmq-server-3.8.17-1.el7.noarch.rpm

3. RabbitMq Start

# systemctl enable rabbitmq-server
# systemctl start rabbitmq-server

4. RabbitMQ Management Plug-In Start

# rabbitmq-plugins enable rabbitmq_management

5.  RabbitMQ User Setting

# rabbitmqctl status
# rabbitmqctl add_user mquser
# rabbitmqctl set_user_tags mquser administrator

6. RabbitMQ Base Setting

728x90
# rabbitmqctl add_vhost /pushmsg
# rabbitmqctl set_permissions -p /pushmsg mquser ".*" ".*" ".*"
# rabbitmqctl set_policy -p /pushmsg ha-all "^(AP_PUSH|BATCH_1|SVR_*)" '{"ha-mode":"all"}'
# rabbitmqctl clear_policy -p /pushmsg ha-all
# rabbitmqctl set_permissions -p /pushmsg mquser ".*" ".*" ".*"

7. RabbitMq Cluster 설정을 위한 host 등록

# vi /etc/hosts
1.1.1.1 test1
2.2.2.2   test2

8. erlang cookie 복제

cat /var/lib/rabbitmq/.erlang.cookie
해당 cookie 값 복사후 양 서버간 동일 값으로 세팅

9. cluster 연결

 
# 1번 서버에서 진행
# rabbitmqctl stop_app
Stopping rabbit application on node rabbit@test1 ...
 
# rabbitmqctl reset
Resetting node rabbit@test1 ...
 
# rabbitmqctl join_cluster rabbit@test
Clustering node rabbit@test1 with rabbit@test
 
# rabbitmqctl start_app
Starting node rabbit@test1 ...
 completed with 3 plugins.
 
# rabbitmqctl cluster_status

10. Queue HA 정책 설정

11. 별도 queue 생성하지 않고 전달

728x90
300x250

+ Recent posts