RabbitMQ从属性文件加载用户
使用这个问题作为启发,我试图从初始启动时从文件加载rabbitMQconfiguration,因为这将在docker容器中运行。
使用Docker RabbitMQ映像,我从下面的命令开始:
docker run -d -h rabbit-host --name rabbit-queue -v /opt/docker/rabbit/mnesia:/var/lib/rabbitmq/mnesia -v /opt/docker/rabbit/config:/etc/rabbitmq -v /opt/docker/log/rabbit:/var/lib/rabbitmq/log -p 5672:5672 -p 15672:15672 -e RABBITMQ_LOG_BASE=/var/lib/rabbitmq/log rabbitmq:3.5-management
有两个文件位于/ opt / docker / rabbit / config附加到docker窗口。
rabbitmq.config
[ {rabbitmq_management, [ {load_definitions, "/etc/rabbitmq/definitions.json"} ] } ].
definitions.json (从已知的良好configuration的pipe理控制台导出)
{"rabbit_version": "3.5.0", "users": [ { "name": "g", "password_hash": "xxx", "tags": "administrator" }, { "name": "a", "password_hash": "xxx=", "tags": "administrator" }, { "name": "t", "password_hash": "xxx=", "tags": "" }, { "name": "b", "password_hash": "xxx=", "tags": "administrator" }, { "name": "j", "password_hash": "\/xxx\/Wet8=", "tags": "administrator" }, { "name": "g", "password_hash": "xxx+IJRpR3Bh4=", "tags": "administrator" }, { "name": "j", "password_hash": "0Qlvj0o+xxx+xxx=", "tags": "administrator" } ], "vhosts": [ { "name": "\/" } ], "permissions": [ { "user": "guest", "vhost": "\/", "configure": ".*", "write": ".*", "read": ".*" }, { "user": "j", "vhost": "\/", "configure": ".*", "write": ".*", "read": ".*" }, { "user": "a", "vhost": "\/", "configure": ".*", "write": ".*", "read": ".*" }, { "user": "g", "vhost": "\/", "configure": ".*", "write": ".*", "read": ".*" }, { "user": "t", "vhost": "\/", "configure": ".*", "write": ".*", "read": ".*" }, { "user": "j", "vhost": "\/", "configure": ".*", "write": ".*", "read": ".*" }, { "user": "b", "vhost": "\/", "configure": ".*", "write": ".*", "read": ".*" } ], "parameters": [ ], "policies": [ ], "queues": [ { "name": "auditLogQueue", "vhost": "\/", "durable": true, "auto_delete": false, "arguments": { } }, { "name": "auditlog.gw.local", "vhost": "\/", "durable": true, "auto_delete": false, "arguments": { } } ], "exchanges": [ { "name": "spring-boot-exchange", "vhost": "\/", "type": "topic", "durable": true, "auto_delete": false, "internal": false, "arguments": { } } ], "bindings": [ ] }
以下是我在启动时看到的内容:
RabbitMQ 3.5.0. Copyright (C) 2007-2014 GoPivotal, Inc. ## ## Licensed under the MPL. See http://www.rabbitmq.com/ ## ## ########## Logs: tty ###### ## /var/lib/rabbitmq/log/rabbit@rabbit-host-sasl.log ########## Starting broker... =INFO REPORT==== 15-Apr-2015::22:01:52 === Starting RabbitMQ 3.5.0 on Erlang 17.4 Copyright (C) 2007-2014 GoPivotal, Inc. Licensed under the MPL. See http://www.rabbitmq.com/ =INFO REPORT==== 15-Apr-2015::22:01:52 === node : rabbit@rabbit-host home dir : /var/lib/rabbitmq config file(s) : /etc/rabbitmq/rabbitmq.config cookie hash : jbD/nyBuT4vYLbfKO4tc3g== log : tty sasl log : /var/lib/rabbitmq/log/rabbit@rabbit-host-sasl.log database dir : /var/lib/rabbitmq/mnesia/rabbit@rabbit-host =INFO REPORT==== 15-Apr-2015::22:01:54 === Limiting to approx 524188 file handles (471767 sockets) =INFO REPORT==== 15-Apr-2015::22:01:54 === application: mnesia exited: stopped type: temporary =INFO REPORT==== 15-Apr-2015::22:01:54 === Priority queues enabled, real BQ is rabbit_variable_queue =INFO REPORT==== 15-Apr-2015::22:01:55 === Memory limit set to 3191MB of 7978MB total. =INFO REPORT==== 15-Apr-2015::22:01:57 === Disk free limit set to 50MB =INFO REPORT==== 15-Apr-2015::22:01:58 === Adding vhost '/' =INFO REPORT==== 15-Apr-2015::22:01:58 === Creating user 'guest' =INFO REPORT==== 15-Apr-2015::22:01:58 === Setting user tags for user 'guest' to [administrator] =INFO REPORT==== 15-Apr-2015::22:01:58 === Setting permissions for 'guest' in '/' to '.*', '.*', '.*' =INFO REPORT==== 15-Apr-2015::22:01:58 === msg_store_transient: using rabbit_msg_store_ets_index to provide index =INFO REPORT==== 15-Apr-2015::22:01:58 === msg_store_persistent: using rabbit_msg_store_ets_index to provide index =WARNING REPORT==== 15-Apr-2015::22:01:58 === msg_store_persistent: rebuilding indices from scratch =INFO REPORT==== 15-Apr-2015::22:01:58 === started TCP Listener on [::]:5672 completed with 0 plugins. =INFO REPORT==== 15-Apr-2015::22:01:58 === Server startup complete; 0 plugins started.
最起码,Rabbit试图读取rabbit.config,因为如果不是,它会抛出一个错误。 但是,兔子并没有拿起definitions.json,而是继续创build标准的“guest”用户。 有什么问题是什么build议? 或者,在启动时加载用户和队列名称的替代方法?
- Docker覆盖vip平衡的策略是什么?
- java.lang.RuntimeException:没有检测到主类
- 在Docker上安装CKAN时没有指定CKAN_SQLALCHEMY_URL
- 如何在Docker Cloud上设置RabbitMQ集群?
- 如何将设备添加到所有docker集装箱
- 在rkt容器中执行命令,输出结果,然后退出
- quay.io/etcd找不到容器命令
- configurationfluentd以正确parsing并将使用docker json-file日志logging驱动程序格式化的java stacktrace转换为弹性的单个消息
- 如何更改sbt-docker设置以select工件的特定路线