linux 安装RebbisMQ3.86

#安装GCC GCC-C++ Openssl等模块
yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel
#安装ncurses
yum -y install ncurses-devel
#下载erlang

wget https://github.com/rabbitmq/erlang-rpm/releases/download/v22.3.4.4/erlang-22.3.4.4-1.el7.x86_64.rpm

#出错后用的yum erlang
yum install erlang
#下载socat

wget http://repo.iotti.biz/CentOS/6/x86_64/socat-1.7.3.2-1.el6.lux.x86_64.rpm

#出错安装
yum -y install socat
#下载rabbitmq

wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.6-rc.1/rabbitmq-server-3.8.6.rc.1-1.el6.noarch.rpm

rpm -ivh rabbitmq-server-3.8.6.rc.1-1.el6.noarch.rpm

#试运行rabbitmq
rabbitmq-server
#启动服务
sudo systemctl start rabbitmq-server

#查看状态
sudo systemctl status rabbitmq-server

#停止服务
sudo systemctl stop rabbitmq-server

#设置开机启动
sudo systemctl enable rabbitmq-server
#安装web插件
rabbitmq-plugins enable rabbitmq_management
#启动服务
sudo systemctl start rabbitmq-server
#添加防火墙
firewall-cmd --add-port=5672/tcp --permanent
firewall-cmd --add-port=15672/tcp --permanent
firewall-cmd --add-port=25672/tcp --permanent
#重新加载配置
firewall-cmd --reload
#重启防火墙
systemctl stop firewalld.service
systemctl start firewalld.service
systemctl enable firewalld.service
systemctl restart firewalld.service
#查看防火墙端口
firewall-cmd --permanent --list-port
#配置安全组
#5672/tcp
#15672/tcp
#25672/tcp

 配置rabbitmq.conf文件  放/usr/share/doc/rabbitmq-server-3.8.6~rc.1目录下  重启rabbitMQ

#在其上侦听“普通” AMQP 0-9-1和AMQP 1.0连接(不使用TLS)的端口或主机名/对。有关更多详细信息和示例,请参见网络指南。
#Ports or hostname/pair on which to listen for "plain" AMQP 0-9-1 and AMQP 1.0 connections (without TLS). See the Networking guide for more details and examples.
listeners.tcp.default = 5672

#接受TCP侦听器连接的Erlang进程数。
#Number of Erlang processes that will accept connections for the TCP listeners.
num_acceptors.tcp = 10

#AMQP 0-9-1握手(套接字连接和TLS握手后)的最长时间(以毫秒为单位)。
#Maximum time for AMQP 0-9-1 handshake (after socket connection and TLS handshake), in milliseconds
handshake_timeout = 10000

#侦听启用了TLS的AMQP 0-9-1和AMQP 1.0连接的端口或主机名/对。有关更多详细信息和示例,请参见TLS指南。
#Ports or hostname/pair on which to listen for TLS-enabled AMQP 0-9-1 and AMQP 1.0 connections. See the TLS guide for more details and examples.
#listeners.ssl = 

#接受来自客户端的TLS连接的Erlang进程数。
#Number of Erlang processes that will accept TLS connections from clients.
num_acceptors.ssl = 10

#TLS配置。请参阅TLS指南。
#TLS configuration. See the TLS guide.
ssl_options = none

#TLS handshake timeout, in milliseconds.
ssl_handshake_timeout = 5000

#	Memory threshold at which the flow control is triggered. Can be absolute or relative to the amount of RAM available to the OS:
vm_memory_high_watermark.relative = 0.6
vm_memory_high_watermark.absolute = 2GB

#See the memory-based flow control and alarms documentation.
vm_memory_high_watermark.relative = 0.4

#Strategy for memory usage reporting. Can be one of the following:
#allocated: uses Erlang memory allocator statistics
#rss: uses operating system RSS memory reporting. This uses OS-specific means and may start short lived child processes.
#legacy: uses legacy memory reporting (how much memory is considered to be used by the runtime). This strategy is fairly inaccurate.
#erlang: same as legacy, preserved for backwards compatibility
vm_memory_calculation_strategy = allocated

#Fraction of the high watermark limit at which queues start to page messages out to disc to free up memory. See the memory-based flow control documentation.
vm_memory_high_watermark_paging_ratio = 0.5

#Makes it possible to override the total amount of memory available, as opposed to inferring it from the environment using OS-specific means. This should only be used when actual maximum amount of RAM available to the node doesn't match the value that will be inferred by the node, e.g. due to containerization or similar constraints the node cannot be aware of. The value may be set to an integer number of bytes or, alternatively, in information units (e.g `8GB`). For example, when the value is set to 4 GB, the node will believe it is running on a machine with 4 GB of RAM.
#total_memory_available_override_value = 

