zoukankan      html  css  js  c++  java
  • B03-openstack高可用-rabbitmq集群+memcache集群

    RabbitMQ集群

    1:下载rabbitmq的相关软件包(所有节点)

    [root@controller01 ~]# yum install erlang rabbitmq-server -y

    [root@controller01 ~]# systemctl enable rabbitmq-server.service

    2:任选1个控制节点首先启动rabbitmq服务,这里选择controller01节点

    [root@controller01 ~]# systemctl start rabbitmq-server.service

    [root@controller01 ~]# rabbitmqctl cluster_status
    Cluster status of node rabbit@controller01
    [{nodes,[{disc,[rabbit@controller01]}]},
     {running_nodes,[rabbit@controller01]},
     {cluster_name,<<"rabbit@controller01">>},
     {partitions,[]},
     {alarms,[{rabbit@controller01,[]}]}]

    3:分发.erlang.cookie

    [root@controller01 ~]# scp /var/lib/rabbitmq/.erlang.cookie root@10.100.214.203:/var/lib/rabbitmq/
    [root@controller01 ~]# scp /var/lib/rabbitmq/.erlang.cookie root@10.100.214.202:/var/lib/rabbitmq/

    4:修改controller02/03节点.erlang.cookie文件的用户/组,以controller02节点为例

    [root@controller03 ~]# chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie

    [root@controller02 ~]# chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie

    # 注意修改全部控制节点.erlang.cookie文件的权限,默认即400权限,可不修改
    [root@controller02 ~]# ll /var/lib/rabbitmq/.erlang.cookie

    5:启动controller02/03节点的rabbitmq服务

    [root@controller02 ~]# systemctl start rabbitmq-server
    [root@controller03 ~]# systemctl start rabbitmq-server


    6:构建集群,controller02/03节点以ram节点的形式加入集群

    [root@controller02 ~]# rabbitmqctl stop_app
    Stopping rabbit application on node rabbit@controller02

    [root@controller02 ~]# rabbitmqctl join_cluster --ram rabbit@controller01
    Clustering node rabbit@controller02 with rabbit@controller01

    [root@controller02 ~]# rabbitmqctl start_app
    Starting node rabbit@controller02

    [root@controller03 ~]#  rabbitmqctl stop_app
    Stopping rabbit application on node rabbit@controller03

    [root@controller03 ~]#  rabbitmqctl join_cluster --ram rabbit@controller01
    Clustering node rabbit@controller03 with rabbit@controller01

    [root@controller03 ~]#  rabbitmqctl start_app
    Starting node rabbit@controller03

    7:任意节点可验证集群状态

    [root@controller01 ~]#  rabbitmqctl cluster_status
    Cluster status of node rabbit@controller01
    [{nodes,[{disc,[rabbit@controller01]},
             {ram,[rabbit@controller03,rabbit@controller02]}]},
     {running_nodes,[rabbit@controller03,rabbit@controller02,rabbit@controller01]},
     {cluster_name,<<"rabbit@controller01">>},
     {partitions,[]},
     {alarms,[{rabbit@controller03,[]},
              {rabbit@controller02,[]},
              {rabbit@controller01,[]}]}]

    8:创建rabbitmq账号

    [root@controller01 ~]# rabbitmqctl add_user openstack huayun
    Creating user "openstack"

    9:设置新建账号的状态

    [root@controller01 ~]# rabbitmqctl set_user_tags openstack administrator
    Setting tags for user "openstack" to [administrator]

    10:设置新建账号的权限

    [root@controller01 ~]# rabbitmqctl set_permissions -p "/" openstack ".*" ".*" ".*"
    Setting permissions for user "openstack" in vhost "/"
    11:查看账号

    [root@controller01 ~]# rabbitmqctl list_users
    Listing users
    openstack    [administrator]
    guest    [administrator]

    12:设置镜像队列ha

    [root@controller01 ~]# rabbitmqctl set_policy ha-all "^" '{"ha-mode":"all"}'
    Setting policy "ha-all" for pattern "^" to "{"ha-mode":"all"}" with priority "0"

    13:查看镜像队列策略

    [root@controller01 ~]# rabbitmqctl list_policies
    Listing policies
    /    ha-all    all    ^    {"ha-mode":"all"}    0

    14:安装web管理插件

    # 在全部控制节点安装web管理插件,以controller01节点为例

    [root@controller01 ~]#  rabbitmq-plugins enable rabbitmq_management
    The following plugins have been enabled:
      amqp_client
      cowlib
      cowboy
      rabbitmq_web_dispatch
      rabbitmq_management_agent
      rabbitmq_management

    Applying plugin configuration to rabbit@controller01... started 6 plugins.

    
    

     访问任意节点,如:http://10.100.214.201:15672/

    memcache集群:

    Memcached是无状态的,各控制节点独立部署,openstack各服务模块统一调用多个控制节点的memcached服务即可。

    1:安装memcache的软件包(三个节点安装)

    [root@controller01 ~]# yum install memcached python-memcached -y

    2: 设置memcached

    [root@controller01 ~]#  sed -i 's|127.0.0.1,::1|0.0.0.0|g' /etc/sysconfig/memcached
    [root@controller01 ~]# cat /etc/sysconfig/memcached
    PORT="11211"
    USER="memcached"
    MAXCONN="1024"
    CACHESIZE="64"
    OPTIONS="-l 0.0.0.0"

    3:开机启动

    [root@controller01 ~]# systemctl start memcached
    [root@controller01 ~]# systemctl enable memcached

  • 相关阅读:
    JavaScript中的原型和继承
    Classical Inheritance in JavaScript
    jquery.cookie 使用方法
    Backbone.js 使用 Collection
    Backbone.js 中使用 Model
    Backbone.js 使用模板
    Java并发编程:volatile关键字解析zz
    eclipse 搭建Swt 环境
    Adams输出宏代码
    根据圆上三点求圆心及半径
  • 原文地址:https://www.cnblogs.com/zhaopei123/p/13087048.html
Copyright © 2011-2022 走看看