有的时候,服务器资源有线,如果有两个软件,比如CDH和rabbitmq同时要部署在一台机器上,那么hostname要以谁为准呢?最好是解决好主机名耦合的问题,看看是否可以指定rabbitmq的主机名。
经过资料查找,发现修改rabbitmq/etc/rabbitmq-env.conf里面有个参数可以指定hosts,操作过程
http://ojv12llai.bkt.clouddn.com/uploads/20170314095443.mp4
但是,这样在最后会有一个问题,就是clusterName这个地方还是跟 rabbitmq cluster master的主机名有关系。做个问题放在这里。
[machtalk@i-jxa3hrz8 rabbitmq]$ rabbitmqctl cluster_status
Cluster status of node rabbit@rabbit2 ...
[{nodes,[{disc,[rabbit@rabbit1,rabbit@rabbit2]}]},
{running_nodes,[rabbit@rabbit1,rabbit@rabbit2]},
{cluster_name,<<"rabbit@i-7pn7heee">>},
{partitions,[]},
{alarms,[{rabbit@rabbit1,[]},{rabbit@rabbit2,[]}]}]
[machtalk@i-jxa3hrz8 rabbitmq]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# hostname loopback address
127.0.1.1 i-jxa3hrz8
172.25.0.3 rabbit1
172.25.0.4 rabbit2
[machtalk@i-jxa3hrz8 rabbitmq]$