#Disk free space limit of the partition on which RabbitMQ is storing data. When available disk space falls below this limit, flow control is triggered. The value can be set relative to the total amount of RAM or as an absolute value in bytes or, alternatively, in information units (e.g `50MB` or `5GB`):
#By default free disk space must exceed 50MB. See the Disk Alarms documentation.
disk_free_limit.relative = 3.0
#disk_free_limit.absolute = 2GB
disk_free_limit.absolute = 50MB

#Controls the granularity of logging. The value is a list of log event category and log level pairs.
#The level can be one of error (only errors are logged), warning (only errors and warning are logged), info (errors, warnings and informational messages are logged), or debug (errors, warnings, informational messages and debugging m essages are logged).
log.file.level = info

#Maximum permissible number of channels to negotiate with clients, not including a special channel number 0 used in the protocol. Setting to 0 means "unlimited", a dangerous value since applications sometimes have channel leaks. Using more channels increases memory footprint of the broker.
channel_max = 2047

#Channel operation timeout in milliseconds (used internally, not directly exposed to clients due to messaging protocol differences and limitations).
channel_operation_timeout = 15000

#The largest allowed message payload size in bytes. Messages of larger size will be rejected with a suitable channel exception.
#Default: 134217728
#Max value: 536870912
max_message_size = 134217728

#Value representing the heartbeat timeout suggested by the server during connection parameter negotiation. If set to 0 on both ends, heartbeats are disabled (this is not recommended). See the Heartbeats guide for details.
heartbeat = 60

#Virtual host to create when RabbitMQ creates a new database from scratch. The exchange `amq.rabbitmq.log` will exist in this virtual host.
default_vhost = /

#User name to create when RabbitMQ creates a new database from scratch.
default_user = 

#Password for the default user.
default_pass = 

#Tags for the default user.
default_user_tags.administrator = true

#Permissions to assign to the default user when creating it.
default_permissions.configure = .*
default_permissions.read = .*
default_permissions.write = .*

#List of users which are only permitted to connect to the broker via a loopback interface (i.e. `localhost`).
#To allow the default `guest` user to connect remotely (a security practice unsuitable for production use), set this to `none`:
# awful security practice,
# consider creating a new
# user with secure generated credentials!
#To restrict another user to localhost-only connections, do it like so (`monitoring` is the name of the user):
#loopback_users.monitoring = true
# guest uses well known
# credentials and can only
# log in from localhost
# by default
#loopback_users.guest = true
loopback_users = none


#es	Classic peer discovery backend's list of nodes to contact. For example, to cluster with nodes `rabbit@hostname1` and `rabbit@hostname2` on first boot:
cluster_formation.classic_config.nodes.1 = rabbit@hostname1
cluster_formation.classic_config.nodes.2 = rabbit@hostname2

#	Statistics collection mode. Primarily relevant for the management plugin. Options are:
#`none` (do not emit statistics events)
#`coarse` (emit per-queue / per-channel / per-connection statistics)
#`fine` (also emit per-message statistics)
collect_statistics = none

#Statistics collection interval in milliseconds. Primarily relevant for the management plugin.
collect_statistics_interval = 5000

#Affects the amount of time the management plugin will cache expensive management queries such as queue listings. The cache will multiply the elapsed time of the last query by this value and cache the result for this amount of time.
management_db_cache_multiplier = 5

SASL authentication mechanisms to offer to clients.
auth_mechanisms.1 = PLAIN
auth_mechanisms.2 = AMQPLAIN

#List of authentication and authorisation backends to use. See the access control guide for details and examples.
#Other databases than `rabbit_auth_backend_internal` are available through plugins.
auth_backends.1 = internal

#Set to `true` to have RabbitMQ perform a reverse DNS lookup on client connections, and present that information through `rabbitmqctl` and the management plugin.
reverse_dns_lookups = false

#Number of delegate processes to use for intra-cluster communication. On a machine which has a very large number of cores and is also part of a cluster, you may wish to increase this value.
delegate_count = 16

#Default socket options. You probably don't want to change this.
tcp_listen_options.backlog = 128
tcp_listen_options.nodelay = true
tcp_listen_options.linger.on = true
tcp_listen_options.linger.timeout = 0
tcp_listen_options.exit_on_close = false

#Do not use. This option is no longer supported. HiPE supported has been dropped starting with Erlang 22.
hipe_compile = false

#How to handle network partitions. Available modes are:
#ignore
#autoheal
#pause_minority
#pause_if_all_down
#pause_if_all_down mode requires additional parameters:
#nodes
#recover
#See the documentation on partitions for more information.
cluster_partition_handling = ignore

#How frequently nodes should send keepalive messages to other nodes (in milliseconds). Note that this is not the same thing as net_ticktime; missed keepalive messages will not cause nodes to be considered down.
cluster_keepalive_interval = 10000

#Size in bytes of message below which messages will be embedded directly in the queue index. You are advised to read the persister tuning documentation before changing this.
queue_index_embed_msgs_below = 4096

