CentOS7.X installation RabbitMQ-3.6.10

My personal website

CentOS 7.0 installing RabbitMQ

  1. Preparation before installation

    yum install \
    m4 \
    vim \
    wget \
    gcc \
    gcc-c++ \
    make \
    cmake \
    automake \
    autoconf \
    readline \
    kernel-devel \
    ncurses-devel \
    openssl-devel \
    unixODBC-deve \
    readline-devel \
    librabbitmq-devel \
    -y \
  2. Source installation erlang

    erlang Download


    cd /root
    wget http://erlang.org/download/otp_src_20.0.tar.gz
    tar -zxvf otp_src_20.0.tar.gz
    cd otp_src_20.0
    ./configure \
    --prefix=/usr/local/erlang \
    --without-javac \
    make install
  3. Add environment variable

    vim /etc/profile
    export PATH=$PATH:/usr/local/erlang/bin
    source /etc/profile
  4. Test start erlang

    # Show eshell v8.2 (abort with ^ g)
    # Input:
    # Sign out:
  5. Installing RabbitMQ
    Download address

    Go to the download address and find|Binary .tar.xz .zip|
    cd /root
    wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.10/rabbitmq-server-generic-unix-3.6.10.tar.xz
    xz -d rabbitmq-server-generic-unix-3.6.10.tar.xz
    tar -xvf rabbitmq-server-generic-unix-3.6.10.tar
    cp -r /root/rabbitmq_server-3.6.10 /usr/local/rabbitmq
  6. Add profile
    Configuration reference

    vim /usr/local/rabbitmq/etc/rabbitmq/rabbitmq.config
  7. Add environment variable

    vim /etc/profile
    export RABBITMQ_HOME=/usr/local/rabbitmq
    export PATH=$PATH:/usr/local/rabbitmq/sbin
    source /etc/profile
  8. Start RabbitMQ

    /usr/local/rabbitmq/sbin/rabbitmq-server -detached
  9. Start RabbitMQ

    vim /etc/rc.local
    /usr/local/rabbitmq/sbin/rabbitmq-server -detached
  10. Before installing PHP AMQP extension: install rabbitmq-c
    Reference link

    cd /root
    wget https://github.com/alanxz/rabbitmq-c/archive/v0.8.0.tar.gz
    tar -zxvf v0.8.0.tar.gz
    cd rabbitmq-c-0.8.0
    cmake -DCMAKE_INSTALL_PREFIX=/usr/local/rabbitmq-c-0.8.0
    make install
  11. Add users and authorize

    # Create user
    rabbitmqctl add_user rabbitmq '12345678'
    # Add user [administrator] label
    rabbitmqctl set_user_tags rabbitmq administrator
    # Create virtual host
    rabbitmqctl add_vhost /vhost1
    # Authorize the user to access [virtual host] and operation type [configuration, read, write]
    rabbitmqctl set_permissions -p /vhost1 rabbitmq '.*' '.*' '.*'
    # Enable rabbitmq? Management
    rabbitmq-plugins enable rabbitmq_management

RabbitMQ permission

  1. RabbitMQ role permissions

    #Role list:
    #Role permissions:
    Cannot access the management? Plugin
    [management] (single virtual hosts user)
    Anything you can do with AMQP plus:
    List the virtual hosts that you can log in through AMQP  
    View queues, exchanges, and bindings in your own virtual hosts
     View and close your channels and connections
     View "global" statistics about your own virtual hosts, including other users' activities in these virtual hosts
    Anything management can do plus:
    View, create, and delete policies and parameters to which your virtual hosts belong
    Anything management can do plus:
    List all virtual hosts, including those they cannot log in to
     View connections and channels for other users
     View node level data such as clustering and memory usage
     View real global statistics for all virtual hosts
    [administrator] (full user)
    Anything policymaker and monitoring can do, plus:
    Create and delete virtual hosts
     View, create, and delete users
     View create and delete permissions
     Close connections for other users

