When you run the RabbitMQ server on a VM, the connection speed from Windows is slow and the task often times out. The following workaround applies to any server running from a virtual machine, such as Tomcat, etc.

Step1 find the hostname for CentOS7

$ hostname
Copy the code

In this example, hostname is “bogon”

Step2 add the local host and IP address to the hosts file

$ vim /etc/hosts
Copy the code

When you open it, you see

127.0.0.1 localhost localhost.localdomain localhost4 localhost4. Localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6Copy the code

Add your IP and hostname to the end, in this case as follows, and change it to your own.

The file now looks like this:

127.0.0.1 localhost localhost.localdomain localhost4 localhost4. Localdomain4 ::1 localhost localhost.localdomain Localhost6 localhost6. Localdomain6 192.168.153.128 bogonCopy the code

:wq Save the changes and exit

Step3 restart the server software

In this case, restart RabbitMQ

service rabbitmq-server restart
Copy the code

Done! Now it’s fast. Remember to turn off the Linux firewall.