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
再安装