RabbitMQ (1), rabbitmq
After reading the introduction of RabbitMQ, it is mainly a message queue, that is, a message queue, which constantly writes information to the message queue, while the other end can read the information. It is mainly used to process messages. Currently, it is installed with Linux version RabbitMQ:
1: Install erlang
Apt-get install erlang-nox
2. download and install the RabbitMQ installation package
I downloaded the latest installation package installed rabbitmq-server_3.3.4-1_all.deb directly on its official website
3: Start
/Etc/init. d/rabbitmq-server start
4. Create a vhost
Rabbitmqctl add_vhost/pyhtest
I didn't know why I couldn't create it for the first time. I tried it again.
5. Create a user for the vhost.
Rabbitmqctl add_user pyh pyh1234
User name pyh password pyh1234
6. Create Permissions
Rabbitmqctl set_permissions-p/pyhtest pyh ". *"
* Indicates all permissions.
Later I wrote a send and receive statement. Now I haven't completed the sending and consumption process ......
The official website provides detailed examples, such as Hello World! :
Http://www.rabbitmq.com/tutorials/tutorial-one-python.html
How to configure multiple RabbitMQ instances on one machine
There are three configuration files for Rabbitmq, which are located at/etc/rabbitmq/. The three files are: (1) enabled_plugins. Set the list of allowed plug-ins, the configuration file is in the List format of erlang, such as [rabbitmq_management, rabbitmq_visualiser]. (2) rabbitmq. conf, set the operation parameters of rabbitmq. Each parameter in this configuration file is a tuple of erlang. The structure is {Key, Value}, Key is of the atom type, and Value is a term. The key parameters are: tcp_listerners sets the listening port of rabbimq. The default value is [5672]. Disk_free_limit: low watermark of a disk. If the disk capacity is lower than the specified value, the system stops receiving data. The default value is {mem_relative, 1.0}, which is associated with the memory and can be customized. vm_memory_high_watermark: Set the low-level memory line. If it is lower than this level line, the traffic control mechanism is enabled. The default value is 0.4, that is, 40% of the total memory. Hipe_compile uses High Performance Erlang compiler to compile some rabbimq code to improve Performance. This parameter is experimental. If erlang vm segfaults appears, disable it.
What scenarios does rabbitmq apply?
Rabbitmq
Edit
MQ is called Message Queue. MQ is a communication method for applications. Applications write and retrieve data (messages) for applications in the inbound and outbound queues to communicate with each other without dedicated connections. Message transmission refers to the communication between programs by sending data in messages, rather than by directly calling each other. Direct calls are usually used for such remote process calls. Queuing means that applications communicate through queues. The use of the queue removes the need to receive and send applications simultaneously. Among them, more mature MQ products include ibm websphere mq.
Use Cases
In the project, some operations that do not require immediate return and time-consuming are extracted for asynchronous processing. This asynchronous processing method greatly saves the server's request response time, this improves the system throughput.