在Web的可视化管理界面中可以看到一些文件的路径
比如
Config文件的地址
数据库存放的文件夹
log文件的地址
进入到这个文件夹会发现有这些文件,其中example是config的示例文件,事实上config文件是空的,我们需要从示例文件中拷贝代码到config中
下面是示例文件的全部内容,其中有一些需要我们关注的
tcp_listeners 端口设置,这里默认的是5672。这边还提供了另一种设置方法
{tcp_listeners, [5672]}
{tcp_listeners, [{ "127.0.0.1", 5672}, %% { "::1", 5672}]}
日志输出级别设置,默认是info。这会产生大量的无用日志,甚至可以把硬盘挤爆,所以设置成error级别就好
{log_levels, [{connection, error}, {channel, error}]}
内存占用设置,可以根据百分比设置,也可以根据G、 M、Kb去设置,当超出时会让connection blocked
{vm_memory_high_watermark, 0.4}
硬盘占用设置,和内存相同,在压力较大时也会connection blocked
{vm_memory_high_watermark, 0.4}
config里还有很多重要的设置,比如默认的vhost、 user。当然现在一一去说的话会让人感到莫名所以,因为我们才刚开始接触到RabbitMQ。所以在后面的学习中再一一讲解
%% -*- 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]}, %% Number of Erlang processes that will accept connections for the TCP %% and SSL listeners. %% %% {num_tcp_acceptors, 10}, %% {num_ssl_acceptors, 1}, %% Maximum time for AMQP 0-8/0-9/0-9-1 handshake (after socket connection %% and SSL handshake), in milliseconds. %% %% {handshake_timeout, 10000}, %% Log levels (currently just used for connection logging). %% One of 'debug', 'info', 'warning', 'error' or 'none', in decreasing %% order of verbosity. Defaults to 'info'. %% {log_levels, [{connection, error}, {channel, error}]} %% 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 %% ============== %% %% The default "guest" user is only permitted to access the server %% via a loopback interface (e.g. localhost). %% {loopback_users, [<<"guest">>]}, %% %% Uncomment the following line if you want to allow access to the %% guest user from anywhere on the network. %% {loopback_users, []}, %% 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]}, %%