rabbitmq-server 总结

rabbitmq-server总结

【摘要】总结一下最近一段时间使用rabbitmq-server的经验,罗列一些相关的资源网站。

问题1:过程和apt-get install rabbitmq-server 差不多,结果和这个差不多。

root@host:~# apt-get install rabbitmq-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  rabbitmq-server
0 upgraded, 1 newly installed, 0 to remove and 7 not upgraded.
Need to get 0B/560kB of archives.
After this operation, 1,069kB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously deselected package rabbitmq-server.
(Reading database ... 34794 files and directories currently installed.)
Unpacking rabbitmq-server (from .../rabbitmq-server_1.7.2-1ubuntu1_all.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
Setting up rabbitmq-server (1.7.2-1ubuntu1) ...
Starting rabbitmq-server: FAILED - check /var/log/rabbitmq/startup_log, _err
rabbitmq-server.
invoke-rc.d: initscript rabbitmq-server, action "start" failed.
dpkg: error processing rabbitmq-server (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 rabbitmq-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@host:~#

1. Edit /etc/hostname and /etc/hosts so the hostname in /etc/hostname resolves to 127.0.1.1 or 127.0.0.1 in /etc/hosts.
2. Reboot the machine.
3. Remove rabbitmq-server, chef, and chef-server:
sudo apt-get remove rabbitmq-server
4. Remove this rabbitmq file so it gets properly installed next time:
sudo rm -R /var/lib/rabbitmq
5. Re-install :
sudo apt-get remove rabbitmq-server

这个问题是hostname的问题,应该使hostname和hosts里面一致。

这里有个例子Then add that host name to /etc/hosts so it’s possible to resolve it back into an IP address:

127.0.0.1       localhost myhost myhost.local

$ sudo rabbitmqctl status
Status of node rabbit@myhost ...
[{running_applications,[{rabbit,"RabbitMQ","1.7.1"},
                    {mnesia,"MNESIA  CXC 138 12","4.4.12"},
                    {os_mon,"CPO  CXC 138 46","2.2.4"},
                    {sasl,"SASL  CXC 138 11","2.1.8"},
                    {stdlib,"ERTS  CXC 138 10","1.16.4"},
                    {kernel,"ERTS  CXC 138 10","2.13.4"}]},
{nodes,[rabbit@myhost]},
{running_nodes,[rabbit@myhost]}]
...done.


这种适合于DHCP方式。

rabbitmq-server 设置

Setting up RabbitMQ

To use celery we need to create a RabbitMQ user, a virtual host and allow that user access to that virtual host:

$ rabbitmqctl add_user myuser mypassword

$ rabbitmqctl add_vhost myvhost

$ rabbitmqctl set_permissions -p myvhost myuser ".*" ".*" ".*"

Starting/Stopping the RabbitMQ server

To start the server:

$ sudo rabbitmq-server

you can also run it in the background by adding the -detached option (note: only one dash):

$ sudo rabbitmq-server -detached

Never use kill to stop the RabbitMQ server, but rather use the rabbitmqctl command:

$ sudo rabbitmqctl stop

参考:http://ask.github.com/celery/getting-started/broker-installation.html

     http://ask.github.com/celery/getting-started/introduction.html

个人感觉rabbitmq-server很傻在安装前最好测试配置一下 hostname 解析是否正确。

一般我都会写成这样

127.0.0.1 localhost
       :: localhost
127.0.0.1  ubuntu	   
192.168.1.100  ubuntu


 然后测试一下 ping ubuntu

再安装


 

 

 

 

 

你遇到的问题是启动rabbitmq-server时出现了"Failed to start rabbitmq-server.service: Unit not found"的错误。根据你提供的引用,这个错误信息表示系统找不到rabbitmq-server的单元文件。这可能是由于RabbitMQ未正确安装或配置导致的。 为了解决这个问题,你可以尝试以下步骤: 1. 首先,确保你已经正确安装了RabbitMQ。你可以通过在终端中运行"sudo apt-get install rabbitmq-server"(适用于Debian/Ubuntu系统)或者"sudo yum install rabbitmq-server"(适用于CentOS/RHEL系统)来安装RabbitMQ。 2. 如果你已经正确安装了RabbitMQ但仍然遇到这个问题,那么可能是由于单元文件不存在或损坏导致的。你可以尝试通过重新安装RabbitMQ来解决这个问题。可以运行"sudo apt-get purge rabbitmq-server"(适用于Debian/Ubuntu系统)或者"sudo yum remove rabbitmq-server"(适用于CentOS/RHEL系统)来卸载RabbitMQ,然后再重新安装。 3. 如果重新安装仍然无法解决问题,那么可能是由于配置文件中的错误导致的。你可以检查RabbitMQ的配置文件,通常位于"/etc/rabbitmq/rabbitmq.conf"或者"/etc/rabbitmq/rabbitmq.config"。确保配置文件中的路径和选项正确设置。 4. 另外,还可以尝试在启动命令中指定单元文件的路径。你可以尝试使用"./rabbitmq-server -detached"的命令来启动RabbitMQ,并确保在命令中指定了正确的单元文件路径。 总结一下,如果你遇到"Failed to start rabbitmq-server.service: Unit not found"的错误,你可以尝试重新安装RabbitMQ,检查配置文件的正确性,或者指定单元文件的路径来解决这个问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [linux遇到问题](https://blog.csdn.net/nb_forever/article/details/72159796)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [rabbitmq报错Failed to start RabbitMQ broker(更新20220701)](https://blog.csdn.net/avatar_2009/article/details/118524036)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值