rabbitmq 安装

yum install epel-release  unixODBC unixODBC-devel wxBase wxGTK SDL wxGTK-gl socat


wget https://packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_20.3-1~centos~7_amd64.rpm

rpm -ihv esl-erlang_20.3-1~centos~7_amd64.rpm

yum install esl-erlang_20.3-1~centos~7_amd64.rpm

wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.10/rabbitmq-server-3.7.10-1.el7.noarch.rpm


rpm -i --nodeps rabbitmq-server-3.7.10-1.el7.noarch.rpm

yum install rabbitmq-server-3.7.10-1.el7.noarch.rpm --nodeps

cp /usr/share/doc/rabbitmq-server-3.7.10/rabbitmq.config.example /etc/rabbitmq/rabbitmq.config

scp /var/lib/rabbitmq/.erlang.cookie  root@192.168.5.128:/var/lib/rabbitmq

修改主机名: hostnamectl set-hostname %hostname%

sshpass -p youkia123 ssh-copy-id -i ~/.ssh/id_rsa.pub -p 22 root@192.168.5.168

sshpass -p Yka789123 ssh-copy-id -i ~/.ssh/id_rsa.pub -p 22 root@192.168.5.127


rabbitmq-server -detached

rabbitmqctl stop_app

rabbitmqctl join_cluster rabbit@xxx

rabbitmqctl cluster_status

 

haproxy 安装
http://www.haproxy.org/download/1.7/src/haproxy-1.7.1.tar.gz
解压haproxy: tar -xvf haproxy-1.7.1.tar.gz
进入haproxy目录:cd haproxy-1.7.1/
编译haproxy:sudo make TARGET=linux31 PREFIX=/usr/local/haproxy
安装haproxy:sudo make install PREFIX=/usr/local/haproxy
3 haproxy配置:
进入haproxy目录:cd /usr/local/haproxy/
创建haproxy配置文件:sudo vi haproxy-rabbitmq.cfg

global
    log 127.0.0.1 local1
    log-tag haproxy
    maxconn 4096
    #user haproxy
    #group haproxy
    daemon
    stats socket /var/run/haproxy.sock mode 600 level admin
    stats timeout 2m
defaults
    log global
    mode http
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms
    option dontlognull
    option http-server-close
listen admin
    bind 0.0.0.0:8008
    mode http
    stats uri /stats
frontend rabbitmq
    mode tcp
    bind 0.0.0.0:5077
    #把client的超时时间设置的长一点很重要,HAProxy默认是50秒,这样如果50秒还没有消息到来,HAProxy就会断开客户端,这是不合适的
    timeout client 168h
    default_backend rabbitmq_nodes
    log global
    option tcplog
    option logasap
backend rabbitmq_nodes
    mode tcp
    balance roundrobin
    timeout server 168h
    server  rm1 192.168.5.129:5672 check inter 1000 fall 3 rise 3
    server  rm2 192.168.5.168:5672 check inter 1000 fall 3 rise 3
    server  rm3 192.168.5.165:5672 check inter 1000 fall 3 rise 3
#把RabbitMQ的管理界面也放在HAProxy后面了
listen rabbitmq_admin 
    bind  0.0.0.0:15679
    mode http
    timeout server 168h
    balance roundrobin
    server rm1 192.168.5.129:15672 check inter 1000 fall 3 rise 3
    server rm2 192.168.5.168:15672 check inter 1000 fall 3 rise 3
    server rm3 192.168.5.165:15672 check inter 1000 fall 3 rise 3
    
ln -s /usr/local/haproxy/sbin/haproxy /usr/bin/haproxy    
    

sh keep_hap.sh > keep.log 2>&1 &

git clone -b v3.7.6 https://github.com/rabbitmq/rabbitmq-erlang-client.git

节点删除
1.  rabbitmq-server -detached
以上为基础,正常运行的mq节点直接进行2、3两步;4可省略或更改为rabbitmqctl stop
2. rabbitmqctl stop_app
3. rabbitmqctl reset 
4. rabbitmqctl start_app

sh runjava com.rabbitmq.perf.PerfTest -x 2 -y 4 -e "testex1" -t "fanout" -u "testque1" -k "kk01" -a -A 30000 -C 1000000  -h "amqp://admin:123456@rm1:5077"  -pst 5 -s 1198


sh runjava com.rabbitmq.perf.PerfTest -x 2 -y 4 -e "testex2" -t "fanout" -u "testque2" -k "kk02" -a -A 30000 -C 1000000  -h "amqp://admin:123456@rm1:5077"  -pst 5 -s 1198


sh runjava com.rabbitmq.perf.PerfTest -x 2 -y 4 -e "testex3" -t "fanout" -u "testque3" -k "kk03" -a -A 30000 -C 1000000  -h "amqp://admin:123456@rm1:5077"  -pst 5 -s 1198


sh runjava com.rabbitmq.perf.PerfTest -x 2 -y 4  -e "testex4" -t "fanout" -u "testque4" -k "kk04" -a -A 30000 -C 1000000  -h "amqp://admin:123456@rm1:5077"  -pst 5 -s 1198


sh runjava com.rabbitmq.perf.PerfTest -x 2 -y 4  -e "testex5" -t "fanout" -u "testque5" -k "kk05" -a -A 30000 -C 1000000  -h "amqp://admin:123456@rm1:5077"  -pst 5 -s 1198

sh runjava com.rabbitmq.perf.PerfTest -x 2 -y 4  -e "testex6" -t "fanout" -u "testque6" -k "kk06" -a -A 30000 -C 1000000  -h "amqp://admin:123456@rm1:5077"  -pst 5 -s 1198


sh runjava com.rabbitmq.perf.PerfTest -x 5 -X 5 -e"testex" -t"fanout" -u"testque" -k"kk01" -C 1000000 -s 1198 -h "amqp://admin:123456@rm1:5077"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值