apache qpid 基本的なメッセージ操作
apache qpid アドレスの指定
apache qpid アドレスのオプションキーワード
の続き。
参考にしているのは「Programming in Apache Qpid」
詳細な状態確認
コレまでのサンプルで使ってきた qpid-config である程度の状態は確認できる。しかしこのコマンドはqpidを操作することが目的で、詳細な状態確認の機能は備えていない。
これを補うコマンドがいくつかあるので簡単な使い方をメモしておく。
qpid-tool
qpid-toolコマンドは現在定義されているexchange/queue/bindの状態を詳細に確認できる。
$ qpid-tool
Management Tool for QPID
qpid:
実行すると、専用プロンプトが起動する。
■QPIDが持つオブジェクトの一覧を表示する
qpid: list
Summary of Objects by Type: Package Class Active Deleted ======================================================= org.apache.qpid.broker binding 30 0 org.apache.qpid.broker broker 1 0 org.apache.qpid.broker memory 1 0 org.apache.qpid.broker system 1 0 org.apache.qpid.broker subscription 10 0 org.apache.qpid.broker connection 2 0 org.apache.qpid.broker session 2 0 org.apache.qpid.broker queue 14 0 org.apache.qpid.broker exchange 11 0 org.apache.qpid.broker vhost 1 0
■exchangeの一覧を表示
qpid: list exchange
Object Summary: ID Created Destroyed Index ================================================== 135 14:49:05 - 173. 136 14:49:05 - 173.amq.direct 137 14:49:05 - 173.amq.fanout 138 14:49:05 - 173.amq.match 139 14:49:05 - 173.amq.topic 140 07:15:14 - 173.hello-world 141 14:43:46 - 173.my-topic 142 11:33:05 - 173.news-service 143 14:49:05 - 173.qmf.default.direct 144 14:49:05 - 173.qmf.default.topic 145 14:49:05 - 173.qpid.management
■exchangeの詳細を表示
qpid: show 141
Object of type: org.apache.qpid.broker:exchange:_data(c9bb43df-44ac-63d5-cc1c-6a032025c97d) Attribute 141 ============================= vhostRef 173 name my-topic type topic durable False autoDelete False altExchange absent arguments {} producerCount 0 producerCountHigh 0 producerCountLow 0 bindingCount 0 bindingCountHigh 0 bindingCountLow 0 msgReceives 0 msgDrops 0 msgRoutes 0 byteReceives 0 byteDrops 0 byteRoutes 0
■queueの一覧を表示
qpid: list queue
Object Summary: ID Created Destroyed Index =========================================================== 146 14:43:40 - 173.my-queue 147 15:15:47 - 173.not-exist-queue 148 14:02:36 - 173.qmfc-v2-hb-openstack.4254.1 149 16:56:18 - 173.qmfc-v2-hb-openstack.4697.1 150 14:02:36 - 173.qmfc-v2-openstack.4254.1 151 16:56:18 - 173.qmfc-v2-openstack.4697.1 152 14:02:36 - 173.qmfc-v2-ui-openstack.4254.1 153 16:56:18 - 173.qmfc-v2-ui-openstack.4697.1 154 11:38:36 - 173.que-test1 155 14:02:36 - 173.reply-openstack.4254.1 156 16:56:18 - 173.reply-openstack.4697.1 157 14:02:36 - 173.topic-openstack.4254.1 158 16:56:18 - 173.topic-openstack.4697.1 159 14:50:21 - 173.xoxox
■queueの詳細を表示
qpid: show 146
Object of type: org.apache.qpid.broker:queue:_data(ea2e430d-fc12-d491-dd53-74da3ba76576) Attribute 146 ================================= vhostRef 173 name my-queue durable False autoDelete False exclusive False arguments {} altExchange absent msgTotalEnqueues 9 msgTotalDequeues 9 msgTxnEnqueues 0 msgTxnDequeues 0 msgPersistEnqueues 0 msgPersistDequeues 0 msgDepth 0 byteDepth 0 byteTotalEnqueues 33 byteTotalDequeues 33 byteTxnEnqueues 0 byteTxnDequeues 0 bytePersistEnqueues 0 bytePersistDequeues 0 msgFtdEnqueues 0 msgFtdDequeues 0 byteFtdEnqueues 0 byteFtdDequeues 0 msgFtdDepth 0 byteFtdDepth 0 releases 0 acquires 9 discardsTtl 0 discardsRing 0 discardsLvq 0 discardsOverflow 0 discardsSubscriber 0 discardsPurge 0 reroutes 0 consumerCount 0 consumerCountHigh 0 consumerCountLow 0 bindingCount 1 bindingCountHigh 1 bindingCountLow 1 unackedMessages 0 unackedMessagesHigh 0 unackedMessagesLow 0 messageLatencySamples 0s messageLatencyMin 0s messageLatencyMax 0s messageLatencyAverage 0s flowStopped False flowStoppedCount 0
■bindの一覧を表示
qpid: list binding
Object Summary: ID Created Destroyed Index ================================================================================== 128 14:02:38 - 145.157.console.obj.*.*.org.apache.qpid.broker.queue.# 129 14:02:38 - 145.157.schema.# 130 16:56:20 - 145.158.console.# 131 16:56:20 - 145.158.schema.# 102 14:43:40 - 135.146.my-queue 103 15:15:47 - 135.147.not-exist-queue 104 14:02:36 - 135.148.qmfc-v2-hb-openstack.4254.1 105 16:56:18 - 135.149.qmfc-v2-hb-openstack.4697.1 106 14:02:36 - 135.150.qmfc-v2-openstack.4254.1 107 16:56:18 - 135.151.qmfc-v2-openstack.4697.1 108 14:02:36 - 135.152.qmfc-v2-ui-openstack.4254.1 109 16:56:18 - 135.153.qmfc-v2-ui-openstack.4697.1 110 11:38:36 - 135.154.que-test1 111 14:02:36 - 135.155.reply-openstack.4254.1 112 16:56:18 - 135.156.reply-openstack.4697.1 113 14:02:36 - 135.157.topic-openstack.4254.1 114 16:56:18 - 135.158.topic-openstack.4697.1 115 14:50:21 - 135.159.xoxox 116 14:02:36 - 136.155.reply-openstack.4254.1 117 16:56:18 - 136.156.reply-openstack.4697.1 118 14:02:36 - 143.150.qmfc-v2-openstack.4254.1 119 16:56:18 - 143.151.qmfc-v2-openstack.4697.1 120 14:02:38 - 144.148.agent.ind.heartbeat.org_apache.qpidd.# 121 16:56:20 - 144.149.agent.ind.heartbeat.# 122 14:02:38 - 144.152.agent.ind.data.org_apache_qpid_broker.queue.# 123 16:56:20 - 144.153.agent.ind.data.# 124 16:56:20 - 144.153.agent.ind.event.# 125 14:02:38 - 145.157.console.event.*.*.org.apache.qpid.broker.agent 126 14:02:38 - 145.157.console.heartbeat.# 127 14:02:38 - 145.157.console.obj.*.*.org.apache.qpid.broker.agent
■bindの詳細を表示
qpid: show 102
Object of type: org.apache.qpid.broker:binding:_data(79311b0b-4077-92c0-2001-79e75225daa3) Attribute 102 ======================= exchangeRef 135 queueRef 146 bindingKey my-queue arguments {} origin absent msgMatched 9
exaches - bind - queue の連結を確認する
これにはqpid-configに-rオプションをつけて利用する。
$ qpid-config exchanges -r
Exchange '' (direct) bind [b1960482-499d-4f92-8117-702f1523130b:0.0] => b1960482-499d-4f92-8117-702f1523130b:0.0 bind [qmfc-v2-hb-openstack.4254.1] => qmfc-v2-hb-openstack.4254.1 bind [qmfc-v2-hb-openstack.4807.1] => qmfc-v2-hb-openstack.4807.1 bind [qmfc-v2-openstack.4254.1] => qmfc-v2-openstack.4254.1 bind [qmfc-v2-openstack.4807.1] => qmfc-v2-openstack.4807.1 bind [qmfc-v2-ui-openstack.4254.1] => qmfc-v2-ui-openstack.4254.1 bind [qmfc-v2-ui-openstack.4807.1] => qmfc-v2-ui-openstack.4807.1 bind [reply-openstack.4254.1] => reply-openstack.4254.1 bind [reply-openstack.4807.1] => reply-openstack.4807.1 bind [topic-openstack.4254.1] => topic-openstack.4254.1 bind [topic-openstack.4807.1] => topic-openstack.4807.1 Exchange 'amq.direct' (direct) bind [reply-openstack.4254.1] => reply-openstack.4254.1 bind [reply-openstack.4807.1] => reply-openstack.4807.1 Exchange 'amq.fanout' (fanout) Exchange 'amq.match' (headers) Exchange 'amq.topic' (topic) Exchange 'qmf.default.direct' (direct) bind [qmfc-v2-openstack.4254.1] => qmfc-v2-openstack.4254.1 bind [qmfc-v2-openstack.4807.1] => qmfc-v2-openstack.4807.1 Exchange 'qmf.default.topic' (topic) bind [direct.e199bad9-5500-4c55-8cce-901e16956457] => b1960482-499d-4f92-8117-702f1523130b:0.0 bind [agent.ind.heartbeat.org_apache.qpidd.#] => qmfc-v2-hb-openstack.4254.1 bind [agent.ind.heartbeat.#] => qmfc-v2-hb-openstack.4807.1 bind [agent.ind.data.org_apache_qpid_broker.queue.#] => qmfc-v2-ui-openstack.4254.1 bind [agent.ind.event.#] => qmfc-v2-ui-openstack.4807.1 Exchange 'qpid.management' (topic) bind [console.event.*.*.org.apache.qpid.broker.agent] => topic-openstack.4254.1 bind [console.heartbeat.#] => topic-openstack.4254.1 bind [console.obj.*.*.org.apache.qpid.broker.agent] => topic-openstack.4254.1 bind [console.obj.*.*.org.apache.qpid.broker.queue.#] => topic-openstack.4254.1 bind [schema.#] => topic-openstack.4254.1 bind [console.event.#] => topic-openstack.4807.1 bind [console.obj.*.*.org.apache.qpid.broker.agent] => topic-openstack.4807.1 bind [schema.#] => topic-openstack.4807.1
$ qpid-config queues -r
Queue '54c949ad-a3ac-4b1c-9d13-5f58279c987c:0.0' bind [54c949ad-a3ac-4b1c-9d13-5f58279c987c:0.0] => '' bind [direct.5950919e-ed14-4e39-89f4-d7a55d4b901e] => qmf.default.topic Queue 'qmfc-v2-hb-openstack.4254.1' bind [qmfc-v2-hb-openstack.4254.1] => '' bind [agent.ind.heartbeat.org_apache.qpidd.#] => qmf.default.topic Queue 'qmfc-v2-hb-openstack.4807.1' bind [qmfc-v2-hb-openstack.4807.1] => '' bind [agent.ind.heartbeat.#] => qmf.default.topic Queue 'qmfc-v2-openstack.4254.1' bind [qmfc-v2-openstack.4254.1] => '' bind [qmfc-v2-openstack.4254.1] => qmf.default.direct Queue 'qmfc-v2-openstack.4807.1' bind [qmfc-v2-openstack.4807.1] => '' bind [qmfc-v2-openstack.4807.1] => qmf.default.direct Queue 'qmfc-v2-ui-openstack.4254.1' bind [qmfc-v2-ui-openstack.4254.1] => '' bind [agent.ind.data.org_apache_qpid_broker.queue.#] => qmf.default.topic Queue 'qmfc-v2-ui-openstack.4807.1' bind [qmfc-v2-ui-openstack.4807.1] => '' bind [agent.ind.event.#] => qmf.default.topic Queue 'reply-openstack.4254.1' bind [reply-openstack.4254.1] => '' bind [reply-openstack.4254.1] => amq.direct Queue 'reply-openstack.4807.1' bind [reply-openstack.4807.1] => '' bind [reply-openstack.4807.1] => amq.direct Queue 'topic-openstack.4254.1' bind [topic-openstack.4254.1] => '' bind [console.event.*.*.org.apache.qpid.broker.agent] => qpid.management bind [console.heartbeat.#] => qpid.management bind [console.obj.*.*.org.apache.qpid.broker.agent] => qpid.management bind [console.obj.*.*.org.apache.qpid.broker.queue.#] => qpid.management bind [schema.#] => qpid.management Queue 'topic-openstack.4807.1' bind [topic-openstack.4807.1] => '' bind [console.event.#] => qpid.management bind [console.obj.*.*.org.apache.qpid.broker.agent] => qpid.management bind [schema.#] => qpid.management
qpid-printevents
qpid-printevents はqpidへ接続して接続してくるクライアントの状態等を出力してくれる。
$ qpid-printevents
Sun Aug 19 17:36:12 2012 INFO org.apache.qpid.broker:subscribe broker=localhost:5672 rhost=[::1]:5672-[::1]:49999 user=anonymous@QPID qName=qmfc-v2-openstack.5072.1 dest=v2dest excl=F args={} Sun Aug 19 17:36:12 2012 INFO org.apache.qpid.broker:subscribe broker=localhost:5672 rhost=[::1]:5672-[::1]:49999 user=anonymous@QPID qName=qmfc-v2-ui-openstack.5072.1 dest=v2TopicUI excl=F args={} Sun Aug 19 17:36:12 2012 INFO org.apache.qpid.broker:subscribe broker=localhost:5672 rhost=[::1]:5672-[::1]:49999 user=anonymous@QPID qName=qmfc-v2-hb-openstack.5072.1 dest=v2TopicHB excl=F args={} Sun Aug 19 17:36:14 2012 INFO org.apache.qpid.broker:bind broker=localhost:5672 rhost=[::1]:5672-[::1]:49999 user=anonymous@QPID exName=qpid.management qName=topic-openstack.5072.1 key=schema.# args={} Sun Aug 19 17:36:14 2012 INFO org.apache.qpid.broker:bind broker=localhost:5672 rhost=[::1]:5672-[::1]:49999 user=anonymous@QPID exName=qpid.management qName=topic-openstack.5072.1 key=console.obj.*.*.org.apache.qpid.broker.agent args={} Sun Aug 19 17:36:14 2012 INFO org.apache.qpid.broker:bind broker=localhost:5672 rhost=[::1]:5672-[::1]:49999 user=anonymous@QPID exName=qpid.management qName=topic-openstack.5072.1 key=console.event.# args={} Sun Aug 19 17:36:14 2012 INFO org.apache.qpid.broker:bind broker=localhost:5672 rhost=[::1]:5672-[::1]:49999 user=anonymous@QPID exName=qpid.management qName=topic-openstack.5072.1 key=console.heartbeat.# args={} Sun Aug 19 17:36:14 2012 INFO org.apache.qpid.broker:bind broker=localhost:5672 rhost=[::1]:5672-[::1]:49999 user=anonymous@QPID exName=qmf.default.topic qName=qmfc-v2-hb-openstack.5072.1 key=agent.ind.heartbeat.# args={} Sun Aug 19 17:36:14 2012 INFO org.apache.qpid.broker:bind broker=localhost:5672 rhost=[::1]:5672-[::1]:49999 user=anonymous@QPID exName=qmf.default.topic qName=qmfc-v2-ui-openstack.5072.1 key=agent.ind.event.# args={}
qpid-queue-stats
いまいち使い道がわからない。
$ qpid-queue-stats -f my-queue
Queue Name Sec Depth Enq Rate Deq Rate =================================================================== my-queue 10.00 0 0.20 0.20 my-queue 30.00 0 0.07 0.07
qpid-stats
ざっくりとした統計情報を出力できる。
$ qpid-stat -h
Usage: qpid-stat [options] -[gcequm] [object-name] Options: -h, --help show this help message and exit General Options: -b <url>, --broker=<url> URL of the broker to query -t <secs>, --timeout=<secs> Maximum time to wait for broker connection (in seconds) --sasl-mechanism=<mech> SASL mechanism for authentication (e.g. EXTERNAL, ANONYMOUS, PLAIN, CRAM-MD, DIGEST-MD5, GSSAPI). SASL automatically picks the most secure available mechanism - use this option to override. --ha-admin Allow connection to a HA backup broker. Display Options: -g, --general Show General Broker Stats -c, --connections Show Connections -e, --exchanges Show Exchanges -q, --queues Show Queues -u, --subscriptions Show Subscriptions -m, --memory Show Broker Memory Stats --acl Show Access Control List Stats -S <colname>, --sort-by=<colname> Sort by column name -I, --increasing Sort by increasing value (default = decreasing) -L <n>, --limit=<n> Limit output to n rows
その他のツール
qpid-toolsには他にもコマンドが含まれている。これから調査する予定。
$ rpm -ql qpid-tools
/usr/bin/qmf-tool
/usr/bin/qpid-cluster
/usr/bin/qpid-cluster-store
/usr/bin/qpid-config
/usr/bin/qpid-printevents
/usr/bin/qpid-queue-stats
/usr/bin/qpid-route
/usr/bin/qpid-stat
/usr/bin/qpid-tool
/usr/lib/python2.7/site-packages/qpid_tools-0.16-py2.7.egg-info
/usr/share/doc/qpid-tools-0.16
/usr/share/doc/qpid-tools-0.16/LICENSE
/usr/share/doc/qpid-tools-0.16/NOTICE
0 件のコメント:
コメントを投稿