In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you how to run and manage RabbitMQ, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
RabbitMQ service management
Start the RabbitMQ application and the Erlang node
# / etc/init.d/rabbitmq-server start
Stop RabbitMQ applications and Erlang nodes
# / etc/init.d/rabbitmq-server stop
Or
# rabbitmqctl stop
Only start / stop RabbitMQ applications
[root@localhost ~] # rabbitmqctl stop_ app [root @ localhost ~] # rabbitmqctl start_app
Enable the management plug-in
# rabbitmq-plugins enable rabbitmq_management
RabbitMQ configuration file
There are two configuration files for RabbitMQ
One is the configuration file rabbitmq-env.conf for environment variables
One is the configuration file rabbitmq.config for configuration information
Note that these two files are not available by default and must be created by yourself if necessary. If RabbitMQ is installed with the RPM package, its configuration file directory is / etc/rabbitmq. We need to manually create the rabbitmq.config file and rabbitmq-env.conf file in this directory, and change the master group of these files to rabbitmq
[root@localhost rabbitmq] # lltotal 12 RW rabbitmq-env.conf-1 root root 23 Nov 10 18:37 enabled_plugins-rw-r--r-- 1 rabbitmq rabbitmq 36 Nov 10 18:35 rabbitmq.config-rw-r--r-- 1 rabbitmq rabbitmq 80 Nov 10 18:35 rabbitmq-env.conf
Rabbitmq-env.conf
The location of this file is determined and cannot be changed, located in the: / etc/rabbitmq directory (this directory needs to be created by yourself).
The contents of the file include some environment variables of RabbitMQ, commonly used are:
RABBITMQ_NODENAME=FZTEC-240088 node name RABBITMQ_NODE_IP_ADDRESS=127.0.0.1 snooping IPRABBITMQ_NODE_PORT=5672 snooping port RABBITMQ_LOG_BASE=/data/rabbitmq/log log directory RABBITMQ_PLUGINS_DIR=/data/rabbitmq/plugins plug-in directory RABBITMQ_MNESIA_BASE=/data/rabbitmq/mnesia backend storage directory
Rabbitmq.config
This is a standard erlang configuration file. It must conform to the standards of the erlang configuration file.
It has a default directory or can be configured in a rabbitmq-env.conf file, which is structured in a hash array format
For example:
[{mnesia, [{dump_log_write_threshold, 1000}]}, {rabbit, [{vm_memory_high_watermark, 1000}]} {rabbitmq_management, [{listener, [{port, 55673}, {ip, "0.0.0.0"}].
Mnesia refers to the Mnesia database configuration option, and Mnesia is used by RabbitMQ to store switch and queue metadata
Rabbit refers to RabbitMQ-specific configuration options, and the expression for each option is {[option_name], [option_value]}.
Mnesia configuration options:
Dump_log_write_threshold: the default value is 100, which specifies how many entries must be stored in the log before the dump operation occurs, and how often only appended log contents are flushed / dumped to the real database file. Setting a higher value will reduce the load on Ithumb O and increase the performance of persisted messages.
Rabbit configuration options:
Tcp_listeners: default value [{"0.0.0.0", 5672},], which defines the IP address and port {"ip address", "port number"} array of non-SSL encrypted traffic that RabbitMQ should listen to. Ssl_listeners: the default value is empty, and defines the IP address and port {"ip address", "port number"} array of SSL encrypted traffic that RabbitMQ should listen for. Ssl_options: the default value is empty. Specify SSL-related options, including cacertfile (CA certificate file), keyfile (key file) and fail_if_no_peer_cert (client valid certificate) {"key", "value"} array vm_memory_high_watermark: default value 0.4 controls the percentage of memory allowed to be consumed by RabbitMQ, 0.4% decimal value msg_store_file_size_limit: default value 16777216 before garbage collection storage content Maximum size integer Bqueue_index_max_journal_entries of the message store database: default value 262144 the maximum size integer of the message store database before it is dumped to the message store database and submitted
Other parameters:
Disk_free_limit disk low water mark, if the disk capacity is lower than the specified value, it will stop receiving data. The default value is {mem_relative, 1.0}, that is, 1:1 is associated with memory, and the number of byte can also be customized.
Hipe_compile compiles part of the rabbimq code with High Performance Erlang compiler to improve performance. This parameter is experimental and should be turned off if erlang vm segfaults occurs.
Force_fine_statistics. This parameter belongs to rabbimq_management. If true is used, fine statistics will be performed, but the performance will be affected.
For more details on the two RabbitMQ profiles, please refer to the official website.
Http://www.rabbitmq.com/configure.html#configuration-file
RabbitMQ user Management
Add a user:
Rabbitmqctl add_user [username] [password]
For example:
Rabbitmqctl add_user pms pms
Set the user's tags to administrator. Note that this step is very important, otherwise you cannot use the created user to log in and manage the MQ service through a web browser
Rabbitmqctl set_user_tags pms administrator
Delete a user:
Rabbitmqctl delete_user [username]
Note: when you delete a user, any access control entries that reference that user are automatically deleted from the Rabbit permissions database. Colleague rabbit will not warn you that user-related access control entries will also be deleted.
Change the user's password:
Rabbitmqctl change_password Username Newpassword
List users
Rabbitmqctl list_users
Change password
Rabbitmqctl change_password [username] [newpasswd]
RabbitMQ rights management
RabbitMQ permission classification:
Read: any action about consuming messages, including clearing the entire queue (requires a successful binding operation)
Write: publish message (bind operation is required to succeed)
Configuration: creation and deletion of queues and switches
Permission settings:
Rabbitmqctl set_permissions-p [vhost_name] [user_name] [config] [write] [read]
Example 1:
Rabbitmqctl set_permissions-p / guest ". *"
-p /: indicates setting permissions on / virtual host, and how to omit vhost. Default is "/" virtual host.
Guest: setting permissions on guest users
The last three ". *" correspond to the permissions of configuration, write and read, respectively.
". *" is a regular expression that refers to all permissions, and ". *" means to match all switches and queues. This allows guest users to perform configuration, write, and read commands on all queues and switches of the / virtual host.
Example 2:
# rabbitmqctl set_permissions-p / aaa "" check-.* "". * "Setting permissions for user" aaa "in vhost" / ".
The "/" virtual host is given unconfigurable permissions to aaa users, restricting write operations to queues and switches that begin with "check-" and operations that are readable to all queues and switches.
View permissions
Rabbitmqctl list_permissions-p [vhost_name] rabbitmqctl list_permissions-p / Listing permissions in vhost "/". Guest. * spms. * aaa check-.*. *
Delete permission
Rabbitmqctl clear_permissions-p [vhost_name] [user_name]
For example:
Rabbitmqctl clear_permissions-p / aaa Clearing permissions for user "aaa" in vhost "/". [root@localhost ~] # rabbitmqctl list_permissions-p / Listing permissions in vhost "/". Guest. * spms. *
MQ user role
According to personal understanding, user roles can be divided into five categories: Super Admin, Monitor, Policy maker, General Manager, and others.
(1) Super Admin (administrator)
You can log in to the management console (with management plugin enabled), you can view all the information, and you can operate on users, policies (policy).
(2) Supervisor (monitoring)
You can log in to the management console (if management plugin is enabled), and you can view information about rabbitmq nodes (number of processes, memory usage, disk usage, etc.)
(3) Strategy maker (policymaker)
Log in to the management console (with management plugin enabled) and manage policy at the same time. However, you cannot view the information about the node (the part identified in the red box above). In contrast to administrator, administrator can see this.
(4) General Manager (management)
You can only log in to the administrative console (with management plugin enabled), and you cannot see node information or manage policies.
(5) other
Unable to log on to the management console, usually ordinary producers and consumers.
The above is all the contents of the article "how to run and manage RabbitMQ". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.