最後更新: 2014/09/29
介紹
* amqp(Advanced Message Queueing Protocol)
* Implemented in C++
* AMQP uses SASL to authenticate client connections to the broker.
* AMQP is an open internet protocol for reliably sending and receiving messages.
A store-and-forward messaging system gives you efficient, reliable communication. Message brokers take responsibility for ensuring messages reach their destination, even if the destination is temporarily out of reach.
messaging patterns
- point-to-point
- fan-out
- publish-subscribe
- request-response.
安裝 Messaging server (AMQP)
# Install
yum install qpid-cpp-server
vi /etc/qpidd.conf
auth=no
OR
# no spaces on either side of '='
# DIGEST-MD5 for client connections to brokers
auth=yes
cluster-mechanism=DIGEST-MD5 ANONYMOUS
acl-file=/etc/qpid/qpidd.acl
Authorization
If you decide to enable authentication for your test environment,
you must configure the qpid_username and qpid_password keys in the configuration file
of each OpenStack service that uses the message broker.
# Start Service
service qpidd start
chkconfig qpidd on
Compute:
yum install qpid-cpp-client
Version:
qpidd -v
qpidd (qpidc) version 0.18
設定檔1:
/etc/qpidd.conf
# The Qpid broker authenticates users in the QPID realm by default realm=QPID
設定檔2:
ACL 的設定:
/etc/qpid/qpidd.acl
acl deny all create link acl allow all all
sasl 的設定:
/etc/sasl2/qpidd.conf
pwcheck_method: auxprop auxprop_plugin: sasldb sasldb_path: /var/lib/qpidd/qpidd.sasldb mech_list: ANONYMOUS DIGEST-MD5 EXTERNAL PLAIN sql_select: dummy select
Login DB:
/var/lib/qpidd/qpidd.sasldb
# add new users
saslpasswd2 [-f file] [-u domain] userid
saslpasswd2 -f /var/lib/qpidd/qpidd.sasldb -u QPID userid
# list user
sasldblistusers2 -f /var/lib/qpidd/qpidd.sasldb
測試:
package: python-qpid-0.18-5.el6_4.noarch
qpid-python-test
................................................................
qpid.tests.messaging.message.MessageEchoTests.testUnicodeContent ................ pass
qpid.tests.messaging.message.MessageTests.testContentTypeOverride ............... pass
qpid.tests.messaging.message.MessageTests.testCreateList ........................ pass
qpid.tests.messaging.message.MessageTests.testCreateMap ......................... pass
qpid.tests.messaging.message.MessageTests.testCreateString ...................... pass
qpid.tests.messaging.message.MessageTests.testCreateUnicode ..................... pass
Totals: 309 tests, 309 passed, 0 skipped, 0 ignored, 0 failed
data directory:
The data directory is used for the journal, so it is important when reliability counts
ls /var/lib/qpidd
lock qpidd.sasldb # qpidd.sasldb: Berkeley DB (Hash, version 8, native byte-order) systemId # bd62d538-2628-4100-87c5-8c7d5f77b264
qpid DOC:
http://qpid.apache.org/releases/qpid-0.18/books/AMQP-Messaging-Broker-CPP-Book/html/
術語:
- SASL: Simple Authentication and Security Layer