Delete all the queues from RabbitMQ?












164















I installed rabbitmqadmin and was able to list all the exchanges and queues. How can I use rabbitmqadmin or rabbitmqctl to delete all the queues.










share|improve this question





























    164















    I installed rabbitmqadmin and was able to list all the exchanges and queues. How can I use rabbitmqadmin or rabbitmqctl to delete all the queues.










    share|improve this question



























      164












      164








      164


      52






      I installed rabbitmqadmin and was able to list all the exchanges and queues. How can I use rabbitmqadmin or rabbitmqctl to delete all the queues.










      share|improve this question
















      I installed rabbitmqadmin and was able to list all the exchanges and queues. How can I use rabbitmqadmin or rabbitmqctl to delete all the queues.







      rabbitmq rabbitmqctl






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 8 '17 at 10:20









      wonea

      2,3021463118




      2,3021463118










      asked Jul 12 '12 at 19:59









      CoryCory

      4,544174464




      4,544174464
























          20 Answers
          20






          active

          oldest

          votes


















          247














          First, list your queues:



          rabbitmqadmin list queues name



          Then from the list, you'll need to manually delete them one by one:



          rabbitmqadmin delete queue name='queuename'



          Because of the output format, doesn't appear you can grep the response from list queues. Alternatively, if you're just looking for a way to clear everything (read: reset all settings, returning the installation to a default state), use:



          rabbitmqctl stop_app
          rabbitmqctl reset # Be sure you really want to do this!
          rabbitmqctl start_app





          share|improve this answer





















          • 4





            to see all pending tasks in rabbitmq: rabbitmqctl list_queues name messages messages_ready messages_unacknowledged

            – Guillaume Vincent
            Oct 19 '13 at 13:32











          • Be aware that "rabbitmqctl reset" will reset everything back to the "factory settings". Any RabbitMQ users, virtual hosts, etc, that you have created will be blown away.

            – thoufek
            Mar 14 '14 at 19:38













          • Apologies @smartnut007, I've clarified the second portion of the answer with a disclaimer.

            – lukiffer
            May 22 '14 at 18:59






          • 23





            just grabbing the empty queues. rabbitmqctl list_queues | grep 0 | awk '{print $1}' | xargs -I qn rabbitmqadmin delete queue name=qn

            – au_stan
            Jun 24 '14 at 19:09






          • 3





            @au_stan That will delete all queues with a 0 in the name or the count. Might want to do grep $'t0' or something.

            – woot
            Sep 14 '15 at 4:07





















          42














          With rabbitmqadmin you can remove them with this one-liner:



          rabbitmqadmin -f tsv -q list queues name | while read queue; do rabbitmqadmin -q delete queue name=${queue}; done





          share|improve this answer



















          • 1





            Doesn't work. Gives me a bunch of *** Not found: /api/queues/%2F/foo%0D errors.

            – Der Hochstapler
            Nov 28 '17 at 12:55











          • In my case queues are prefixed with keyword by which I can simply use egrep, so my command will look like this: rabbitmqadmin -f tsv -q list queues name | egrep "%search word%" | while read queue; do rabbitmqadmin -q delete queue name=${queue}; done

            – Logans
            Oct 11 '18 at 10:51





















          19














          Try this:



           rabbitmqadmin list queues name | awk '{print $2}' | xargs -I qn rabbitmqadmin delete queue name=qn





          share|improve this answer





















          • 1





            This worked for me, but also showed *** Not found: /api/queues/%2F/name because the output is a ASCII table with a "name" column. I tweaked the command to be rabbitmqadmin list queues name | awk '!/--|name/ {print $2}' | xargs -I qn rabbitmqadmin delete queue name=qn to fix it.

            – Mark Edington
            Jun 5 '17 at 13:52











          • rabbitmqadmin list queues name | awk {'print$2'} | egrep [^name] | xargs -I qname rabbitmqadmin delete queue name=qname

            – phatpenguin
            Sep 5 '18 at 16:10





















          7














          Actually super easy with management plugin and policies:




          • Goto Management Console (localhost:15672)


          • Goto Admin tab


          • Goto Policies tab(on the right side)


          • Add Policy



          • Fill Fields





            • Virtual Host: Select


            • Name: Expire All Policies(Delete Later)


            • Pattern: .*


            • Apply to: Queues


            • Definition: expires with value 1 (change type from String to Number)



          • Save


          • Checkout Queues tab again

          • All Queues must be deleted


          • And don't forget remove policy!!!!!!.






          share|improve this answer





















          • 1





            select "Number" at Definition. Does not work with default ("String")

            – Mathias
            Nov 12 '18 at 7:07











          • Great answer, actually made up my day. If you select "Exchanges and Queues" from the list, you could easily delete both Queues and Exchanges. I wish this could be the accepted answer.

            – Wiktor Zychla
            Dec 5 '18 at 11:20



















          6














          I made a deleteRabbitMqQs.sh, which accepts arguments to search the list of queues for, selecting only ones matching the pattern you want. If you offer no arguments, it will delete them all! It shows you the list of queues its about to delete, letting you quit before doing anything destructive.



          for word in "$@"
          do
          args=true
          newQueues=$(rabbitmqctl list_queues name | grep "$word")
          queues="$queues
          $newQueues"
          done
          if [ $# -eq 0 ]; then
          queues=$(rabbitmqctl list_queues name | grep -v "...")
          fi

          queues=$(echo "$queues" | sed '/^[[:space:]]*$/d')

          if [ "x$queues" == "x" ]; then
          echo "No queues to delete, giving up."
          exit 0
          fi

          read -p "Deleting the following queues:
          ${queues}
          [CTRL+C quit | ENTER proceed]
          "

          while read -r line; do
          rabbitmqadmin delete queue name="$line"
          done <<< "$queues"


          If you want different matching against the arguments you pass in, you can alter the grep in line four. When deleting all queues, it won't delete ones with three consecutive spaces in them, because I figured that eventuality would be rarer than people who have rabbitmqctl printing its output out in different languages.



          Enjoy!






          share|improve this answer

































            6














            If you're trying to delete queues because they're unused and you don't want to reset, one option is to set the queue TTL very low via a policy, wait for the queues to be auto-deleted once the TTL is passed and then remove the policy (https://www.rabbitmq.com/ttl.html).



            rabbitmqctl.bat set_policy delq ".*" '{"expires": 1}' --apply-to queues


            To remove the policy



            rabbitmqctl clear_policy delq


            Note that this only works for unused queues



            Original info here: http://rabbitmq.1065348.n5.nabble.com/Deleting-all-queues-in-rabbitmq-td30933.html






            share|improve this answer































              6














              If you don't have rabbitmqadmin installed, try to purge queues with rabbitmqctl:




              rabbitmqctl list_queues | awk '{ print $1 }' | xargs -L1 rabbitmqctl purge_queue






              share|improve this answer
























              • There is no delete_queue nor purge_queue commands in rabbitmqctl. I would like to purge a lot of queues that seem to be automatically generated and I would not like to install extra software like rabbitmqadmin...

                – Rolice
                Jan 9 '18 at 9:09













              • rabbitmqctl purge_queue worked here manually. I only needed to add -p <virtual-host>

                – Roman Susi
                Feb 1 '18 at 8:38



















              5














              Here is a way to do it with PowerShell. the URL may need to be updated



              $cred = Get-Credential
              iwr -ContentType 'application/json' -Method Get -Credential $cred 'http://localhost:15672/api/queues' | % {
              ConvertFrom-Json $_.Content } | % { $_ } | ? { $_.messages -gt 0} | % {
              iwr -method DELETE -Credential $cred -uri $("http://localhost:15672/api/queues/{0}/{1}" -f [System.Web.HttpUtility]::UrlEncode($_.vhost), $_.name)
              }





              share|improve this answer
























              • Note, this only deletes non-empty queues. Remove the -gt clause to delete all queues

                – Peter Goodman
                Mar 17 '15 at 1:27



















              3














              You can use rabbitmqctl eval as below:



              rabbitmqctl eval 'IfUnused = false, IfEmpty = true, MatchRegex = 
              <<"^prefix-">>, [rabbit_amqqueue:delete(Q, IfUnused, IfEmpty) || Q <-
              rabbit_amqqueue:list(), re:run(element(4, element(2, Q)), MatchRegex)
              =/= nomatch ].'


              The above will delete all empty queues in all vhosts that have a name
              beginning with "prefix-".
              You can edit the variables IfUnused, IfEmpty,
              and MatchRegex as per your requirement.






              share|improve this answer
























              • Perfect for when rabbitmqadmin is not accessible.

                – NuSkooler
                Aug 24 '16 at 19:59



















              3














              Removing all queues using rabbitmqctl one liner



              rabbitmqctl list_queues | awk '{ print $1 }' | sed 's/Listing//' | xargs -L1 rabbitmqctl purge_queue





              share|improve this answer































                2














                In case you only want to purge the queues which are not empty (a lot faster):



                rabbitmqctl list_queues | awk '$2!=0 { print $1 }' | sed 's/Listing//' | xargs -L1 rabbitmqctl purge_queue


                For me, it takes 2-3 seconds to purge a queue (both empty and non-empty ones), so iterating through 50 queues is such a pain while I just need to purge 10 of them (40/50 are empty).






                share|improve this answer



















                • 1





                  the command works perfectly - thank you very much

                  – Viorel Florian
                  Oct 21 '18 at 8:20



















                2














                To list queues,



                ./rabbitmqadmin -f tsv -q list queues


                To delete a queue,



                ./rabbitmqadmin delete queue name=name_of_queue





                share|improve this answer

































                  1














                  Here is a faster version (using parallel install sudo apt-get install parallel) expanding on the excellent answer by @admenva




                  parallel -j 50 rabbitmqadmin -H YOUR_HOST_OR_LOCALHOST -q delete queue name={} ::: $(rabbitmqadmin -H YOUR_HOST_OR_LOCALHOST -f tsv -q list queues name)






                  share|improve this answer































                    1














                    This commands deletes all your queues



                    python rabbitmqadmin.py 
                    -H YOURHOST -u guest -p guest -f bash list queues |
                    xargs -n1 |
                    xargs -I{}
                    python rabbitmqadmin.py -H YOURHOST -u guest -p guest delete queue name={}


                    This script is super simple because it uses -f bash, which outputs the queues as a list.



                    Then we use xargs -n1 to split that up into multiple variables



                    Then we use xargs -I{} that will run the command following, and replace {} in the command.






                    share|improve this answer
























                    • I've tried like 10 different answers, and this is the ONLY thing that has actually worked to delete queues without killing all my other settings. Thanks! I can't believe rabbitmqctl doesn't just have a "drop all queues" command.

                      – sudo
                      Aug 1 '16 at 19:52













                    • BTW, to get rabbitmqadmin, you need to go to http://yourhost:15672/cli/ and download it.

                      – sudo
                      Aug 1 '16 at 19:54



















                    1














                    You need not reset rabbitmq server to delete non-durable queues. Simply stop the server and start again and it will remove all the non-durable queues available.






                    share|improve this answer


























                    • including durable queues? I don't think so. I'll qualify your answer.

                      – Hendy Irawan
                      Nov 26 '15 at 8:38











                    • No, durable queues cannot be deleted by stopping the server. They can be deleted from RabbitMQ Management web interface under queues.

                      – ErAcube
                      Nov 26 '15 at 9:48











                    • Actually yes, this helped me and all about 4500 automatically generated queues are gone. It seems that these were non-durable ones. Thanks!

                      – Rolice
                      Jan 9 '18 at 9:12





















                    0














                    There's a way to remove all queues and exchanges without scripts and full reset. You can just delete and re-create a virtual host from admin interface. This will work even for vhost /.



                    The only thing you'll need to restore is permissions for the newly created vhost.






                    share|improve this answer































                      0














                      Okay, important qualifier for this answer:
                      The question does ask to use either rabbitmqctl OR rabbitmqadmin to solve this, my answer needed to use both. Also, note that this was tested on MacOS 10.12.6 and the versions of the rabbitmqctl and rabbitmqadmin that are installed when installing rabbitmq with Homebrew and which is identified with brew list --versions as rabbitmq 3.7.0



                      rabbitmqctl list_queues -p <VIRTUAL_HOSTNAME> name | sed 1,2d | xargs -I qname rabbitmqadmin --vhost <VIRTUAL_HOSTNAME> delete queue name=qname






                      share|improve this answer































                        0














                        I tried rabbitmqctl and reset commands but they are very slow.



                        This is the fastest way I found (replace your username and password):



                        #!/bin/bash

                        # Stop on error
                        set -eo pipefail

                        USER='guest'
                        PASSWORD='guest'

                        curl -sSL -u $USER:$PASSWORD http://localhost:15672/api/queues/%2f/ | jq '..name' | sed 's/"//g' | xargs -L 1 -I@ curl -XDELETE -sSL -u $USER:$PASSWORD http://localhost:15672/api/queues/%2f/@
                        # To also delete exchanges uncomment next line
                        # curl -sSL -u $USER:$PASSWORD http://localhost:15672/api/exchanges/%2f/ | jq '..name' | sed 's/"//g' | xargs -L 1 -I@ curl -XDELETE -sSL -u $USER:$PASSWORD http://localhost:15672/api/exchanges/%2f/@


                        Note: This only works with the default vhost /






                        share|improve this answer































                          0














                          Another option is to delete the vhost associated with the queues. This will delete everything associated with the vhost, so be warned, but it is easy and fast.





                          NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.






                          share|improve this answer































                            -1














                            rabbitmqadmin list queues|awk 'NR>3{print $4}'|head -n-1|xargs -I qname rabbitmqadmin delete queue name=qname





                            share|improve this answer



















                            • 1





                              I receive this when running it: head: illegal line count -- -1

                              – Robert Ross
                              Feb 25 '14 at 17:20













                            • The "head -n-1" should be either "head -1" or "head -n 1"

                              – Gerd Busker
                              Jun 30 '14 at 11:14











                            Your Answer






                            StackExchange.ifUsing("editor", function () {
                            StackExchange.using("externalEditor", function () {
                            StackExchange.using("snippets", function () {
                            StackExchange.snippets.init();
                            });
                            });
                            }, "code-snippets");

                            StackExchange.ready(function() {
                            var channelOptions = {
                            tags: "".split(" "),
                            id: "1"
                            };
                            initTagRenderer("".split(" "), "".split(" "), channelOptions);

                            StackExchange.using("externalEditor", function() {
                            // Have to fire editor after snippets, if snippets enabled
                            if (StackExchange.settings.snippets.snippetsEnabled) {
                            StackExchange.using("snippets", function() {
                            createEditor();
                            });
                            }
                            else {
                            createEditor();
                            }
                            });

                            function createEditor() {
                            StackExchange.prepareEditor({
                            heartbeatType: 'answer',
                            autoActivateHeartbeat: false,
                            convertImagesToLinks: true,
                            noModals: true,
                            showLowRepImageUploadWarning: true,
                            reputationToPostImages: 10,
                            bindNavPrevention: true,
                            postfix: "",
                            imageUploader: {
                            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                            allowUrls: true
                            },
                            onDemand: true,
                            discardSelector: ".discard-answer"
                            ,immediatelyShowMarkdownHelp:true
                            });


                            }
                            });














                            draft saved

                            draft discarded


















                            StackExchange.ready(
                            function () {
                            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f11459676%2fdelete-all-the-queues-from-rabbitmq%23new-answer', 'question_page');
                            }
                            );

                            Post as a guest















                            Required, but never shown

























                            20 Answers
                            20






                            active

                            oldest

                            votes








                            20 Answers
                            20






                            active

                            oldest

                            votes









                            active

                            oldest

                            votes






                            active

                            oldest

                            votes









                            247














                            First, list your queues:



                            rabbitmqadmin list queues name



                            Then from the list, you'll need to manually delete them one by one:



                            rabbitmqadmin delete queue name='queuename'



                            Because of the output format, doesn't appear you can grep the response from list queues. Alternatively, if you're just looking for a way to clear everything (read: reset all settings, returning the installation to a default state), use:



                            rabbitmqctl stop_app
                            rabbitmqctl reset # Be sure you really want to do this!
                            rabbitmqctl start_app





                            share|improve this answer





















                            • 4





                              to see all pending tasks in rabbitmq: rabbitmqctl list_queues name messages messages_ready messages_unacknowledged

                              – Guillaume Vincent
                              Oct 19 '13 at 13:32











                            • Be aware that "rabbitmqctl reset" will reset everything back to the "factory settings". Any RabbitMQ users, virtual hosts, etc, that you have created will be blown away.

                              – thoufek
                              Mar 14 '14 at 19:38













                            • Apologies @smartnut007, I've clarified the second portion of the answer with a disclaimer.

                              – lukiffer
                              May 22 '14 at 18:59






                            • 23





                              just grabbing the empty queues. rabbitmqctl list_queues | grep 0 | awk '{print $1}' | xargs -I qn rabbitmqadmin delete queue name=qn

                              – au_stan
                              Jun 24 '14 at 19:09






                            • 3





                              @au_stan That will delete all queues with a 0 in the name or the count. Might want to do grep $'t0' or something.

                              – woot
                              Sep 14 '15 at 4:07


















                            247














                            First, list your queues:



                            rabbitmqadmin list queues name



                            Then from the list, you'll need to manually delete them one by one:



                            rabbitmqadmin delete queue name='queuename'



                            Because of the output format, doesn't appear you can grep the response from list queues. Alternatively, if you're just looking for a way to clear everything (read: reset all settings, returning the installation to a default state), use:



                            rabbitmqctl stop_app
                            rabbitmqctl reset # Be sure you really want to do this!
                            rabbitmqctl start_app





                            share|improve this answer





















                            • 4





                              to see all pending tasks in rabbitmq: rabbitmqctl list_queues name messages messages_ready messages_unacknowledged

                              – Guillaume Vincent
                              Oct 19 '13 at 13:32











                            • Be aware that "rabbitmqctl reset" will reset everything back to the "factory settings". Any RabbitMQ users, virtual hosts, etc, that you have created will be blown away.

                              – thoufek
                              Mar 14 '14 at 19:38













                            • Apologies @smartnut007, I've clarified the second portion of the answer with a disclaimer.

                              – lukiffer
                              May 22 '14 at 18:59






                            • 23





                              just grabbing the empty queues. rabbitmqctl list_queues | grep 0 | awk '{print $1}' | xargs -I qn rabbitmqadmin delete queue name=qn

                              – au_stan
                              Jun 24 '14 at 19:09






                            • 3





                              @au_stan That will delete all queues with a 0 in the name or the count. Might want to do grep $'t0' or something.

                              – woot
                              Sep 14 '15 at 4:07
















                            247












                            247








                            247







                            First, list your queues:



                            rabbitmqadmin list queues name



                            Then from the list, you'll need to manually delete them one by one:



                            rabbitmqadmin delete queue name='queuename'



                            Because of the output format, doesn't appear you can grep the response from list queues. Alternatively, if you're just looking for a way to clear everything (read: reset all settings, returning the installation to a default state), use:



                            rabbitmqctl stop_app
                            rabbitmqctl reset # Be sure you really want to do this!
                            rabbitmqctl start_app





                            share|improve this answer















                            First, list your queues:



                            rabbitmqadmin list queues name



                            Then from the list, you'll need to manually delete them one by one:



                            rabbitmqadmin delete queue name='queuename'



                            Because of the output format, doesn't appear you can grep the response from list queues. Alternatively, if you're just looking for a way to clear everything (read: reset all settings, returning the installation to a default state), use:



                            rabbitmqctl stop_app
                            rabbitmqctl reset # Be sure you really want to do this!
                            rabbitmqctl start_app






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Sep 4 '15 at 17:27









                            woot

                            5,91422745




                            5,91422745










                            answered Jul 12 '12 at 20:19









                            lukifferlukiffer

                            8,64153364




                            8,64153364








                            • 4





                              to see all pending tasks in rabbitmq: rabbitmqctl list_queues name messages messages_ready messages_unacknowledged

                              – Guillaume Vincent
                              Oct 19 '13 at 13:32











                            • Be aware that "rabbitmqctl reset" will reset everything back to the "factory settings". Any RabbitMQ users, virtual hosts, etc, that you have created will be blown away.

                              – thoufek
                              Mar 14 '14 at 19:38













                            • Apologies @smartnut007, I've clarified the second portion of the answer with a disclaimer.

                              – lukiffer
                              May 22 '14 at 18:59






                            • 23





                              just grabbing the empty queues. rabbitmqctl list_queues | grep 0 | awk '{print $1}' | xargs -I qn rabbitmqadmin delete queue name=qn

                              – au_stan
                              Jun 24 '14 at 19:09






                            • 3





                              @au_stan That will delete all queues with a 0 in the name or the count. Might want to do grep $'t0' or something.

                              – woot
                              Sep 14 '15 at 4:07
















                            • 4





                              to see all pending tasks in rabbitmq: rabbitmqctl list_queues name messages messages_ready messages_unacknowledged

                              – Guillaume Vincent
                              Oct 19 '13 at 13:32











                            • Be aware that "rabbitmqctl reset" will reset everything back to the "factory settings". Any RabbitMQ users, virtual hosts, etc, that you have created will be blown away.

                              – thoufek
                              Mar 14 '14 at 19:38













                            • Apologies @smartnut007, I've clarified the second portion of the answer with a disclaimer.

                              – lukiffer
                              May 22 '14 at 18:59






                            • 23





                              just grabbing the empty queues. rabbitmqctl list_queues | grep 0 | awk '{print $1}' | xargs -I qn rabbitmqadmin delete queue name=qn

                              – au_stan
                              Jun 24 '14 at 19:09






                            • 3





                              @au_stan That will delete all queues with a 0 in the name or the count. Might want to do grep $'t0' or something.

                              – woot
                              Sep 14 '15 at 4:07










                            4




                            4





                            to see all pending tasks in rabbitmq: rabbitmqctl list_queues name messages messages_ready messages_unacknowledged

                            – Guillaume Vincent
                            Oct 19 '13 at 13:32





                            to see all pending tasks in rabbitmq: rabbitmqctl list_queues name messages messages_ready messages_unacknowledged

                            – Guillaume Vincent
                            Oct 19 '13 at 13:32













                            Be aware that "rabbitmqctl reset" will reset everything back to the "factory settings". Any RabbitMQ users, virtual hosts, etc, that you have created will be blown away.

                            – thoufek
                            Mar 14 '14 at 19:38







                            Be aware that "rabbitmqctl reset" will reset everything back to the "factory settings". Any RabbitMQ users, virtual hosts, etc, that you have created will be blown away.

                            – thoufek
                            Mar 14 '14 at 19:38















                            Apologies @smartnut007, I've clarified the second portion of the answer with a disclaimer.

                            – lukiffer
                            May 22 '14 at 18:59





                            Apologies @smartnut007, I've clarified the second portion of the answer with a disclaimer.

                            – lukiffer
                            May 22 '14 at 18:59




                            23




                            23





                            just grabbing the empty queues. rabbitmqctl list_queues | grep 0 | awk '{print $1}' | xargs -I qn rabbitmqadmin delete queue name=qn

                            – au_stan
                            Jun 24 '14 at 19:09





                            just grabbing the empty queues. rabbitmqctl list_queues | grep 0 | awk '{print $1}' | xargs -I qn rabbitmqadmin delete queue name=qn

                            – au_stan
                            Jun 24 '14 at 19:09




                            3




                            3





                            @au_stan That will delete all queues with a 0 in the name or the count. Might want to do grep $'t0' or something.

                            – woot
                            Sep 14 '15 at 4:07







                            @au_stan That will delete all queues with a 0 in the name or the count. Might want to do grep $'t0' or something.

                            – woot
                            Sep 14 '15 at 4:07















                            42














                            With rabbitmqadmin you can remove them with this one-liner:



                            rabbitmqadmin -f tsv -q list queues name | while read queue; do rabbitmqadmin -q delete queue name=${queue}; done





                            share|improve this answer



















                            • 1





                              Doesn't work. Gives me a bunch of *** Not found: /api/queues/%2F/foo%0D errors.

                              – Der Hochstapler
                              Nov 28 '17 at 12:55











                            • In my case queues are prefixed with keyword by which I can simply use egrep, so my command will look like this: rabbitmqadmin -f tsv -q list queues name | egrep "%search word%" | while read queue; do rabbitmqadmin -q delete queue name=${queue}; done

                              – Logans
                              Oct 11 '18 at 10:51


















                            42














                            With rabbitmqadmin you can remove them with this one-liner:



                            rabbitmqadmin -f tsv -q list queues name | while read queue; do rabbitmqadmin -q delete queue name=${queue}; done





                            share|improve this answer



















                            • 1





                              Doesn't work. Gives me a bunch of *** Not found: /api/queues/%2F/foo%0D errors.

                              – Der Hochstapler
                              Nov 28 '17 at 12:55











                            • In my case queues are prefixed with keyword by which I can simply use egrep, so my command will look like this: rabbitmqadmin -f tsv -q list queues name | egrep "%search word%" | while read queue; do rabbitmqadmin -q delete queue name=${queue}; done

                              – Logans
                              Oct 11 '18 at 10:51
















                            42












                            42








                            42







                            With rabbitmqadmin you can remove them with this one-liner:



                            rabbitmqadmin -f tsv -q list queues name | while read queue; do rabbitmqadmin -q delete queue name=${queue}; done





                            share|improve this answer













                            With rabbitmqadmin you can remove them with this one-liner:



                            rabbitmqadmin -f tsv -q list queues name | while read queue; do rabbitmqadmin -q delete queue name=${queue}; done






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Oct 2 '14 at 22:29









                            admenvaadmenva

                            1,8231212




                            1,8231212








                            • 1





                              Doesn't work. Gives me a bunch of *** Not found: /api/queues/%2F/foo%0D errors.

                              – Der Hochstapler
                              Nov 28 '17 at 12:55











                            • In my case queues are prefixed with keyword by which I can simply use egrep, so my command will look like this: rabbitmqadmin -f tsv -q list queues name | egrep "%search word%" | while read queue; do rabbitmqadmin -q delete queue name=${queue}; done

                              – Logans
                              Oct 11 '18 at 10:51
















                            • 1





                              Doesn't work. Gives me a bunch of *** Not found: /api/queues/%2F/foo%0D errors.

                              – Der Hochstapler
                              Nov 28 '17 at 12:55











                            • In my case queues are prefixed with keyword by which I can simply use egrep, so my command will look like this: rabbitmqadmin -f tsv -q list queues name | egrep "%search word%" | while read queue; do rabbitmqadmin -q delete queue name=${queue}; done

                              – Logans
                              Oct 11 '18 at 10:51










                            1




                            1





                            Doesn't work. Gives me a bunch of *** Not found: /api/queues/%2F/foo%0D errors.

                            – Der Hochstapler
                            Nov 28 '17 at 12:55





                            Doesn't work. Gives me a bunch of *** Not found: /api/queues/%2F/foo%0D errors.

                            – Der Hochstapler
                            Nov 28 '17 at 12:55













                            In my case queues are prefixed with keyword by which I can simply use egrep, so my command will look like this: rabbitmqadmin -f tsv -q list queues name | egrep "%search word%" | while read queue; do rabbitmqadmin -q delete queue name=${queue}; done

                            – Logans
                            Oct 11 '18 at 10:51







                            In my case queues are prefixed with keyword by which I can simply use egrep, so my command will look like this: rabbitmqadmin -f tsv -q list queues name | egrep "%search word%" | while read queue; do rabbitmqadmin -q delete queue name=${queue}; done

                            – Logans
                            Oct 11 '18 at 10:51













                            19














                            Try this:



                             rabbitmqadmin list queues name | awk '{print $2}' | xargs -I qn rabbitmqadmin delete queue name=qn





                            share|improve this answer





















                            • 1





                              This worked for me, but also showed *** Not found: /api/queues/%2F/name because the output is a ASCII table with a "name" column. I tweaked the command to be rabbitmqadmin list queues name | awk '!/--|name/ {print $2}' | xargs -I qn rabbitmqadmin delete queue name=qn to fix it.

                              – Mark Edington
                              Jun 5 '17 at 13:52











                            • rabbitmqadmin list queues name | awk {'print$2'} | egrep [^name] | xargs -I qname rabbitmqadmin delete queue name=qname

                              – phatpenguin
                              Sep 5 '18 at 16:10


















                            19














                            Try this:



                             rabbitmqadmin list queues name | awk '{print $2}' | xargs -I qn rabbitmqadmin delete queue name=qn





                            share|improve this answer





















                            • 1





                              This worked for me, but also showed *** Not found: /api/queues/%2F/name because the output is a ASCII table with a "name" column. I tweaked the command to be rabbitmqadmin list queues name | awk '!/--|name/ {print $2}' | xargs -I qn rabbitmqadmin delete queue name=qn to fix it.

                              – Mark Edington
                              Jun 5 '17 at 13:52











                            • rabbitmqadmin list queues name | awk {'print$2'} | egrep [^name] | xargs -I qname rabbitmqadmin delete queue name=qname

                              – phatpenguin
                              Sep 5 '18 at 16:10
















                            19












                            19








                            19







                            Try this:



                             rabbitmqadmin list queues name | awk '{print $2}' | xargs -I qn rabbitmqadmin delete queue name=qn





                            share|improve this answer















                            Try this:



                             rabbitmqadmin list queues name | awk '{print $2}' | xargs -I qn rabbitmqadmin delete queue name=qn






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Feb 18 '15 at 11:13









                            Venkata Krishna

                            1,59211021




                            1,59211021










                            answered Feb 18 '15 at 10:12









                            GatholeGathole

                            5961021




                            5961021








                            • 1





                              This worked for me, but also showed *** Not found: /api/queues/%2F/name because the output is a ASCII table with a "name" column. I tweaked the command to be rabbitmqadmin list queues name | awk '!/--|name/ {print $2}' | xargs -I qn rabbitmqadmin delete queue name=qn to fix it.

                              – Mark Edington
                              Jun 5 '17 at 13:52











                            • rabbitmqadmin list queues name | awk {'print$2'} | egrep [^name] | xargs -I qname rabbitmqadmin delete queue name=qname

                              – phatpenguin
                              Sep 5 '18 at 16:10
















                            • 1





                              This worked for me, but also showed *** Not found: /api/queues/%2F/name because the output is a ASCII table with a "name" column. I tweaked the command to be rabbitmqadmin list queues name | awk '!/--|name/ {print $2}' | xargs -I qn rabbitmqadmin delete queue name=qn to fix it.

                              – Mark Edington
                              Jun 5 '17 at 13:52











                            • rabbitmqadmin list queues name | awk {'print$2'} | egrep [^name] | xargs -I qname rabbitmqadmin delete queue name=qname

                              – phatpenguin
                              Sep 5 '18 at 16:10










                            1




                            1





                            This worked for me, but also showed *** Not found: /api/queues/%2F/name because the output is a ASCII table with a "name" column. I tweaked the command to be rabbitmqadmin list queues name | awk '!/--|name/ {print $2}' | xargs -I qn rabbitmqadmin delete queue name=qn to fix it.

                            – Mark Edington
                            Jun 5 '17 at 13:52





                            This worked for me, but also showed *** Not found: /api/queues/%2F/name because the output is a ASCII table with a "name" column. I tweaked the command to be rabbitmqadmin list queues name | awk '!/--|name/ {print $2}' | xargs -I qn rabbitmqadmin delete queue name=qn to fix it.

                            – Mark Edington
                            Jun 5 '17 at 13:52













                            rabbitmqadmin list queues name | awk {'print$2'} | egrep [^name] | xargs -I qname rabbitmqadmin delete queue name=qname

                            – phatpenguin
                            Sep 5 '18 at 16:10







                            rabbitmqadmin list queues name | awk {'print$2'} | egrep [^name] | xargs -I qname rabbitmqadmin delete queue name=qname

                            – phatpenguin
                            Sep 5 '18 at 16:10













                            7














                            Actually super easy with management plugin and policies:




                            • Goto Management Console (localhost:15672)


                            • Goto Admin tab


                            • Goto Policies tab(on the right side)


                            • Add Policy



                            • Fill Fields





                              • Virtual Host: Select


                              • Name: Expire All Policies(Delete Later)


                              • Pattern: .*


                              • Apply to: Queues


                              • Definition: expires with value 1 (change type from String to Number)



                            • Save


                            • Checkout Queues tab again

                            • All Queues must be deleted


                            • And don't forget remove policy!!!!!!.






                            share|improve this answer





















                            • 1





                              select "Number" at Definition. Does not work with default ("String")

                              – Mathias
                              Nov 12 '18 at 7:07











                            • Great answer, actually made up my day. If you select "Exchanges and Queues" from the list, you could easily delete both Queues and Exchanges. I wish this could be the accepted answer.

                              – Wiktor Zychla
                              Dec 5 '18 at 11:20
















                            7














                            Actually super easy with management plugin and policies:




                            • Goto Management Console (localhost:15672)


                            • Goto Admin tab


                            • Goto Policies tab(on the right side)


                            • Add Policy



                            • Fill Fields





                              • Virtual Host: Select


                              • Name: Expire All Policies(Delete Later)


                              • Pattern: .*


                              • Apply to: Queues


                              • Definition: expires with value 1 (change type from String to Number)



                            • Save


                            • Checkout Queues tab again

                            • All Queues must be deleted


                            • And don't forget remove policy!!!!!!.






                            share|improve this answer





















                            • 1





                              select "Number" at Definition. Does not work with default ("String")

                              – Mathias
                              Nov 12 '18 at 7:07











                            • Great answer, actually made up my day. If you select "Exchanges and Queues" from the list, you could easily delete both Queues and Exchanges. I wish this could be the accepted answer.

                              – Wiktor Zychla
                              Dec 5 '18 at 11:20














                            7












                            7








                            7







                            Actually super easy with management plugin and policies:




                            • Goto Management Console (localhost:15672)


                            • Goto Admin tab


                            • Goto Policies tab(on the right side)


                            • Add Policy



                            • Fill Fields





                              • Virtual Host: Select


                              • Name: Expire All Policies(Delete Later)


                              • Pattern: .*


                              • Apply to: Queues


                              • Definition: expires with value 1 (change type from String to Number)



                            • Save


                            • Checkout Queues tab again

                            • All Queues must be deleted


                            • And don't forget remove policy!!!!!!.






                            share|improve this answer















                            Actually super easy with management plugin and policies:




                            • Goto Management Console (localhost:15672)


                            • Goto Admin tab


                            • Goto Policies tab(on the right side)


                            • Add Policy



                            • Fill Fields





                              • Virtual Host: Select


                              • Name: Expire All Policies(Delete Later)


                              • Pattern: .*


                              • Apply to: Queues


                              • Definition: expires with value 1 (change type from String to Number)



                            • Save


                            • Checkout Queues tab again

                            • All Queues must be deleted


                            • And don't forget remove policy!!!!!!.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Jan 5 at 0:40









                            yoyo

                            5,16424141




                            5,16424141










                            answered Aug 24 '18 at 10:07









                            Mesut A.Mesut A.

                            12115




                            12115








                            • 1





                              select "Number" at Definition. Does not work with default ("String")

                              – Mathias
                              Nov 12 '18 at 7:07











                            • Great answer, actually made up my day. If you select "Exchanges and Queues" from the list, you could easily delete both Queues and Exchanges. I wish this could be the accepted answer.

                              – Wiktor Zychla
                              Dec 5 '18 at 11:20














                            • 1





                              select "Number" at Definition. Does not work with default ("String")

                              – Mathias
                              Nov 12 '18 at 7:07











                            • Great answer, actually made up my day. If you select "Exchanges and Queues" from the list, you could easily delete both Queues and Exchanges. I wish this could be the accepted answer.

                              – Wiktor Zychla
                              Dec 5 '18 at 11:20








                            1




                            1





                            select "Number" at Definition. Does not work with default ("String")

                            – Mathias
                            Nov 12 '18 at 7:07





                            select "Number" at Definition. Does not work with default ("String")

                            – Mathias
                            Nov 12 '18 at 7:07













                            Great answer, actually made up my day. If you select "Exchanges and Queues" from the list, you could easily delete both Queues and Exchanges. I wish this could be the accepted answer.

                            – Wiktor Zychla
                            Dec 5 '18 at 11:20





                            Great answer, actually made up my day. If you select "Exchanges and Queues" from the list, you could easily delete both Queues and Exchanges. I wish this could be the accepted answer.

                            – Wiktor Zychla
                            Dec 5 '18 at 11:20











                            6














                            I made a deleteRabbitMqQs.sh, which accepts arguments to search the list of queues for, selecting only ones matching the pattern you want. If you offer no arguments, it will delete them all! It shows you the list of queues its about to delete, letting you quit before doing anything destructive.



                            for word in "$@"
                            do
                            args=true
                            newQueues=$(rabbitmqctl list_queues name | grep "$word")
                            queues="$queues
                            $newQueues"
                            done
                            if [ $# -eq 0 ]; then
                            queues=$(rabbitmqctl list_queues name | grep -v "...")
                            fi

                            queues=$(echo "$queues" | sed '/^[[:space:]]*$/d')

                            if [ "x$queues" == "x" ]; then
                            echo "No queues to delete, giving up."
                            exit 0
                            fi

                            read -p "Deleting the following queues:
                            ${queues}
                            [CTRL+C quit | ENTER proceed]
                            "

                            while read -r line; do
                            rabbitmqadmin delete queue name="$line"
                            done <<< "$queues"


                            If you want different matching against the arguments you pass in, you can alter the grep in line four. When deleting all queues, it won't delete ones with three consecutive spaces in them, because I figured that eventuality would be rarer than people who have rabbitmqctl printing its output out in different languages.



                            Enjoy!






                            share|improve this answer






























                              6














                              I made a deleteRabbitMqQs.sh, which accepts arguments to search the list of queues for, selecting only ones matching the pattern you want. If you offer no arguments, it will delete them all! It shows you the list of queues its about to delete, letting you quit before doing anything destructive.



                              for word in "$@"
                              do
                              args=true
                              newQueues=$(rabbitmqctl list_queues name | grep "$word")
                              queues="$queues
                              $newQueues"
                              done
                              if [ $# -eq 0 ]; then
                              queues=$(rabbitmqctl list_queues name | grep -v "...")
                              fi

                              queues=$(echo "$queues" | sed '/^[[:space:]]*$/d')

                              if [ "x$queues" == "x" ]; then
                              echo "No queues to delete, giving up."
                              exit 0
                              fi

                              read -p "Deleting the following queues:
                              ${queues}
                              [CTRL+C quit | ENTER proceed]
                              "

                              while read -r line; do
                              rabbitmqadmin delete queue name="$line"
                              done <<< "$queues"


                              If you want different matching against the arguments you pass in, you can alter the grep in line four. When deleting all queues, it won't delete ones with three consecutive spaces in them, because I figured that eventuality would be rarer than people who have rabbitmqctl printing its output out in different languages.



                              Enjoy!






                              share|improve this answer




























                                6












                                6








                                6







                                I made a deleteRabbitMqQs.sh, which accepts arguments to search the list of queues for, selecting only ones matching the pattern you want. If you offer no arguments, it will delete them all! It shows you the list of queues its about to delete, letting you quit before doing anything destructive.



                                for word in "$@"
                                do
                                args=true
                                newQueues=$(rabbitmqctl list_queues name | grep "$word")
                                queues="$queues
                                $newQueues"
                                done
                                if [ $# -eq 0 ]; then
                                queues=$(rabbitmqctl list_queues name | grep -v "...")
                                fi

                                queues=$(echo "$queues" | sed '/^[[:space:]]*$/d')

                                if [ "x$queues" == "x" ]; then
                                echo "No queues to delete, giving up."
                                exit 0
                                fi

                                read -p "Deleting the following queues:
                                ${queues}
                                [CTRL+C quit | ENTER proceed]
                                "

                                while read -r line; do
                                rabbitmqadmin delete queue name="$line"
                                done <<< "$queues"


                                If you want different matching against the arguments you pass in, you can alter the grep in line four. When deleting all queues, it won't delete ones with three consecutive spaces in them, because I figured that eventuality would be rarer than people who have rabbitmqctl printing its output out in different languages.



                                Enjoy!






                                share|improve this answer















                                I made a deleteRabbitMqQs.sh, which accepts arguments to search the list of queues for, selecting only ones matching the pattern you want. If you offer no arguments, it will delete them all! It shows you the list of queues its about to delete, letting you quit before doing anything destructive.



                                for word in "$@"
                                do
                                args=true
                                newQueues=$(rabbitmqctl list_queues name | grep "$word")
                                queues="$queues
                                $newQueues"
                                done
                                if [ $# -eq 0 ]; then
                                queues=$(rabbitmqctl list_queues name | grep -v "...")
                                fi

                                queues=$(echo "$queues" | sed '/^[[:space:]]*$/d')

                                if [ "x$queues" == "x" ]; then
                                echo "No queues to delete, giving up."
                                exit 0
                                fi

                                read -p "Deleting the following queues:
                                ${queues}
                                [CTRL+C quit | ENTER proceed]
                                "

                                while read -r line; do
                                rabbitmqadmin delete queue name="$line"
                                done <<< "$queues"


                                If you want different matching against the arguments you pass in, you can alter the grep in line four. When deleting all queues, it won't delete ones with three consecutive spaces in them, because I figured that eventuality would be rarer than people who have rabbitmqctl printing its output out in different languages.



                                Enjoy!







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Sep 13 '13 at 13:18

























                                answered Sep 13 '13 at 12:06









                                DanDan

                                392310




                                392310























                                    6














                                    If you're trying to delete queues because they're unused and you don't want to reset, one option is to set the queue TTL very low via a policy, wait for the queues to be auto-deleted once the TTL is passed and then remove the policy (https://www.rabbitmq.com/ttl.html).



                                    rabbitmqctl.bat set_policy delq ".*" '{"expires": 1}' --apply-to queues


                                    To remove the policy



                                    rabbitmqctl clear_policy delq


                                    Note that this only works for unused queues



                                    Original info here: http://rabbitmq.1065348.n5.nabble.com/Deleting-all-queues-in-rabbitmq-td30933.html






                                    share|improve this answer




























                                      6














                                      If you're trying to delete queues because they're unused and you don't want to reset, one option is to set the queue TTL very low via a policy, wait for the queues to be auto-deleted once the TTL is passed and then remove the policy (https://www.rabbitmq.com/ttl.html).



                                      rabbitmqctl.bat set_policy delq ".*" '{"expires": 1}' --apply-to queues


                                      To remove the policy



                                      rabbitmqctl clear_policy delq


                                      Note that this only works for unused queues



                                      Original info here: http://rabbitmq.1065348.n5.nabble.com/Deleting-all-queues-in-rabbitmq-td30933.html






                                      share|improve this answer


























                                        6












                                        6








                                        6







                                        If you're trying to delete queues because they're unused and you don't want to reset, one option is to set the queue TTL very low via a policy, wait for the queues to be auto-deleted once the TTL is passed and then remove the policy (https://www.rabbitmq.com/ttl.html).



                                        rabbitmqctl.bat set_policy delq ".*" '{"expires": 1}' --apply-to queues


                                        To remove the policy



                                        rabbitmqctl clear_policy delq


                                        Note that this only works for unused queues



                                        Original info here: http://rabbitmq.1065348.n5.nabble.com/Deleting-all-queues-in-rabbitmq-td30933.html






                                        share|improve this answer













                                        If you're trying to delete queues because they're unused and you don't want to reset, one option is to set the queue TTL very low via a policy, wait for the queues to be auto-deleted once the TTL is passed and then remove the policy (https://www.rabbitmq.com/ttl.html).



                                        rabbitmqctl.bat set_policy delq ".*" '{"expires": 1}' --apply-to queues


                                        To remove the policy



                                        rabbitmqctl clear_policy delq


                                        Note that this only works for unused queues



                                        Original info here: http://rabbitmq.1065348.n5.nabble.com/Deleting-all-queues-in-rabbitmq-td30933.html







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Apr 12 '16 at 13:52









                                        user783836user783836

                                        1,0601323




                                        1,0601323























                                            6














                                            If you don't have rabbitmqadmin installed, try to purge queues with rabbitmqctl:




                                            rabbitmqctl list_queues | awk '{ print $1 }' | xargs -L1 rabbitmqctl purge_queue






                                            share|improve this answer
























                                            • There is no delete_queue nor purge_queue commands in rabbitmqctl. I would like to purge a lot of queues that seem to be automatically generated and I would not like to install extra software like rabbitmqadmin...

                                              – Rolice
                                              Jan 9 '18 at 9:09













                                            • rabbitmqctl purge_queue worked here manually. I only needed to add -p <virtual-host>

                                              – Roman Susi
                                              Feb 1 '18 at 8:38
















                                            6














                                            If you don't have rabbitmqadmin installed, try to purge queues with rabbitmqctl:




                                            rabbitmqctl list_queues | awk '{ print $1 }' | xargs -L1 rabbitmqctl purge_queue






                                            share|improve this answer
























                                            • There is no delete_queue nor purge_queue commands in rabbitmqctl. I would like to purge a lot of queues that seem to be automatically generated and I would not like to install extra software like rabbitmqadmin...

                                              – Rolice
                                              Jan 9 '18 at 9:09













                                            • rabbitmqctl purge_queue worked here manually. I only needed to add -p <virtual-host>

                                              – Roman Susi
                                              Feb 1 '18 at 8:38














                                            6












                                            6








                                            6







                                            If you don't have rabbitmqadmin installed, try to purge queues with rabbitmqctl:




                                            rabbitmqctl list_queues | awk '{ print $1 }' | xargs -L1 rabbitmqctl purge_queue






                                            share|improve this answer













                                            If you don't have rabbitmqadmin installed, try to purge queues with rabbitmqctl:




                                            rabbitmqctl list_queues | awk '{ print $1 }' | xargs -L1 rabbitmqctl purge_queue







                                            share|improve this answer












                                            share|improve this answer



                                            share|improve this answer










                                            answered Mar 27 '17 at 11:46









                                            Anatoly RugalevAnatoly Rugalev

                                            43759




                                            43759













                                            • There is no delete_queue nor purge_queue commands in rabbitmqctl. I would like to purge a lot of queues that seem to be automatically generated and I would not like to install extra software like rabbitmqadmin...

                                              – Rolice
                                              Jan 9 '18 at 9:09













                                            • rabbitmqctl purge_queue worked here manually. I only needed to add -p <virtual-host>

                                              – Roman Susi
                                              Feb 1 '18 at 8:38



















                                            • There is no delete_queue nor purge_queue commands in rabbitmqctl. I would like to purge a lot of queues that seem to be automatically generated and I would not like to install extra software like rabbitmqadmin...

                                              – Rolice
                                              Jan 9 '18 at 9:09













                                            • rabbitmqctl purge_queue worked here manually. I only needed to add -p <virtual-host>

                                              – Roman Susi
                                              Feb 1 '18 at 8:38

















                                            There is no delete_queue nor purge_queue commands in rabbitmqctl. I would like to purge a lot of queues that seem to be automatically generated and I would not like to install extra software like rabbitmqadmin...

                                            – Rolice
                                            Jan 9 '18 at 9:09







                                            There is no delete_queue nor purge_queue commands in rabbitmqctl. I would like to purge a lot of queues that seem to be automatically generated and I would not like to install extra software like rabbitmqadmin...

                                            – Rolice
                                            Jan 9 '18 at 9:09















                                            rabbitmqctl purge_queue worked here manually. I only needed to add -p <virtual-host>

                                            – Roman Susi
                                            Feb 1 '18 at 8:38





                                            rabbitmqctl purge_queue worked here manually. I only needed to add -p <virtual-host>

                                            – Roman Susi
                                            Feb 1 '18 at 8:38











                                            5














                                            Here is a way to do it with PowerShell. the URL may need to be updated



                                            $cred = Get-Credential
                                            iwr -ContentType 'application/json' -Method Get -Credential $cred 'http://localhost:15672/api/queues' | % {
                                            ConvertFrom-Json $_.Content } | % { $_ } | ? { $_.messages -gt 0} | % {
                                            iwr -method DELETE -Credential $cred -uri $("http://localhost:15672/api/queues/{0}/{1}" -f [System.Web.HttpUtility]::UrlEncode($_.vhost), $_.name)
                                            }





                                            share|improve this answer
























                                            • Note, this only deletes non-empty queues. Remove the -gt clause to delete all queues

                                              – Peter Goodman
                                              Mar 17 '15 at 1:27
















                                            5














                                            Here is a way to do it with PowerShell. the URL may need to be updated



                                            $cred = Get-Credential
                                            iwr -ContentType 'application/json' -Method Get -Credential $cred 'http://localhost:15672/api/queues' | % {
                                            ConvertFrom-Json $_.Content } | % { $_ } | ? { $_.messages -gt 0} | % {
                                            iwr -method DELETE -Credential $cred -uri $("http://localhost:15672/api/queues/{0}/{1}" -f [System.Web.HttpUtility]::UrlEncode($_.vhost), $_.name)
                                            }





                                            share|improve this answer
























                                            • Note, this only deletes non-empty queues. Remove the -gt clause to delete all queues

                                              – Peter Goodman
                                              Mar 17 '15 at 1:27














                                            5












                                            5








                                            5







                                            Here is a way to do it with PowerShell. the URL may need to be updated



                                            $cred = Get-Credential
                                            iwr -ContentType 'application/json' -Method Get -Credential $cred 'http://localhost:15672/api/queues' | % {
                                            ConvertFrom-Json $_.Content } | % { $_ } | ? { $_.messages -gt 0} | % {
                                            iwr -method DELETE -Credential $cred -uri $("http://localhost:15672/api/queues/{0}/{1}" -f [System.Web.HttpUtility]::UrlEncode($_.vhost), $_.name)
                                            }





                                            share|improve this answer













                                            Here is a way to do it with PowerShell. the URL may need to be updated



                                            $cred = Get-Credential
                                            iwr -ContentType 'application/json' -Method Get -Credential $cred 'http://localhost:15672/api/queues' | % {
                                            ConvertFrom-Json $_.Content } | % { $_ } | ? { $_.messages -gt 0} | % {
                                            iwr -method DELETE -Credential $cred -uri $("http://localhost:15672/api/queues/{0}/{1}" -f [System.Web.HttpUtility]::UrlEncode($_.vhost), $_.name)
                                            }






                                            share|improve this answer












                                            share|improve this answer



                                            share|improve this answer










                                            answered Nov 20 '14 at 2:23









                                            klumsyklumsy

                                            1,79542239




                                            1,79542239













                                            • Note, this only deletes non-empty queues. Remove the -gt clause to delete all queues

                                              – Peter Goodman
                                              Mar 17 '15 at 1:27



















                                            • Note, this only deletes non-empty queues. Remove the -gt clause to delete all queues

                                              – Peter Goodman
                                              Mar 17 '15 at 1:27

















                                            Note, this only deletes non-empty queues. Remove the -gt clause to delete all queues

                                            – Peter Goodman
                                            Mar 17 '15 at 1:27





                                            Note, this only deletes non-empty queues. Remove the -gt clause to delete all queues

                                            – Peter Goodman
                                            Mar 17 '15 at 1:27











                                            3














                                            You can use rabbitmqctl eval as below:



                                            rabbitmqctl eval 'IfUnused = false, IfEmpty = true, MatchRegex = 
                                            <<"^prefix-">>, [rabbit_amqqueue:delete(Q, IfUnused, IfEmpty) || Q <-
                                            rabbit_amqqueue:list(), re:run(element(4, element(2, Q)), MatchRegex)
                                            =/= nomatch ].'


                                            The above will delete all empty queues in all vhosts that have a name
                                            beginning with "prefix-".
                                            You can edit the variables IfUnused, IfEmpty,
                                            and MatchRegex as per your requirement.






                                            share|improve this answer
























                                            • Perfect for when rabbitmqadmin is not accessible.

                                              – NuSkooler
                                              Aug 24 '16 at 19:59
















                                            3














                                            You can use rabbitmqctl eval as below:



                                            rabbitmqctl eval 'IfUnused = false, IfEmpty = true, MatchRegex = 
                                            <<"^prefix-">>, [rabbit_amqqueue:delete(Q, IfUnused, IfEmpty) || Q <-
                                            rabbit_amqqueue:list(), re:run(element(4, element(2, Q)), MatchRegex)
                                            =/= nomatch ].'


                                            The above will delete all empty queues in all vhosts that have a name
                                            beginning with "prefix-".
                                            You can edit the variables IfUnused, IfEmpty,
                                            and MatchRegex as per your requirement.






                                            share|improve this answer
























                                            • Perfect for when rabbitmqadmin is not accessible.

                                              – NuSkooler
                                              Aug 24 '16 at 19:59














                                            3












                                            3








                                            3







                                            You can use rabbitmqctl eval as below:



                                            rabbitmqctl eval 'IfUnused = false, IfEmpty = true, MatchRegex = 
                                            <<"^prefix-">>, [rabbit_amqqueue:delete(Q, IfUnused, IfEmpty) || Q <-
                                            rabbit_amqqueue:list(), re:run(element(4, element(2, Q)), MatchRegex)
                                            =/= nomatch ].'


                                            The above will delete all empty queues in all vhosts that have a name
                                            beginning with "prefix-".
                                            You can edit the variables IfUnused, IfEmpty,
                                            and MatchRegex as per your requirement.






                                            share|improve this answer













                                            You can use rabbitmqctl eval as below:



                                            rabbitmqctl eval 'IfUnused = false, IfEmpty = true, MatchRegex = 
                                            <<"^prefix-">>, [rabbit_amqqueue:delete(Q, IfUnused, IfEmpty) || Q <-
                                            rabbit_amqqueue:list(), re:run(element(4, element(2, Q)), MatchRegex)
                                            =/= nomatch ].'


                                            The above will delete all empty queues in all vhosts that have a name
                                            beginning with "prefix-".
                                            You can edit the variables IfUnused, IfEmpty,
                                            and MatchRegex as per your requirement.







                                            share|improve this answer












                                            share|improve this answer



                                            share|improve this answer










                                            answered Aug 19 '16 at 10:59









                                            George NinanGeorge Ninan

                                            799177




                                            799177













                                            • Perfect for when rabbitmqadmin is not accessible.

                                              – NuSkooler
                                              Aug 24 '16 at 19:59



















                                            • Perfect for when rabbitmqadmin is not accessible.

                                              – NuSkooler
                                              Aug 24 '16 at 19:59

















                                            Perfect for when rabbitmqadmin is not accessible.

                                            – NuSkooler
                                            Aug 24 '16 at 19:59





                                            Perfect for when rabbitmqadmin is not accessible.

                                            – NuSkooler
                                            Aug 24 '16 at 19:59











                                            3














                                            Removing all queues using rabbitmqctl one liner



                                            rabbitmqctl list_queues | awk '{ print $1 }' | sed 's/Listing//' | xargs -L1 rabbitmqctl purge_queue





                                            share|improve this answer




























                                              3














                                              Removing all queues using rabbitmqctl one liner



                                              rabbitmqctl list_queues | awk '{ print $1 }' | sed 's/Listing//' | xargs -L1 rabbitmqctl purge_queue





                                              share|improve this answer


























                                                3












                                                3








                                                3







                                                Removing all queues using rabbitmqctl one liner



                                                rabbitmqctl list_queues | awk '{ print $1 }' | sed 's/Listing//' | xargs -L1 rabbitmqctl purge_queue





                                                share|improve this answer













                                                Removing all queues using rabbitmqctl one liner



                                                rabbitmqctl list_queues | awk '{ print $1 }' | sed 's/Listing//' | xargs -L1 rabbitmqctl purge_queue






                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Jan 31 '18 at 5:00









                                                MarianMarian

                                                699




                                                699























                                                    2














                                                    In case you only want to purge the queues which are not empty (a lot faster):



                                                    rabbitmqctl list_queues | awk '$2!=0 { print $1 }' | sed 's/Listing//' | xargs -L1 rabbitmqctl purge_queue


                                                    For me, it takes 2-3 seconds to purge a queue (both empty and non-empty ones), so iterating through 50 queues is such a pain while I just need to purge 10 of them (40/50 are empty).






                                                    share|improve this answer



















                                                    • 1





                                                      the command works perfectly - thank you very much

                                                      – Viorel Florian
                                                      Oct 21 '18 at 8:20
















                                                    2














                                                    In case you only want to purge the queues which are not empty (a lot faster):



                                                    rabbitmqctl list_queues | awk '$2!=0 { print $1 }' | sed 's/Listing//' | xargs -L1 rabbitmqctl purge_queue


                                                    For me, it takes 2-3 seconds to purge a queue (both empty and non-empty ones), so iterating through 50 queues is such a pain while I just need to purge 10 of them (40/50 are empty).






                                                    share|improve this answer



















                                                    • 1





                                                      the command works perfectly - thank you very much

                                                      – Viorel Florian
                                                      Oct 21 '18 at 8:20














                                                    2












                                                    2








                                                    2







                                                    In case you only want to purge the queues which are not empty (a lot faster):



                                                    rabbitmqctl list_queues | awk '$2!=0 { print $1 }' | sed 's/Listing//' | xargs -L1 rabbitmqctl purge_queue


                                                    For me, it takes 2-3 seconds to purge a queue (both empty and non-empty ones), so iterating through 50 queues is such a pain while I just need to purge 10 of them (40/50 are empty).






                                                    share|improve this answer













                                                    In case you only want to purge the queues which are not empty (a lot faster):



                                                    rabbitmqctl list_queues | awk '$2!=0 { print $1 }' | sed 's/Listing//' | xargs -L1 rabbitmqctl purge_queue


                                                    For me, it takes 2-3 seconds to purge a queue (both empty and non-empty ones), so iterating through 50 queues is such a pain while I just need to purge 10 of them (40/50 are empty).







                                                    share|improve this answer












                                                    share|improve this answer



                                                    share|improve this answer










                                                    answered Mar 30 '18 at 15:21









                                                    Duc TranDuc Tran

                                                    3,35332335




                                                    3,35332335








                                                    • 1





                                                      the command works perfectly - thank you very much

                                                      – Viorel Florian
                                                      Oct 21 '18 at 8:20














                                                    • 1





                                                      the command works perfectly - thank you very much

                                                      – Viorel Florian
                                                      Oct 21 '18 at 8:20








                                                    1




                                                    1





                                                    the command works perfectly - thank you very much

                                                    – Viorel Florian
                                                    Oct 21 '18 at 8:20





                                                    the command works perfectly - thank you very much

                                                    – Viorel Florian
                                                    Oct 21 '18 at 8:20











                                                    2














                                                    To list queues,



                                                    ./rabbitmqadmin -f tsv -q list queues


                                                    To delete a queue,



                                                    ./rabbitmqadmin delete queue name=name_of_queue





                                                    share|improve this answer






























                                                      2














                                                      To list queues,



                                                      ./rabbitmqadmin -f tsv -q list queues


                                                      To delete a queue,



                                                      ./rabbitmqadmin delete queue name=name_of_queue





                                                      share|improve this answer




























                                                        2












                                                        2








                                                        2







                                                        To list queues,



                                                        ./rabbitmqadmin -f tsv -q list queues


                                                        To delete a queue,



                                                        ./rabbitmqadmin delete queue name=name_of_queue





                                                        share|improve this answer















                                                        To list queues,



                                                        ./rabbitmqadmin -f tsv -q list queues


                                                        To delete a queue,



                                                        ./rabbitmqadmin delete queue name=name_of_queue






                                                        share|improve this answer














                                                        share|improve this answer



                                                        share|improve this answer








                                                        edited Nov 19 '18 at 18:52









                                                        Wayne Phipps

                                                        1,14341929




                                                        1,14341929










                                                        answered Nov 19 '18 at 16:41









                                                        Isuru DewasurendraIsuru Dewasurendra

                                                        664




                                                        664























                                                            1














                                                            Here is a faster version (using parallel install sudo apt-get install parallel) expanding on the excellent answer by @admenva




                                                            parallel -j 50 rabbitmqadmin -H YOUR_HOST_OR_LOCALHOST -q delete queue name={} ::: $(rabbitmqadmin -H YOUR_HOST_OR_LOCALHOST -f tsv -q list queues name)






                                                            share|improve this answer




























                                                              1














                                                              Here is a faster version (using parallel install sudo apt-get install parallel) expanding on the excellent answer by @admenva




                                                              parallel -j 50 rabbitmqadmin -H YOUR_HOST_OR_LOCALHOST -q delete queue name={} ::: $(rabbitmqadmin -H YOUR_HOST_OR_LOCALHOST -f tsv -q list queues name)






                                                              share|improve this answer


























                                                                1












                                                                1








                                                                1







                                                                Here is a faster version (using parallel install sudo apt-get install parallel) expanding on the excellent answer by @admenva




                                                                parallel -j 50 rabbitmqadmin -H YOUR_HOST_OR_LOCALHOST -q delete queue name={} ::: $(rabbitmqadmin -H YOUR_HOST_OR_LOCALHOST -f tsv -q list queues name)






                                                                share|improve this answer













                                                                Here is a faster version (using parallel install sudo apt-get install parallel) expanding on the excellent answer by @admenva




                                                                parallel -j 50 rabbitmqadmin -H YOUR_HOST_OR_LOCALHOST -q delete queue name={} ::: $(rabbitmqadmin -H YOUR_HOST_OR_LOCALHOST -f tsv -q list queues name)







                                                                share|improve this answer












                                                                share|improve this answer



                                                                share|improve this answer










                                                                answered Mar 15 '15 at 15:45









                                                                alonisseralonisser

                                                                4,5811361105




                                                                4,5811361105























                                                                    1














                                                                    This commands deletes all your queues



                                                                    python rabbitmqadmin.py 
                                                                    -H YOURHOST -u guest -p guest -f bash list queues |
                                                                    xargs -n1 |
                                                                    xargs -I{}
                                                                    python rabbitmqadmin.py -H YOURHOST -u guest -p guest delete queue name={}


                                                                    This script is super simple because it uses -f bash, which outputs the queues as a list.



                                                                    Then we use xargs -n1 to split that up into multiple variables



                                                                    Then we use xargs -I{} that will run the command following, and replace {} in the command.






                                                                    share|improve this answer
























                                                                    • I've tried like 10 different answers, and this is the ONLY thing that has actually worked to delete queues without killing all my other settings. Thanks! I can't believe rabbitmqctl doesn't just have a "drop all queues" command.

                                                                      – sudo
                                                                      Aug 1 '16 at 19:52













                                                                    • BTW, to get rabbitmqadmin, you need to go to http://yourhost:15672/cli/ and download it.

                                                                      – sudo
                                                                      Aug 1 '16 at 19:54
















                                                                    1














                                                                    This commands deletes all your queues



                                                                    python rabbitmqadmin.py 
                                                                    -H YOURHOST -u guest -p guest -f bash list queues |
                                                                    xargs -n1 |
                                                                    xargs -I{}
                                                                    python rabbitmqadmin.py -H YOURHOST -u guest -p guest delete queue name={}


                                                                    This script is super simple because it uses -f bash, which outputs the queues as a list.



                                                                    Then we use xargs -n1 to split that up into multiple variables



                                                                    Then we use xargs -I{} that will run the command following, and replace {} in the command.






                                                                    share|improve this answer
























                                                                    • I've tried like 10 different answers, and this is the ONLY thing that has actually worked to delete queues without killing all my other settings. Thanks! I can't believe rabbitmqctl doesn't just have a "drop all queues" command.

                                                                      – sudo
                                                                      Aug 1 '16 at 19:52













                                                                    • BTW, to get rabbitmqadmin, you need to go to http://yourhost:15672/cli/ and download it.

                                                                      – sudo
                                                                      Aug 1 '16 at 19:54














                                                                    1












                                                                    1








                                                                    1







                                                                    This commands deletes all your queues



                                                                    python rabbitmqadmin.py 
                                                                    -H YOURHOST -u guest -p guest -f bash list queues |
                                                                    xargs -n1 |
                                                                    xargs -I{}
                                                                    python rabbitmqadmin.py -H YOURHOST -u guest -p guest delete queue name={}


                                                                    This script is super simple because it uses -f bash, which outputs the queues as a list.



                                                                    Then we use xargs -n1 to split that up into multiple variables



                                                                    Then we use xargs -I{} that will run the command following, and replace {} in the command.






                                                                    share|improve this answer













                                                                    This commands deletes all your queues



                                                                    python rabbitmqadmin.py 
                                                                    -H YOURHOST -u guest -p guest -f bash list queues |
                                                                    xargs -n1 |
                                                                    xargs -I{}
                                                                    python rabbitmqadmin.py -H YOURHOST -u guest -p guest delete queue name={}


                                                                    This script is super simple because it uses -f bash, which outputs the queues as a list.



                                                                    Then we use xargs -n1 to split that up into multiple variables



                                                                    Then we use xargs -I{} that will run the command following, and replace {} in the command.







                                                                    share|improve this answer












                                                                    share|improve this answer



                                                                    share|improve this answer










                                                                    answered Sep 18 '15 at 9:26









                                                                    Kevin SimperKevin Simper

                                                                    1,2001425




                                                                    1,2001425













                                                                    • I've tried like 10 different answers, and this is the ONLY thing that has actually worked to delete queues without killing all my other settings. Thanks! I can't believe rabbitmqctl doesn't just have a "drop all queues" command.

                                                                      – sudo
                                                                      Aug 1 '16 at 19:52













                                                                    • BTW, to get rabbitmqadmin, you need to go to http://yourhost:15672/cli/ and download it.

                                                                      – sudo
                                                                      Aug 1 '16 at 19:54



















                                                                    • I've tried like 10 different answers, and this is the ONLY thing that has actually worked to delete queues without killing all my other settings. Thanks! I can't believe rabbitmqctl doesn't just have a "drop all queues" command.

                                                                      – sudo
                                                                      Aug 1 '16 at 19:52













                                                                    • BTW, to get rabbitmqadmin, you need to go to http://yourhost:15672/cli/ and download it.

                                                                      – sudo
                                                                      Aug 1 '16 at 19:54

















                                                                    I've tried like 10 different answers, and this is the ONLY thing that has actually worked to delete queues without killing all my other settings. Thanks! I can't believe rabbitmqctl doesn't just have a "drop all queues" command.

                                                                    – sudo
                                                                    Aug 1 '16 at 19:52







                                                                    I've tried like 10 different answers, and this is the ONLY thing that has actually worked to delete queues without killing all my other settings. Thanks! I can't believe rabbitmqctl doesn't just have a "drop all queues" command.

                                                                    – sudo
                                                                    Aug 1 '16 at 19:52















                                                                    BTW, to get rabbitmqadmin, you need to go to http://yourhost:15672/cli/ and download it.

                                                                    – sudo
                                                                    Aug 1 '16 at 19:54





                                                                    BTW, to get rabbitmqadmin, you need to go to http://yourhost:15672/cli/ and download it.

                                                                    – sudo
                                                                    Aug 1 '16 at 19:54











                                                                    1














                                                                    You need not reset rabbitmq server to delete non-durable queues. Simply stop the server and start again and it will remove all the non-durable queues available.






                                                                    share|improve this answer


























                                                                    • including durable queues? I don't think so. I'll qualify your answer.

                                                                      – Hendy Irawan
                                                                      Nov 26 '15 at 8:38











                                                                    • No, durable queues cannot be deleted by stopping the server. They can be deleted from RabbitMQ Management web interface under queues.

                                                                      – ErAcube
                                                                      Nov 26 '15 at 9:48











                                                                    • Actually yes, this helped me and all about 4500 automatically generated queues are gone. It seems that these were non-durable ones. Thanks!

                                                                      – Rolice
                                                                      Jan 9 '18 at 9:12


















                                                                    1














                                                                    You need not reset rabbitmq server to delete non-durable queues. Simply stop the server and start again and it will remove all the non-durable queues available.






                                                                    share|improve this answer


























                                                                    • including durable queues? I don't think so. I'll qualify your answer.

                                                                      – Hendy Irawan
                                                                      Nov 26 '15 at 8:38











                                                                    • No, durable queues cannot be deleted by stopping the server. They can be deleted from RabbitMQ Management web interface under queues.

                                                                      – ErAcube
                                                                      Nov 26 '15 at 9:48











                                                                    • Actually yes, this helped me and all about 4500 automatically generated queues are gone. It seems that these were non-durable ones. Thanks!

                                                                      – Rolice
                                                                      Jan 9 '18 at 9:12
















                                                                    1












                                                                    1








                                                                    1







                                                                    You need not reset rabbitmq server to delete non-durable queues. Simply stop the server and start again and it will remove all the non-durable queues available.






                                                                    share|improve this answer















                                                                    You need not reset rabbitmq server to delete non-durable queues. Simply stop the server and start again and it will remove all the non-durable queues available.







                                                                    share|improve this answer














                                                                    share|improve this answer



                                                                    share|improve this answer








                                                                    edited Nov 26 '15 at 8:38









                                                                    Hendy Irawan

                                                                    12.3k77586




                                                                    12.3k77586










                                                                    answered Oct 29 '15 at 9:23









                                                                    ErAcubeErAcube

                                                                    1,0261814




                                                                    1,0261814













                                                                    • including durable queues? I don't think so. I'll qualify your answer.

                                                                      – Hendy Irawan
                                                                      Nov 26 '15 at 8:38











                                                                    • No, durable queues cannot be deleted by stopping the server. They can be deleted from RabbitMQ Management web interface under queues.

                                                                      – ErAcube
                                                                      Nov 26 '15 at 9:48











                                                                    • Actually yes, this helped me and all about 4500 automatically generated queues are gone. It seems that these were non-durable ones. Thanks!

                                                                      – Rolice
                                                                      Jan 9 '18 at 9:12





















                                                                    • including durable queues? I don't think so. I'll qualify your answer.

                                                                      – Hendy Irawan
                                                                      Nov 26 '15 at 8:38











                                                                    • No, durable queues cannot be deleted by stopping the server. They can be deleted from RabbitMQ Management web interface under queues.

                                                                      – ErAcube
                                                                      Nov 26 '15 at 9:48











                                                                    • Actually yes, this helped me and all about 4500 automatically generated queues are gone. It seems that these were non-durable ones. Thanks!

                                                                      – Rolice
                                                                      Jan 9 '18 at 9:12



















                                                                    including durable queues? I don't think so. I'll qualify your answer.

                                                                    – Hendy Irawan
                                                                    Nov 26 '15 at 8:38





                                                                    including durable queues? I don't think so. I'll qualify your answer.

                                                                    – Hendy Irawan
                                                                    Nov 26 '15 at 8:38













                                                                    No, durable queues cannot be deleted by stopping the server. They can be deleted from RabbitMQ Management web interface under queues.

                                                                    – ErAcube
                                                                    Nov 26 '15 at 9:48





                                                                    No, durable queues cannot be deleted by stopping the server. They can be deleted from RabbitMQ Management web interface under queues.

                                                                    – ErAcube
                                                                    Nov 26 '15 at 9:48













                                                                    Actually yes, this helped me and all about 4500 automatically generated queues are gone. It seems that these were non-durable ones. Thanks!

                                                                    – Rolice
                                                                    Jan 9 '18 at 9:12







                                                                    Actually yes, this helped me and all about 4500 automatically generated queues are gone. It seems that these were non-durable ones. Thanks!

                                                                    – Rolice
                                                                    Jan 9 '18 at 9:12













                                                                    0














                                                                    There's a way to remove all queues and exchanges without scripts and full reset. You can just delete and re-create a virtual host from admin interface. This will work even for vhost /.



                                                                    The only thing you'll need to restore is permissions for the newly created vhost.






                                                                    share|improve this answer




























                                                                      0














                                                                      There's a way to remove all queues and exchanges without scripts and full reset. You can just delete and re-create a virtual host from admin interface. This will work even for vhost /.



                                                                      The only thing you'll need to restore is permissions for the newly created vhost.






                                                                      share|improve this answer


























                                                                        0












                                                                        0








                                                                        0







                                                                        There's a way to remove all queues and exchanges without scripts and full reset. You can just delete and re-create a virtual host from admin interface. This will work even for vhost /.



                                                                        The only thing you'll need to restore is permissions for the newly created vhost.






                                                                        share|improve this answer













                                                                        There's a way to remove all queues and exchanges without scripts and full reset. You can just delete and re-create a virtual host from admin interface. This will work even for vhost /.



                                                                        The only thing you'll need to restore is permissions for the newly created vhost.







                                                                        share|improve this answer












                                                                        share|improve this answer



                                                                        share|improve this answer










                                                                        answered Nov 11 '15 at 9:47









                                                                        starteleportstarteleport

                                                                        7671720




                                                                        7671720























                                                                            0














                                                                            Okay, important qualifier for this answer:
                                                                            The question does ask to use either rabbitmqctl OR rabbitmqadmin to solve this, my answer needed to use both. Also, note that this was tested on MacOS 10.12.6 and the versions of the rabbitmqctl and rabbitmqadmin that are installed when installing rabbitmq with Homebrew and which is identified with brew list --versions as rabbitmq 3.7.0



                                                                            rabbitmqctl list_queues -p <VIRTUAL_HOSTNAME> name | sed 1,2d | xargs -I qname rabbitmqadmin --vhost <VIRTUAL_HOSTNAME> delete queue name=qname






                                                                            share|improve this answer




























                                                                              0














                                                                              Okay, important qualifier for this answer:
                                                                              The question does ask to use either rabbitmqctl OR rabbitmqadmin to solve this, my answer needed to use both. Also, note that this was tested on MacOS 10.12.6 and the versions of the rabbitmqctl and rabbitmqadmin that are installed when installing rabbitmq with Homebrew and which is identified with brew list --versions as rabbitmq 3.7.0



                                                                              rabbitmqctl list_queues -p <VIRTUAL_HOSTNAME> name | sed 1,2d | xargs -I qname rabbitmqadmin --vhost <VIRTUAL_HOSTNAME> delete queue name=qname






                                                                              share|improve this answer


























                                                                                0












                                                                                0








                                                                                0







                                                                                Okay, important qualifier for this answer:
                                                                                The question does ask to use either rabbitmqctl OR rabbitmqadmin to solve this, my answer needed to use both. Also, note that this was tested on MacOS 10.12.6 and the versions of the rabbitmqctl and rabbitmqadmin that are installed when installing rabbitmq with Homebrew and which is identified with brew list --versions as rabbitmq 3.7.0



                                                                                rabbitmqctl list_queues -p <VIRTUAL_HOSTNAME> name | sed 1,2d | xargs -I qname rabbitmqadmin --vhost <VIRTUAL_HOSTNAME> delete queue name=qname






                                                                                share|improve this answer













                                                                                Okay, important qualifier for this answer:
                                                                                The question does ask to use either rabbitmqctl OR rabbitmqadmin to solve this, my answer needed to use both. Also, note that this was tested on MacOS 10.12.6 and the versions of the rabbitmqctl and rabbitmqadmin that are installed when installing rabbitmq with Homebrew and which is identified with brew list --versions as rabbitmq 3.7.0



                                                                                rabbitmqctl list_queues -p <VIRTUAL_HOSTNAME> name | sed 1,2d | xargs -I qname rabbitmqadmin --vhost <VIRTUAL_HOSTNAME> delete queue name=qname







                                                                                share|improve this answer












                                                                                share|improve this answer



                                                                                share|improve this answer










                                                                                answered Jan 12 '18 at 18:40









                                                                                Brett TofelBrett Tofel

                                                                                362




                                                                                362























                                                                                    0














                                                                                    I tried rabbitmqctl and reset commands but they are very slow.



                                                                                    This is the fastest way I found (replace your username and password):



                                                                                    #!/bin/bash

                                                                                    # Stop on error
                                                                                    set -eo pipefail

                                                                                    USER='guest'
                                                                                    PASSWORD='guest'

                                                                                    curl -sSL -u $USER:$PASSWORD http://localhost:15672/api/queues/%2f/ | jq '..name' | sed 's/"//g' | xargs -L 1 -I@ curl -XDELETE -sSL -u $USER:$PASSWORD http://localhost:15672/api/queues/%2f/@
                                                                                    # To also delete exchanges uncomment next line
                                                                                    # curl -sSL -u $USER:$PASSWORD http://localhost:15672/api/exchanges/%2f/ | jq '..name' | sed 's/"//g' | xargs -L 1 -I@ curl -XDELETE -sSL -u $USER:$PASSWORD http://localhost:15672/api/exchanges/%2f/@


                                                                                    Note: This only works with the default vhost /






                                                                                    share|improve this answer




























                                                                                      0














                                                                                      I tried rabbitmqctl and reset commands but they are very slow.



                                                                                      This is the fastest way I found (replace your username and password):



                                                                                      #!/bin/bash

                                                                                      # Stop on error
                                                                                      set -eo pipefail

                                                                                      USER='guest'
                                                                                      PASSWORD='guest'

                                                                                      curl -sSL -u $USER:$PASSWORD http://localhost:15672/api/queues/%2f/ | jq '..name' | sed 's/"//g' | xargs -L 1 -I@ curl -XDELETE -sSL -u $USER:$PASSWORD http://localhost:15672/api/queues/%2f/@
                                                                                      # To also delete exchanges uncomment next line
                                                                                      # curl -sSL -u $USER:$PASSWORD http://localhost:15672/api/exchanges/%2f/ | jq '..name' | sed 's/"//g' | xargs -L 1 -I@ curl -XDELETE -sSL -u $USER:$PASSWORD http://localhost:15672/api/exchanges/%2f/@


                                                                                      Note: This only works with the default vhost /






                                                                                      share|improve this answer


























                                                                                        0












                                                                                        0








                                                                                        0







                                                                                        I tried rabbitmqctl and reset commands but they are very slow.



                                                                                        This is the fastest way I found (replace your username and password):



                                                                                        #!/bin/bash

                                                                                        # Stop on error
                                                                                        set -eo pipefail

                                                                                        USER='guest'
                                                                                        PASSWORD='guest'

                                                                                        curl -sSL -u $USER:$PASSWORD http://localhost:15672/api/queues/%2f/ | jq '..name' | sed 's/"//g' | xargs -L 1 -I@ curl -XDELETE -sSL -u $USER:$PASSWORD http://localhost:15672/api/queues/%2f/@
                                                                                        # To also delete exchanges uncomment next line
                                                                                        # curl -sSL -u $USER:$PASSWORD http://localhost:15672/api/exchanges/%2f/ | jq '..name' | sed 's/"//g' | xargs -L 1 -I@ curl -XDELETE -sSL -u $USER:$PASSWORD http://localhost:15672/api/exchanges/%2f/@


                                                                                        Note: This only works with the default vhost /






                                                                                        share|improve this answer













                                                                                        I tried rabbitmqctl and reset commands but they are very slow.



                                                                                        This is the fastest way I found (replace your username and password):



                                                                                        #!/bin/bash

                                                                                        # Stop on error
                                                                                        set -eo pipefail

                                                                                        USER='guest'
                                                                                        PASSWORD='guest'

                                                                                        curl -sSL -u $USER:$PASSWORD http://localhost:15672/api/queues/%2f/ | jq '..name' | sed 's/"//g' | xargs -L 1 -I@ curl -XDELETE -sSL -u $USER:$PASSWORD http://localhost:15672/api/queues/%2f/@
                                                                                        # To also delete exchanges uncomment next line
                                                                                        # curl -sSL -u $USER:$PASSWORD http://localhost:15672/api/exchanges/%2f/ | jq '..name' | sed 's/"//g' | xargs -L 1 -I@ curl -XDELETE -sSL -u $USER:$PASSWORD http://localhost:15672/api/exchanges/%2f/@


                                                                                        Note: This only works with the default vhost /







                                                                                        share|improve this answer












                                                                                        share|improve this answer



                                                                                        share|improve this answer










                                                                                        answered Apr 25 '18 at 14:50









                                                                                        Aalex GabiAalex Gabi

                                                                                        73911026




                                                                                        73911026























                                                                                            0














                                                                                            Another option is to delete the vhost associated with the queues. This will delete everything associated with the vhost, so be warned, but it is easy and fast.





                                                                                            NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.






                                                                                            share|improve this answer




























                                                                                              0














                                                                                              Another option is to delete the vhost associated with the queues. This will delete everything associated with the vhost, so be warned, but it is easy and fast.





                                                                                              NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.






                                                                                              share|improve this answer


























                                                                                                0












                                                                                                0








                                                                                                0







                                                                                                Another option is to delete the vhost associated with the queues. This will delete everything associated with the vhost, so be warned, but it is easy and fast.





                                                                                                NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.






                                                                                                share|improve this answer













                                                                                                Another option is to delete the vhost associated with the queues. This will delete everything associated with the vhost, so be warned, but it is easy and fast.





                                                                                                NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.







                                                                                                share|improve this answer












                                                                                                share|improve this answer



                                                                                                share|improve this answer










                                                                                                answered Dec 22 '18 at 16:22









                                                                                                Luke BakkenLuke Bakken

                                                                                                3,0072915




                                                                                                3,0072915























                                                                                                    -1














                                                                                                    rabbitmqadmin list queues|awk 'NR>3{print $4}'|head -n-1|xargs -I qname rabbitmqadmin delete queue name=qname





                                                                                                    share|improve this answer



















                                                                                                    • 1





                                                                                                      I receive this when running it: head: illegal line count -- -1

                                                                                                      – Robert Ross
                                                                                                      Feb 25 '14 at 17:20













                                                                                                    • The "head -n-1" should be either "head -1" or "head -n 1"

                                                                                                      – Gerd Busker
                                                                                                      Jun 30 '14 at 11:14
















                                                                                                    -1














                                                                                                    rabbitmqadmin list queues|awk 'NR>3{print $4}'|head -n-1|xargs -I qname rabbitmqadmin delete queue name=qname





                                                                                                    share|improve this answer



















                                                                                                    • 1





                                                                                                      I receive this when running it: head: illegal line count -- -1

                                                                                                      – Robert Ross
                                                                                                      Feb 25 '14 at 17:20













                                                                                                    • The "head -n-1" should be either "head -1" or "head -n 1"

                                                                                                      – Gerd Busker
                                                                                                      Jun 30 '14 at 11:14














                                                                                                    -1












                                                                                                    -1








                                                                                                    -1







                                                                                                    rabbitmqadmin list queues|awk 'NR>3{print $4}'|head -n-1|xargs -I qname rabbitmqadmin delete queue name=qname





                                                                                                    share|improve this answer













                                                                                                    rabbitmqadmin list queues|awk 'NR>3{print $4}'|head -n-1|xargs -I qname rabbitmqadmin delete queue name=qname






                                                                                                    share|improve this answer












                                                                                                    share|improve this answer



                                                                                                    share|improve this answer










                                                                                                    answered Feb 20 '14 at 11:22









                                                                                                    SalamiSalami

                                                                                                    1,2101526




                                                                                                    1,2101526








                                                                                                    • 1





                                                                                                      I receive this when running it: head: illegal line count -- -1

                                                                                                      – Robert Ross
                                                                                                      Feb 25 '14 at 17:20













                                                                                                    • The "head -n-1" should be either "head -1" or "head -n 1"

                                                                                                      – Gerd Busker
                                                                                                      Jun 30 '14 at 11:14














                                                                                                    • 1





                                                                                                      I receive this when running it: head: illegal line count -- -1

                                                                                                      – Robert Ross
                                                                                                      Feb 25 '14 at 17:20













                                                                                                    • The "head -n-1" should be either "head -1" or "head -n 1"

                                                                                                      – Gerd Busker
                                                                                                      Jun 30 '14 at 11:14








                                                                                                    1




                                                                                                    1





                                                                                                    I receive this when running it: head: illegal line count -- -1

                                                                                                    – Robert Ross
                                                                                                    Feb 25 '14 at 17:20







                                                                                                    I receive this when running it: head: illegal line count -- -1

                                                                                                    – Robert Ross
                                                                                                    Feb 25 '14 at 17:20















                                                                                                    The "head -n-1" should be either "head -1" or "head -n 1"

                                                                                                    – Gerd Busker
                                                                                                    Jun 30 '14 at 11:14





                                                                                                    The "head -n-1" should be either "head -1" or "head -n 1"

                                                                                                    – Gerd Busker
                                                                                                    Jun 30 '14 at 11:14


















                                                                                                    draft saved

                                                                                                    draft discarded




















































                                                                                                    Thanks for contributing an answer to Stack Overflow!


                                                                                                    • Please be sure to answer the question. Provide details and share your research!

                                                                                                    But avoid



                                                                                                    • Asking for help, clarification, or responding to other answers.

                                                                                                    • Making statements based on opinion; back them up with references or personal experience.


                                                                                                    To learn more, see our tips on writing great answers.




                                                                                                    draft saved


                                                                                                    draft discarded














                                                                                                    StackExchange.ready(
                                                                                                    function () {
                                                                                                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f11459676%2fdelete-all-the-queues-from-rabbitmq%23new-answer', 'question_page');
                                                                                                    }
                                                                                                    );

                                                                                                    Post as a guest















                                                                                                    Required, but never shown





















































                                                                                                    Required, but never shown














                                                                                                    Required, but never shown












                                                                                                    Required, but never shown







                                                                                                    Required, but never shown

































                                                                                                    Required, but never shown














                                                                                                    Required, but never shown












                                                                                                    Required, but never shown







                                                                                                    Required, but never shown







                                                                                                    Popular posts from this blog

                                                                                                    How to change which sound is reproduced for terminal bell?

                                                                                                    Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                                                                                                    Can I use Tabulator js library in my java Spring + Thymeleaf project?