1、首先确定linux上的iptables是否把相关端口禁了。service iptables stop停掉试试。
2、rabbitmq 添加远程访问功能
3.3.1版中,处于安全的考虑,guest这个默认的用户只能通过http://localhost:15672 来登录,其他的IP无法直接使用这个账号。 这对于服务器上没有安装桌面的情况是无法管理维护的,除非通过在前面添加一层代理向外提供服务,这个又有些麻烦了,这里通过配置文件来实现这个功能。
只要编辑 /etc/rabbitmq/rabbitmq.config 文件,添加以下配置就可以了。
[
{rabbit, [{tcp_listeners, [5672]}, {loopback_users, ["asdf"]}]}
].
现在添加了一个新授权用户asdf,可以通过外网使用这个用户名和密码访问.(记得要先用命令添加这个命令才行, #rabbitmqctl add_user asdf 123456)我是通过在管理平台里直接添加的用户和密码的,我的测试环境装有桌面的。
我用rpm包安装的rabbitmq,所以提供默认的配置参考文件,如果你使用源码编译的话,可以找到一个默认的配置文件rabbitmq.config.example,点击这里下载此文件rabbitmq.config
=================================rabbitmq.config=============================
%% -*- mode: erlang -*- %% ---------------------------------------------------------------------------- %% RabbitMQ Sample Configuration File. %% %% See http://www.rabbitmq.com/configure.html for details. %% ---------------------------------------------------------------------------- [ {rabbit, [%% %% Network Connectivity %% ==================== %% %% By default, RabbitMQ will listen on all interfaces, using %% the standard (reserved) AMQP port. %% %% {tcp_listeners, [5672]}, %% To listen on a specific interface, provide a tuple of {IpAddress, Port}. %% For example, to listen only on localhost for both IPv4 and IPv6: %% %% {tcp_listeners, [{"127.0.0.1", 5672}, %% {"::1", 5672}]}, %% SSL listeners are configured in the same fashion as TCP listeners, %% including the option to control the choice of interface. %% %% {ssl_listeners, [5671]}, %% Log levels (currently just used for connection logging). %% One of 'info', 'warning', 'error' or 'none', in decreasing order %% of verbosity. Defaults to 'info'. %% %% {log_levels, [{connection, info}]}, %% Set to 'true' to perform reverse DNS lookups when accepting a %% connection. Hostnames will then be shown instead of IP addresses %% in rabbitmqctl and the management plugin. %% %% {reverse_dns_lookups, true}, %% %% Security / AAA %% ============== %% %% Configuring SSL. %% See http://www.rabbitmq.com/ssl.html for full documentation. %% %% {ssl_options, [{cacertfile, "/path/to/testca/cacert.pem"}, %% {certfile, "/path/to/server/cert.pem"}, %% {keyfile, "/path/to/server/key.pem"}, %% {verify, verify_peer}, %% {fail_if_no_peer_cert, false}]}, %% Choose the available SASL mechanism(s) to expose. %% The two default (built in) mechanisms are 'PLAIN' and %% 'AMQPLAIN'. Additional mechanisms can be added via %% plugins. %% %% See http://www.rabbitmq.com/authentication.html for more details. %% %% {auth_mechanisms, ['PLAIN', 'AMQPLAIN']}, %% Select an authentication database to use. RabbitMQ comes bundled %% with a built-in auth-database, based on mnesia. %% %% {auth_backends, [rabbit_auth_backend_internal]}, %% Configurations supporting the rabbitmq_auth_mechanism_ssl and %% rabbitmq_auth_backend_ldap plugins. %% %% NB: These options require that the relevant plugin is enabled. %% See http://www.rabbitmq.com/plugins.html for further details. %% The RabbitMQ-auth-mechanism-ssl plugin makes it possible to %% authenticate a user based on the client's SSL certificate. %% %% To use auth-mechanism-ssl, add to or replace the auth_mechanisms %% list with the entry 'EXTERNAL'. %% %% {auth_mechanisms, ['EXTERNAL']}, %% The rabbitmq_auth_backend_ldap plugin allows the broker to %% perform authentication and authorisation by deferring to an %% external LDAP server. %% %% For more information about configuring the LDAP backend, see %% http://www.rabbitmq.com/ldap.html. %% %% Enable the LDAP auth backend by adding to or replacing the %% auth_backends entry: %% %% {auth_backends, [rabbit_auth_backend_ldap]}, %% This pertains to both the rabbitmq_auth_mechanism_ssl plugin and %% STOMP ssl_cert_login configurations. See the rabbitmq_stomp %% configuration section later in this fail and the README in %% https://github.com/rabbitmq/rabbitmq-auth-mechanism-ssl for further %% details. %% %% To use the SSL cert's CN instead of its DN as the username %% %% {ssl_cert_login_from, common_name}, %% %% Default User / VHost %% ==================== %% %% On first start RabbitMQ will create a vhost and a user. These %% config items control what gets created. See %% http://www.rabbitmq.com/access-control.html for further %% information about vhosts and access control. %% %% {default_vhost, <<"/">>}, %% {default_user, <<"guest">>}, %% {default_pass, <<"guest">>}, %% {default_permissions, [<<".*">>, <<".*">>, <<".*">>]}, %% Tags for default user %% %% For more details about tags, see the documentation for the %% Management Plugin at http://www.rabbitmq.com/management.html. %% %% {default_user_tags, [administrator]}, %% %% Additional network and protocol related configuration %% ===================================================== %% %% Set the default AMQP heartbeat delay (in seconds). %% %% {heartbeat, 600}, %% Set the max permissible size of an AMQP frame (in bytes). %% %% {frame_max, 131072}, %% Set the max permissible number of channels per connection. %% 0 means "no limit". %% %% {channel_max, 128}, %% Customising Socket Options. %% %% See (http://www.erlang.org/doc/man/inet.html#setopts-2) for %% further documentation. %% %% {tcp_listen_options, [binary, %% {packet, raw}, %% {reuseaddr, true}, %% {backlog, 128}, %% {nodelay, true}, %% {exit_on_close, false}]}, %% %% Resource Limits & Flow Control %% ============================== %% %% See http://www.rabbitmq.com/memory.html for full details. %% Memory-based Flow Control threshold. %% %% {vm_memory_high_watermark, 0.4}, %% Fraction of the high watermark limit at which queues start to %% page message out to disc in order to free up memory. %% %% {vm_memory_high_watermark_paging_ratio, 0.5}, %% Set disk free limit (in bytes). Once free disk space reaches this %% lower bound, a disk alarm will be set - see the documentation %% listed above for more details. %% %% {disk_free_limit, 50000000}, %% Alternatively, we can set a limit relative to total available RAM. %% %% {disk_free_limit, {mem_relative, 1.0}}, %% %% Misc/Advanced Options %% ===================== %% %% NB: Change these only if you understand what you are doing! %% %% To announce custom properties to clients on connection: %% %% {server_properties, []}, %% How to respond to cluster partitions. %% See http://www.rabbitmq.com/partitions.html for further details. %% %% {cluster_partition_handling, ignore}, %% Make clustering happen *automatically* at startup - only applied %% to nodes that have just been reset or started for the first time. %% See http://www.rabbitmq.com/clustering.html#auto-config for %% further details. %% %% {cluster_nodes, {['rabbit@my.host.com'], disc}}, %% Set (internal) statistics collection granularity. %% %% {collect_statistics, none}, %% Statistics collection interval (in milliseconds). %% %% {collect_statistics_interval, 5000}, %% Explicitly enable/disable hipe compilation. %% %% {hipe_compile, true} ]}, %% ---------------------------------------------------------------------------- %% Advanced Erlang Networking/Clustering Options. %% %% See http://www.rabbitmq.com/clustering.html for details %% ---------------------------------------------------------------------------- {kernel, [%% Sets the net_kernel tick time. %% Please see http://erlang.org/doc/man/kernel_app.html and %% http://www.rabbitmq.com/nettick.html for further details. %% %% {net_ticktime, 60} ]}, %% ---------------------------------------------------------------------------- %% RabbitMQ Management Plugin %% %% See http://www.rabbitmq.com/management.html for details %% ---------------------------------------------------------------------------- {rabbitmq_management, [%% Pre-Load schema definitions from the following JSON file. See %% http://www.rabbitmq.com/management.html#load-definitions %% %% {load_definitions, "/path/to/schema.json"}, %% Log all requests to the management HTTP API to a file. %% %% {http_log_dir, "/path/to/access.log"}, %% Change the port on which the HTTP listener listens, %% specifying an interface for the web server to bind to. %% Also set the listener to use SSL and provide SSL options. %% %% {listener, [{port, 12345}, %% {ip, "127.0.0.1"}, %% {ssl, true}, %% {ssl_opts, [{cacertfile, "/path/to/cacert.pem"}, %% {certfile, "/path/to/cert.pem"}, %% {keyfile, "/path/to/key.pem"}]}]}, %% Configure how long aggregated data (such as message rates and queue %% lengths) is retained. Please read the plugin's documentation in %% https://www.rabbitmq.com/management.html#configuration for more %% details. %% %% {sample_retention_policies, %% [{global, [{60, 5}, {3600, 60}, {86400, 1200}]}, %% {basic, [{60, 5}, {3600, 60}]}, %% {detailed, [{10, 5}]}]} ]}, {rabbitmq_management_agent, [%% Misc/Advanced Options %% %% NB: Change these only if you understand what you are doing! %% %% {force_fine_statistics, true} ]}, %% ---------------------------------------------------------------------------- %% RabbitMQ Shovel Plugin %% %% See http://www.rabbitmq.com/shovel.html for details %% ---------------------------------------------------------------------------- {rabbitmq_shovel, [{shovels, [%% A named shovel worker. %% {my_first_shovel, %% [ %% List the source broker(s) from which to consume. %% %% {sources, %% [%% URI(s) and pre-declarations for all source broker(s). %% {brokers, ["amqp://user:password@host.domain/my_vhost"]}, %% {declarations, []} %% ]}, %% List the destination broker(s) to publish to. %% {destinations, %% [%% A singular version of the 'brokers' element. %% {broker, "amqp://"}, %% {declarations, []} %% ]}, %% Name of the queue to shovel messages from. %% %% {queue, <<"your-queue-name-goes-here">>}, %% Optional prefetch count. %% %% {prefetch_count, 10}, %% when to acknowledge messages: %% - no_ack: never (auto) %% - on_publish: after each message is republished %% - on_confirm: when the destination broker confirms receipt %% %% {ack_mode, on_confirm}, %% Overwrite fields of the outbound basic.publish. %% %% {publish_fields, [{exchange, <<"my_exchange">>}, %% {routing_key, <<"from_shovel">>}]}, %% Static list of basic.properties to set on re-publication. %% %% {publish_properties, [{delivery_mode, 2}]}, %% The number of seconds to wait before attempting to %% reconnect in the event of a connection failure. %% %% {reconnect_delay, 2.5} %% ]} %% End of my_first_shovel ]} %% Rather than specifying some values per-shovel, you can specify %% them for all shovels here. %% %% {defaults, [{prefetch_count, 0}, %% {ack_mode, on_confirm}, %% {publish_fields, []}, %% {publish_properties, [{delivery_mode, 2}]}, %% {reconnect_delay, 2.5}]} ]}, %% ---------------------------------------------------------------------------- %% RabbitMQ Stomp Adapter %% %% See http://www.rabbitmq.com/stomp.html for details %% ---------------------------------------------------------------------------- {rabbitmq_stomp, [%% Network Configuration - the format is generally the same as for the broker %% Listen only on localhost (ipv4 & ipv6) on a specific port. %% {tcp_listeners, [{"127.0.0.1", 61613}, %% {"::1", 61613}]}, %% Listen for SSL connections on a specific port. %% {ssl_listeners, [61614]}, %% Additional SSL options %% Extract a name from the client's certificate when using SSL. %% %% {ssl_cert_login, true}, %% Set a default user name and password. This is used as the default login %% whenever a CONNECT frame omits the login and passcode headers. %% %% Please note that setting this will allow clients to connect without %% authenticating! %% %% {default_user, [{login, "guest"}, %% {passcode, "guest"}]}, %% If a default user is configured, or you have configured use SSL client %% certificate based authentication, you can choose to allow clients to %% omit the CONNECT frame entirely. If set to true, the client is %% automatically connected as the default user or user supplied in the %% SSL certificate whenever the first frame sent on a session is not a %% CONNECT frame. %% %% {implicit_connect, true} ]}, %% ---------------------------------------------------------------------------- %% RabbitMQ MQTT Adapter %% %% See http://hg.rabbitmq.com/rabbitmq-mqtt/file/stable/README.md for details %% ---------------------------------------------------------------------------- {rabbitmq_mqtt, [%% Set the default user name and password. Will be used as the default login %% if a connecting client provides no other login details. %% %% Please note that setting this will allow clients to connect without %% authenticating! %% %% {default_user, <<"guest">>}, %% {default_pass, <<"guest">>}, %% Enable anonymous access. If this is set to false, clients MUST provide %% login information in order to connect. See the default_user/default_pass %% configuration elements for managing logins without authentication. %% %% {allow_anonymous, true}, %% If you have multiple chosts, specify the one to which the %% adapter connects. %% %% {vhost, <<"/">>}, %% Specify the exchange to which messages from MQTT clients are published. %% %% {exchange, <<"amq.topic">>}, %% Specify TTL (time to live) to control the lifetime of non-clean sessions. %% %% {subscription_ttl, 1800000}, %% Set the prefetch count (governing the maximum number of unacknowledged %% messages that will be delivered). %% %% {prefetch, 10}, %% TCP/SSL Configuration (as per the broker configuration). %% %% {tcp_listeners, [1883]}, %% {ssl_listeners, []}, %% TCP/Socket options (as per the broker configuration). %% %% {tcp_listen_options, [binary, %% {packet, raw}, %% {reuseaddr, true}, %% {backlog, 128}, %% {nodelay, true}]} ]}, %% ---------------------------------------------------------------------------- %% RabbitMQ AMQP 1.0 Support %% %% See http://hg.rabbitmq.com/rabbitmq-amqp1.0/file/default/README.md %% for details %% ---------------------------------------------------------------------------- {rabbitmq_amqp1_0, [%% Connections that are not authenticated with SASL will connect as this %% account. See the README for more information. %% %% Please note that setting this will allow clients to connect without %% authenticating! %% %% {default_user, "guest"}, %% Enable protocol strict mode. See the README for more information. %% %% {protocol_strict_mode, false} ]}, %% ---------------------------------------------------------------------------- %% RabbitMQ LDAP Plugin %% %% See http://www.rabbitmq.com/ldap.html for details. %% %% ---------------------------------------------------------------------------- {rabbitmq_auth_backend_ldap, [%% %% Connecting to the LDAP server(s) %% ================================ %% %% Specify servers to bind to. You *must* set this in order for the plugin %% to work properly. %% %% {servers, ["your-server-name-goes-here"]}, %% Connect to the LDAP server using SSL %% %% {use_ssl, false}, %% Specify the LDAP port to connect to %% %% {port, 389}, %% LDAP connection timeout, in milliseconds or 'infinity' %% %% {timeout, infinity}, %% Enable logging of LDAP queries. %% One of %% - false (no logging is performed) %% - true (verbose logging of the logic used by the plugin) %% - network (as true, but additionally logs LDAP network traffic) %% %% Defaults to false. %% %% {log, false}, %% %% Authentication %% ============== %% %% Pattern to convert the username given through AMQP to a DN before %% binding %% %% {user_dn_pattern, "cn=${username},ou=People,dc=example,dc=com"}, %% Alternatively, you can convert a username to a Distinguished %% Name via an LDAP lookup after binding. See the documentation for %% full details. %% When converting a username to a dn via a lookup, set these to %% the name of the attribute that represents the user name, and the %% base DN for the lookup query. %% %% {dn_lookup_attribute, "userPrincipalName"}, %% {dn_lookup_base, "DC=gopivotal,DC=com"}, %% Controls how to bind for authorisation queries and also to %% retrieve the details of users logging in without presenting a %% password (e.g., SASL EXTERNAL). %% One of %% - as_user (to bind as the authenticated user - requires a password) %% - anon (to bind anonymously) %% - {UserDN, Password} (to bind with a specified user name and password) %% %% Defaults to 'as_user'. %% %% {other_bind, as_user}, %% %% Authorisation %% ============= %% %% The LDAP plugin can perform a variety of queries against your %% LDAP server to determine questions of authorisation. See %% http://www.rabbitmq.com/ldap.html#authorisation for more %% information. %% Set the query to use when determining vhost access %% %% {vhost_access_query, {in_group, %% "ou=${vhost}-users,ou=vhosts,dc=example,dc=com"}}, %% Set the query to use when determining resource (e.g., queue) access %% %% {resource_access_query, {constant, true}}, %% Set queries to determine which tags a user has %% %% {tag_queries, []} ]} ].
相关推荐
在Linux环境中,有时我们需要在没有网络连接的...确保在新环境下复制所有相关RPM包和配置文件,以便在其他机器上重复此过程。记住,离线安装需要仔细规划和准备,以确保所有依赖都已解决,避免在安装过程中出现错误。
如果需要配置RabbitMQ集群,可以在多台机器上重复以上步骤,并在每台机器上配置相应的节点名称和集群信息。例如,在两台机器上分别配置为node1和node2,然后在node1上添加node2作为集群成员: ```bash rabbitmqctl ...
首先,你需要在你的机器上安装Erlang环境。Erlang是一种并发、分布式、热代码升级的编程语言,特别适合构建高可用性系统,如RabbitMQ。确保你安装的Erlang版本与RabbitMQ当前版本兼容。你可以访问Erlang Solutions的...
此外,RabbitMQ还具备高可用性,通过集群和镜像队列可以在多台机器间复制数据,提供故障转移能力。集群配置涉及节点间的通信和数据同步,而镜像队列则可以在多个节点上保持队列的完全副本。 总的来说,RabbitMQ ...
在本教程中,我们将深入探讨如何在 CentOS 7 操作系统上安装 RabbitMQ,这是一个流行的开源消息代理,基于AMQP(Advanced Message Queuing Protocol)协议。RabbitMQ 使用 Erlang 语言开发,它提供了一个可靠的平台...
9. **Virtual Hosts**:虚拟主机是逻辑隔离的RabbitMQ实例,用于在同一台物理机器上划分多个独立的RabbitMQ环境。 了解了这些基本概念后,你就可以根据业务需求创建exchange、queue和binding,设置相应的路由策略,...
RabbitMQ可以在多个操作系统上运行,包括Linux发行版如CentOS。在这个场景中,我们讨论的是在CentOS 7.5上离线安装RabbitMQ及其依赖的RPM包。 首先,让我们深入了解一下RabbitMQ的核心概念。RabbitMQ服务器作为消息...
【RabbitMQ安装详解】 ...通过以上步骤,你应该能在CentOS 6.5上成功安装并配置RabbitMQ,包括开启Web管理界面并解决远程访问问题。请注意,安全最佳实践是创建新的用户和虚拟主机,而不是依赖于默认的`guest`用户。
- **负载均衡**:通过在多个RabbitMQ实例之间分发队列,可以在多台机器上平衡消息处理的负载。 - **集群部署**:RabbitMQ支持集群部署模式,可以实现高可用性和水平扩展性。在集群模式下,所有节点都可以接受客户端...
2. **集群搭建**: 若要构建高可用的 RabbitMQ 集群,需要在多台机器上安装并配置 RabbitMQ,然后通过节点间的通信实现数据同步。 3. **监控与日志**: RabbitMQ 提供了丰富的监控工具和日志记录,可以通过 `...
7. **验证安装**:启动浏览器,访问 `http://localhost:15672` (如果在其他机器上,使用相应的IP地址),输入默认的用户名和密码登录Web管理界面,确认RabbitMQ已成功运行。 8. **进一步配置**:根据实际需求,...
9. **分布式部署**:RabbitMQ支持集群模式,可以在多台机器上部署,实现节点间的负载均衡和故障转移。通过`rabbitmqctl join_cluster`命令将节点加入到集群。 10. **标签“源码软件”**:如果压缩包包含RabbitMQ...
2. **分布式**:Erlang节点可以在不同的机器上运行,并且可以相互通信,这使得构建分布式系统变得简单。 3. **容错性**:Erlang通过进程隔离和热代码升级机制,提供了一种优雅的方式来处理错误,允许程序在不中断...
1. **环境准备**:确保你的机器上已经安装了Erlang环境,因为RabbitMQ依赖于Erlang运行。 2. **下载RabbitMQ**:访问RabbitMQ官网,找到适合你操作系统的最新版本的RabbitMQ服务器包。 3. **安装RabbitMQ**:解压...
通过以上介绍,我们可以看到RabbitMQ和Erlang的结合,为开发者提供了一个强大且可靠的分布式消息系统,使得在CentOS7这样的Linux环境中部署和管理消息队列变得相对简单。在实际项目中,掌握这两个技术将极大地提升...
2. **安装Erlang环境**:RabbitMQ是用Erlang编程语言编写的,因此首先需要在目标机器上安装Erlang环境。 3. **安装RabbitMQ**:对于Windows,运行安装程序;对于Linux,解压RabbitMQ二进制文件,并将其添加到系统...
在本文中,我们将深入探讨如何在CentOS 7系统上进行RabbitMQ的离线安装,使用提供的RPM安装包。RabbitMQ是一款开源的消息队列服务器,它基于AMQP(Advanced Message Queuing Protocol),广泛应用于分布式系统中的...
在这个“RabbitMq-3.9.15”压缩包中,包含的是RabbitMQ服务器的3.9.15版本,以及必要的依赖软件——Erlang和socat,这些都是在Linux系统上成功安装和运行RabbitMQ所必需的组件。 **Erlang** Erlang是一种面向并发的...
在Linux系统中,RabbitMQ是一个广泛使用的开源消息代理和队列服务器,它基于AMQP(Advanced Message Queuing Protocol)标准。在CentOS 8上安装RabbitMQ可以通过使用包管理器`yum`来实现,这使得过程变得更加简单。...
在IP地址为192.168.1.233的机器上安装控制节点时,首先要配置防火墙规则,确保OpenStack服务所需的端口开放。接着,安装RabbitMQ,这是一个消息代理,OpenStack服务间通信依赖它。然后是MySQL数据库的安装,MySQL...