#Timeout used when waiting for Mnesia tables in a cluster to become available.
mnesia_table_loading_retry_timeout = 30000

#Retries when waiting for Mnesia tables in the cluster startup. Note that this setting is not applied to Mnesia upgrades or node deletions.
mnesia_table_loading_retry_limit = 10

#Batch size used to transfer messages to an unsynchronised replica (queue mirror). See documentation on eager batch synchronization.
mirroring_sync_batch_size = 4096

#Queue master location strategy. Available strategies are:
#min-masters
#client-local
#random
#See the documentation on queue master location for more information.
queue_master_locator = client-local

#If set to true, RabbitMQ will expect a proxy protocol header to be sent first when an AMQP connection is opened. This implies to set up a proxy protocol-compliant reverse proxy (e.g. HAproxy or AWS ELB) in front of RabbitMQ. Clients can't directly connect to RabbitMQ when proxy protocol is enabled, so all connections must go through the reverse proxy.
#See the networking guide for more information.
proxy_protocol = false

#Implementation module for queue indexing. You are advised to read the message store tuning documentation before changing this.
{rabbit, [
{msg_store_index_module, rabbit_msg_store_ets_index}
]}

#Implementation module for queue contents.
{rabbit, [
{backing_queue_module, rabbit_variable_queue}
]}

#Message store segment file size. Changing this for a node with an existing (initialised) database is dangerous can lead to data loss!
{rabbit, [
%% Changing this for a node
%% with an existing (initialised) database is dangerous can
%% lead to data loss!
{msg_store_file_size_limit, 16777216}
]}

#Used internally by the tracer. You shouldn't change this.
{rabbit, [
{trace_vhosts, []}
]}

#The credits that a queue process is given by the message store.
#By default, a queue process is given 4000 message store credits, and then 800 for every 800 messages that it processes.
#Messages which need to be paged out due to memory pressure will also use this credit.
#The Message Store is the last component in the credit flow chain. Learn about credit flow.
#This value only takes effect when messages are persisted to the message store. If messages are embedded on the queue index, then modifying this setting has no effect because credit_flow is NOT used when writing to the queue index.
{rabbit, [
{msg_store_credit_disc_bound, {4000, 800}}
]}

#After how many queue index journal entries it will be flushed to disk.
{rabbit, [
{queue_index_max_journal_entries, 32768}
]}

#Tunable value only for lazy queues when under memory pressure. This is the threshold at which the garbage collector and other memory reduction activities are triggered. A low value could reduce performance, and a high one can improve performance, but cause higher memory consumption. You almost certainly should not change this.
{rabbit, [
{lazy_queue_explicit_gc_run_operation_threshold, 1000}
]}

#Tunable value only for normal queues when under memory pressure. This is the threshold at which the garbage collector and other memory reduction activities are triggered. A low value could reduce performance, and a high one can improve performance, but cause higher memory consumption. You almost certainly should not change this.
{rabbit, [
{queue_explicit_gc_run_operation_threshold, 1000}
]}

 

#添加用户 用户名 admin 密码 admin web管理工具可用此用户登录
sudo rabbitmqctl add_user admin admin
#设置用户角色 管理员
sudo rabbitmqctl set_user_tags admin administrator
#tag(administrator,monitoring,policymaker,management)
#设置用户权限(接受来自所有Host的所有操作)
sudo rabbitmqctl  set_permissions -p "/" admin '.*' '.*' '.*'  
#查看用户权限
sudo rabbitmqctl list_user_permissions admin

#常用命令
# 添加用户
sudo rabbitmqctl add_user <username> <password>  
# 删除用户
sudo rabbitmqctl delete_user <username>  
# 修改用户密码
sudo rabbitmqctl change_password <username> <newpassword>  
# 清除用户密码(该用户将不能使用密码登陆,但是可以通过SASL登陆如果配置了SASL认证)
sudo rabbitmqctl clear_password <username> 
# 设置用户tags(相当于角色,包含administrator,monitoring,policymaker,management)
sudo rabbitmqctl set_user_tags <username> <tag>
# 列出所有用户
sudo rabbitmqctl list_users  
# 创建一个vhosts
sudo rabbitmqctl add_vhost <vhostpath>  
# 删除一个vhosts
sudo rabbitmqctl delete_vhost <vhostpath>  
# 列出vhosts
sudo rabbitmqctl list_vhosts [<vhostinfoitem> ...]  
# 针对一个vhosts给用户赋予相关权限;
sudo rabbitmqctl set_permissions [-p <vhostpath>] <user> <conf> <write> <read>  
# 清除一个用户对vhosts的权限;
sudo rabbitmqctl clear_permissions [-p <vhostpath>] <username>  
# 列出哪些用户可以访问该vhosts;
sudo rabbitmqctl list_permissions [-p <vhostpath>]   
# 列出用户访问权限;
sudo rabbitmqctl list_user_permissions <username>

 

访问 127.0.0.1:15672

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值