启动
docker-compose up -d
页面登录 http://ip:15672
username:admin
password:admin123
原文链接:https://codeburst.io/get-started-with-rabbitmq-on-docker-4428d7f6e46b
目录结构
.
├── docker-compose.yml
├── rabbitmq
│ ├── etc
│ │ ├── definitions.json
│ │ └── rabbitmq.conf
│ └── logs
└── readme.md
docker-compose.yml 详情
version: '3.8'
services:
rabbitmq:
image: rabbitmq:3-management
hostname: my-rabbit
volumes:
- ./rabbitmq/etc/definitions.json:/etc/rabbitmq/definitions.json
- ./rabbitmq/etc/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf
- ./rabbitmq/data:/var/lib/rabbitmq/mnesia/rabbit@my-rabbit
- ./rabbitmq/logs:/var/log/rabbitmq/log
ports:
- 5672:5672
- 15672:15672
rabbitmq.conf 详情
loopback_users.guest = false
listeners.tcp.default = 5672
management.listener.port = 15672
management.listener.ssl = false
management.load_definitions = /etc/rabbitmq/definitions.json
definitions.json 详情
{
"rabbit_version": "3.8.3",
"rabbitmq_version": "3.8.3",
"users": [
{
"name": "ops1",
"password_hash": "sOD2Ib17c/ZW9PiMDKZXvoHlBcWirR0lF/+vTOTOy/t7QSuL",
"hashing_algorithm": "rabbit_password_hashing_sha256",
"tags": ""
},
{
"name": "admin",
"password_hash": "ZdETL0pgo3iUOn/shv9QhBl3T98wMsLu2/5GfIL2fjbpPgMM",
"hashing_algorithm": "rabbit_password_hashing_sha256",
"tags": "administrator"
},
{
"name": "ops0",
"password_hash": "xynNraNzjBRvH9LkLRtnvHZW91dRw3EbDUMdxAVkxj9wSBEC",
"hashing_algorithm": "rabbit_password_hashing_sha256",
"tags": ""
}
],
"vhosts": [{ "name": "/" }],
"permissions": [
{
"user": "ops0",
"vhost": "/",
"configure": "",
"write": "ordering*",
"read": ".*"
},
{
"user": "ops1",
"vhost": "/",
"configure": "",
"write": "",
"read": "ordering.emailworker"
},
{
"user": "admin",
"vhost": "/",
"configure": ".*",
"write": ".*",
"read": ".*"
}
],
"topic_permissions": [
{
"user": "admin",
"vhost": "/",
"exchange": "",
"write": ".*",
"read": ".*"
},
{
"user": "ops0",
"vhost": "/",
"exchange": "ordering",
"write": ".*",
"read": ".*"
},
{
"user": "ops1",
"vhost": "/",
"exchange": "ordering",
"write": "order.*",
"read": "order.*"
}
],
"parameters": [],
"global_parameters": [
{ "name": "cluster_name", "value": "rabbit@my-rabbit" },
{
"name": "internal_cluster_id",
"value": "rabbitmq-cluster-id-fBlXlF8ZzdFhhNCMG7vY-A"
}
],
"policies": [],
"queues": [
{
"name": "ordering.auditqueue",
"vhost": "/",
"durable": true,
"auto_delete": false,
"arguments": { "x-queue-type": "classic" }
},
{
"name": "ordering.emailworker",
"vhost": "/",
"durable": true,
"auto_delete": false,
"arguments": { "x-queue-type": "classic" }
}
],
"exchanges": [
{
"name": "ordering",
"vhost": "/",
"type": "topic",
"durable": true,
"auto_delete": false,
"internal": false,
"arguments": {}
}
],
"bindings": [
{
"source": "ordering",
"vhost": "/",
"destination": "ordering.auditqueue",
"destination_type": "queue",
"routing_key": "order.#",
"arguments": {}
},
{
"source": "ordering",
"vhost": "/",
"destination": "ordering.emailworker",
"destination_type": "queue",
"routing_key": "order.created",
"arguments": {}
}
]
}
网友评论