RabbitMQ management Reference link

  1. Detailed explanation of rabbitmq plugins command

    # Format:
    rabbitmq-plugins <command> [<command options>]
    # Show all plug-ins - v: Show plug-in version - m: Show plug-in name - E: show explicitly opened plug-ins - E: show explicitly and background opened plug-ins
    rabbitmq-plugins list [-v|-m] [-E|-e] [<pattern>]
    # Enable plug-ins
    rabbitmq-plugins enable <plugin1> <plugin2> ... <plugin_n>
    # Disable plug-ins
    rabbitmq-plugins disable <plugin1> <plugin2> ... <plugin_n>
    # Enable all plug-ins
    rabbitmq-plugins enable \
    amqp_client \
    cowboy \
    cowlib \
    rabbitmq_amqp1_0 \
    rabbitmq_auth_backend_ldap \
    rabbitmq_auth_mechanism_ssl \
    rabbitmq_consistent_hash_exchange \
    rabbitmq_event_exchange \
    rabbitmq_federation \
    rabbitmq_federation_management \
    rabbitmq_jms_topic_exchange \
    rabbitmq_management \
    rabbitmq_management_agent \
    rabbitmq_management_visualiser \
    rabbitmq_mqtt \
    rabbitmq_recent_history_exchange \
    rabbitmq_sharding \
    rabbitmq_shovel \
    rabbitmq_shovel_management \
    rabbitmq_stomp \
    rabbitmq_top \
    rabbitmq_tracing \
    rabbitmq_trust_store \
    rabbitmq_web_dispatch \
    rabbitmq_web_stomp \
    rabbitmq_web_stomp_examples \
    sockjs \
  2. rabbitmqctl command full solution (CLI mode management)

    # Format:
    rabbitmqctl [-n <node>] [-q] <command> [<command options>]
    # [basic order]
    # Stop rabbitmq
    rabbitmqctl stop <pid_file>
    # Stop running applications on rabbitmq
    rabbitmqctl stop_app
    # Wait for rabbitmq service to start
    rabbitmqctl wait <pid_file>
    # Initialize the node state (to execute rabbitmqctl stop app first)
    rabbitmqctl reset
    # Force initialization of node state
    rabbitmqctl force_reset
    # Rotate log files
    rabbitmqctl rotate_logs <suffix>
    # Cluster cluster management
    # The default node joins the cluster as disc node, - ram means that the node joins the cluster as ram node (to execute rabbitmqctl stop app first)
    rabbitmqctl join_cluster <node name> --ram
    # Show all node s in the cluster
    rabbitmqctl cluster_status
    # Change the mode of a node in a cluster. The node must be stopped before conversion. The only disk node in a cluster cannot be converted to a ram node
    rabbitmqctl change_cluster_node_type disc | ram
    # Remove a node in the cluster remotely, provided that the node must be in the offline state. If it is in the online state, you need to add the -- offline parameter.
    rabbitmqctl forget_cluster_node --offline
    # Update node s in cluster remotely
    rabbitmqctl update_cluster_nodes clusternode
    # Synchronize mirror queues
    rabbitmqctl sync_queue queue
    # Unsynchronize mirror queue
    rabbitmqctl cancel_sync_queue queue 
    # User management
    # Add rabbitmq user
    rabbitmqctl add_user <username> <password>
    # Delete rabbitmq user
    rabbitmqctl delete_user <username>
    # Change rabbitmq user password
    rabbitmqctl change_password <username> <newpassword>
    # Clear user password and disable user login
    rabbitmqctl clear_password <username>
    # Set user label
    rabbitmqctl set_user_tags <username> <tag1> <tag2> ... <tag_n>
    # List users
    rabbitmqctl list_users
    # Create a vhosts
    rabbitmqctl add_vhost <vhostpath>
    # Delete a vhosts
    rabbitmqctl delete_vhost <vhostpath>
    # List vhosts
    rabbitmqctl list_vhosts <vhostinfoitem1> <vhostinfoitem2> ... <vhostinfoitem_n>
    # Give users relevant permissions for a vhosts
    rabbitmqctl set_permissions [-p <vhostpath>] <user> <conf> <write> <read>
    # Clear a user's permission to vhosts
    rabbitmqctl clear_permissions [-p <vhostpath>] <username>
    # List which users can access the vhosts
    rabbitmqctl list_permissions [-p <vhostpath>]
    #List access rights for this user
    rabbitmqctl list_user_permissions <username>
    # Modify the vhost path parameter
    rabbitmqctl set_parameter [-p <vhostpath>] <component_name> <key> <value>
    # Clear the vhost path parameter
    rabbitmqctl clear_parameter [-p <vhostpath>] <component_name> <key>
    # List vhost path parameters
    rabbitmqctl list_parameters [-p <vhostpath>]
    # [policy management]
    # Name: policy name pattern: matching resource regular expression apply to: policy application type range, including [all, queues, exchange] priority: integer priority definition:json formatted policy
    rabbitmqctl set_policy [-p <vhostpath>] [--priority <priority>] [--apply-to <apply-to>] <name> <pattern> <definition(json)>
    #Clear a policy
    rabbitmqctl clear_policy [-p <vhostpath>] <name>
    # List existing policies
    rabbitmqctl list_policies [-p <vhostpath>]
    # [queues exchanges]
    # Returns the information of the queue. If the - p parameter is omitted, the information of "/" vhosts is displayed by default.
    rabbitmqctl list_queues [-p <vhostpath>] [<queueinfoitem> ...]
    # Return exchange information
    rabbitmqctl list_exchanges [-p <vhostpath>] [<exchangeinfoitem> ...]
    # Return binding information
    rabbitmqctl list_bindings [-p <vhostpath>] [<bindinginfoitem> ...]
    # Return to link information
    rabbitmqctl list_connections [<connectioninfoitem> ...]
    # Return all current channels
    rabbitmqctl list_channels [<channelinfoitem> ...]
    # Return consumers
    rabbitmqctl list_consumers [-p <vhostpath>]
    # Show broker status
    rabbitmqctl status
    # Display information about environment parameters
    rabbitmqctl environment
    # Return a service status report
    rabbitmqctl report
    # Return a service status eval
    rabbitmqctl eval <expr>
  3. rabbitmqctl management mode

    # Enable rabbitmq? Management
    rabbitmq-plugins enable rabbitmq_management
    # (if unsuccessful, execute rabbitmqctl start_app first)
    # web access:
    # api access:
    # cli access:
  4. Alipay red envelopes support authors

Tags: Linux RabbitMQ Erlang vim Unix

Posted on Tue, 17 Mar 2020 08:29:41 -0400 by kalinkap