Skip to content

rabbit create queue #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wubin19896817 opened this issue Oct 21, 2016 · 6 comments
Closed

rabbit create queue #117

wubin19896817 opened this issue Oct 21, 2016 · 6 comments

Comments

@wubin19896817
Copy link

hello,how I can create the queue if the rabbitmq don't have?

@jonapich
Copy link

Use the management plugin (please google around) to create them dynamically, or you can also provide a definition file if you have a static setup.

All of this information should be very easy to find on the rabbitmq official site. I suggest you start with the "hello world" tutorial.

For any further questions about how to use the software, you should rather use sites like stackoverflow.com

@ebuildy
Copy link

ebuildy commented Nov 7, 2016

Hello @jonapich , I searched for definition file, didn't find.

Do you have an example or a link about it?

Thanks you,

@jonapich
Copy link

jonapich commented Nov 7, 2016

I would guess that's the same file that can be exported through the management plugin (look for export/import buttons at the bottom). I might be wrong though, I never had to use it.

@ebuildy
Copy link

ebuildy commented Nov 8, 2016

Ha got it:

1- Create definitions.json (you can export it from management web UI) or:

{
  "rabbit_version": "3.6.5",
  "users": [
    {
      "name": "guest",
      "password_hash": "o2MJjT8UKSRM7eoLDMWvm4LxqaFvDxd2wLg1KQQQ2jXfG5UE",
      "hashing_algorithm": "rabbit_password_hashing_sha256",
      "tags": "administrator"
    }
  ],
  "vhosts": [
    {
      "name": "/"
    }
  ],
  "permissions": [
    {
      "user": "guest",
      "vhost": "/",
      "configure": ".*",
      "write": ".*",
      "read": ".*"
    }
  ],
  "parameters": [],
  "policies": [],
  "queues": [
    {
      "name": "events-v1",
      "vhost": "/",
      "durable": true,
      "auto_delete": false,
      "arguments": {
        "x-ha-policy": "all"
      }
    }
  ],
  "exchanges": [],
  "bindings": [
    {
      "source": "amq.direct",
      "vhost": "/",
      "destination": "events-v1",
      "destination_type": "queue",
      "routing_key": "logstash",
      "arguments": {}
    },
    {
      "source": "amq.direct",
      "vhost": "/",
      "destination": "events-v1",
      "destination_type": "queue",
      "routing_key": "v1",
      "arguments": {}
    }
  ]
}

2- Set filepath in rabbitmq.config:

[
    {rabbit, [
        {loopback_users, []},
        {vm_memory_high_watermark, 0.7},
        {vm_memory_high_watermark_paging_ratio, 0.8},
        {log_levels, [{channel, warning}, {connection, warning}, {federation, warning}, {mirroring, info}]},
        {heartbeat, 10}
    ]},
    {rabbitmq_management, [
        {load_definitions, "/opt/definitions.json"}
    ]}
].

3- Mount files as volume:

  rabbitmq:
    image: rabbitmq:3.6.5-management
    volumes:
      - rabbitmq:/var/lib/rabbitmq:rw
      - ./images/datahub_rabbitmq/definitions.json:/opt/definitions.json:ro
      - ./images/datahub_rabbitmq/rabbitmq.config:/etc/rabbitmq/rabbitmq.config:ro

@capsulated
Copy link

When I try to $docker-compose up I see that:

rabbitmq_1 | /usr/local/bin/docker-entrypoint.sh: line 262: /etc/rabbitmq/rabbitmq.config: Read-only file system

All config is the same. What I do wrong?

@tianon
Copy link
Member

tianon commented Apr 20, 2018

@sylogex that usually means you've also supplied environment variables to the rabbitmq image which are requesting that we update the configuration (which is bind-mounted as read-only, so that can't work)

However, as of #112, the images will auto-detect and load /etc/rabbitmq/definitons.json, so you should be able to simply place your definitons.json file there and have the management image load them appropriately with no additional configuration or changes. 👍

@tianon tianon closed this as completed Apr 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants