问题
Background
We used Laravel Queues on top of beanstalkd on two ec2 instances (behind a load balancer). As the system scaled we decided to use redis instead of beanstalkd, and host it on an AWS elastic cache instance (with a cluster of a master node and two replicas).
With beanstalkd, I used beanstalk utilities to monitor the health of the queue; for example if the queue was getting clogged, I could easily see that by running a command like this:
./beanstalk-queue-stats.rb localhost:11300
Which would return something like this
2018-01-10 11:08:38 +0000
default
- cmd-delete = 32678 (+32678)
- cmd-pause-tube = 0 (0)
- current-jobs-buried = 0 (0)
- current-jobs-delayed = 0 (0)
- current-jobs-ready = 0 (0)
- current-jobs-reserved = 0 (0)
- current-jobs-urgent = 0 (0)
- current-using = 5 (+5)
- current-waiting = 0 (0)
- current-watching = 2 (+2)
- pause = 0 (0)
- pause-time-left = 0 (0)
- total-jobs = 32678 (+32678)
high
- cmd-delete = 116005 (+116005)
- cmd-pause-tube = 0 (0)
- current-jobs-buried = 0 (0)
- current-jobs-delayed = 9 (+9)
- current-jobs-ready = 1117 (+1117)
- current-jobs-reserved = 0 (0)
- current-jobs-urgent = 0 (0)
- current-using = 0 (0)
- current-waiting = 0 (0)
- current-watching = 1 (+1)
- pause = 0 (0)
- pause-time-left = 0 (0)
- total-jobs = 117131 (+117131)
low
- cmd-delete = 0 (0)
- cmd-pause-tube = 0 (0)
- current-jobs-buried = 0 (0)
- current-jobs-delayed = 0 (0)
- current-jobs-ready = 0 (0)
- current-jobs-reserved = 0 (0)
- current-jobs-urgent = 0 (0)
- current-using = 0 (0)
- current-waiting = 0 (0)
- current-watching = 1 (+1)
- pause = 0 (0)
- pause-time-left = 0 (0)
- total-jobs = 0 (0)
marketing
- cmd-delete = 0 (0)
- cmd-pause-tube = 0 (0)
- current-jobs-buried = 0 (0)
- current-jobs-delayed = 0 (0)
- current-jobs-ready = 0 (0)
- current-jobs-reserved = 0 (0)
- current-jobs-urgent = 0 (0)
- current-using = 0 (0)
- current-waiting = 0 (0)
- current-watching = 1 (+1)
- pause = 0 (0)
- pause-time-left = 0 (0)
- total-jobs = 0 (0)
------------------
2018-01-10 11:08:48 +0000
default
- cmd-delete = 32678 (0)
- cmd-pause-tube = 0 (0)
- current-jobs-buried = 0 (0)
- current-jobs-delayed = 0 (0)
- current-jobs-ready = 0 (0)
- current-jobs-reserved = 0 (0)
- current-jobs-urgent = 0 (0)
- current-using = 5 (0)
- current-waiting = 0 (0)
- current-watching = 2 (0)
- pause = 0 (0)
- pause-time-left = 0 (0)
- total-jobs = 32678 (0)
high
- cmd-delete = 116005 (0)
- cmd-pause-tube = 0 (0)
- current-jobs-buried = 0 (0)
- current-jobs-delayed = 9 (0)
- current-jobs-ready = 1117 (0)
- current-jobs-reserved = 0 (0)
- current-jobs-urgent = 0 (0)
- current-using = 0 (0)
- current-waiting = 0 (0)
- current-watching = 1 (0)
- pause = 0 (0)
- pause-time-left = 0 (0)
- total-jobs = 117131 (0)
low
- cmd-delete = 0 (0)
- cmd-pause-tube = 0 (0)
- current-jobs-buried = 0 (0)
- current-jobs-delayed = 0 (0)
- current-jobs-ready = 0 (0)
- current-jobs-reserved = 0 (0)
- current-jobs-urgent = 0 (0)
- current-using = 0 (0)
- current-waiting = 0 (0)
- current-watching = 1 (0)
- pause = 0 (0)
- pause-time-left = 0 (0)
- total-jobs = 0 (0)
marketing
- cmd-delete = 0 (0)
- cmd-pause-tube = 0 (0)
- current-jobs-buried = 0 (0)
- current-jobs-delayed = 0 (0)
- current-jobs-ready = 0 (0)
- current-jobs-reserved = 0 (0)
- current-jobs-urgent = 0 (0)
- current-using = 0 (0)
- current-waiting = 0 (0)
- current-watching = 1 (0)
- pause = 0 (0)
- pause-time-left = 0 (0)
- total-jobs = 0 (0)
Question
I would like to do the same on Redis; I can telnet into Redis and type keys *
, which would give me the queues:
keys *
*4
$19
queues:high:delayed
$11
queues:high
$3
ctr
$10
queues:low
(notice how it maps nicely to the queues on the beanstalkd output above). However this is where my luck ends, if I want to peek into a specific queue, and type this:
dump queues:high
I get gibberish:
$4071
�FC^��4
A�{"job":"Illuminate\\Queu Call`
dHandler@c ","data":{"comm Name AApp\\Jobs\\Slack
+�# O:17:\�
& \":7:{s:10 \u0 *� message\"; `:lemon: Order *629* (code:
1479-45157*) has been p �ed by *client Testing*. Deliv H@R
2018-01-05 14 n:32�x3�� op_city_id ihigh`�9�%suffix !N `� connection�5 3qam@�4
@@6 ���`}"},"iAayA6noA7Dc9wtujE9XJ3CDqiqah5HNdby!�attempts":1}��"b�LRetai"2Newa�Push� 32 ��7�5!�5b1 .�oB��"
!h�'�8��h0CEQenh9QNSqv9lhFa4LQQ6xcktrAlpY�hi!hC�LhAXNotificaBXs� e2B��e�
2!b8Ab8�ausers"gO:4B��&Contract#�D$bas$4M#�lId#e �er W2@W@;clas@J�e`�U ] \s $\"�
a:1:{i:0cV2;}}s$�D`*3@Z@��
1:52:20.053320`X`K@Yzone_typ@:i:3 >@��`+@vUTC �i@' {@' �Bh�2
is_unregistereA*b!% )@��)DB_prior$� Ob:1@'E\�V�Q06QFyrdyNaG2S7T2OMmpoSIjGBjZ9m0�#�AGF�1b!�(3B-�h2:03"{.600349"�"�B�����sg31WFi5ZxAYyBWM2oRvLaXfSiQwhCYK�C�"/E
�29�/E�k8 �.586574`���K65twHypvaVJfpXaZiKQx4rSD9L5EUqq�f-��Z2 c�jF24.9-T28`���oArS0cNElFDTacbOstCp32Iq4dwkbXpa�
B���/,2�]6+�1 5 2 3�Ul�Kk,��"�L�lQ_broke,) F��l� j#J,���HClwcMykz2ZFiM�;��LM�[SKJh0bstcXHmRwnEBph55IzX39kxK1Lbv��"A��L�L�s:warn4���32* i4�dV.dWg����7"nP��#�h�YTtg6bBN0vcU6MDzdskeShyqYRnz4jit�����%�0��q�48.6797�����WfmvHIi0AkK8tfxZscweXGuyhQniuKGC�}Fc^��� +KEkFSe4E3kmnUu4mWpsXCpxapdkt2DSd��G����hqcbX8wls5ErNwYwyxZed9p2NIGsYID5�
A�{"job":"Illuminate\\Queu Call`
dHandler@c ","data":{"comm Name AApp\\Jobs\\Slack
+�# O:17:\�
high`ge\";s:32 :warning: Order *632* is broken.`)13 )�@�G op_city_id i:7 N9�#suffix N `� connection�5 3qa@�4
@@6 ��!f`}"},"iAgGvVjmnQ3Ps7IYrnF83tUzDmkXKLcUfr!=attempts":1}��C�L�
PushNotifica@�s� �2A0���
2!�8A�8��users �O:4A(�lContract"6D"Wbas"zMo!KIden@�er W2@W@;clas@J�e`�U ] \s $\!Z
a:1:{i:0!�291;}}s"a��B�`*3@Z@�oBR�#"X Q@qa"�t )"ANew `) received!`BtimB�B�Carb";#H`"�i@' {@' �B'
Which makes sense, considering that the dump command simply serializes the value in a "Redis specific format".
What I have done
GUI tools ❌
One option was simply looking at Redis using a gui tool but since my Redis is sitting behind a VPC, setting that up would be a pain and not suitable for prod anyway (see same link under limitations).
CLI tools ❌
This tool relies on the rdb file format, which is more about looking at the content of your entire Redis (I feel it's more about using Redis as a long term storage rather than just some queue, so I didn't see the fit).
Can someone tell me how to do this?
回答1:
the fix is to simply open an ssh tunnel on my local machine using this command
ssh -N -L 1234:amazon.elastic.cache.redis.instance:6379 forge@ip.of.remote.server -i /Users/Shared/.ssh/secret_file.pub
see more details of this command here
then i installed this open source redis gui tool: https://github.com/luin/medis
the rest worked like a charm:
回答2:
Another GUI for Redis is Redis Desktop manager
It's available on windows, Mac, and linux. Also it supports SSH connection
来源:https://stackoverflow.com/questions/48189802/how-to-monitor-redis-as-a-queue-engine-using-cli-similar-to-beanstalkd