• centos9 stream 下 rabbitmq高可用集群搭建及使用


    RabbitMQ是一种常用的消息队列系统,可以快速搭建一个高可用的集群环境,以提高系统的弹性和可靠性。下面是搭建RabbitMQ集群的步骤:

    基于centos9 stream系统

    1. 安装Erlang和RabbitMQ

    首先需要在所有节点上安装Erlang和RabbitMQ。建议使用官方提供的安装包进行安装。

    1. ##直接从yum,repo源安装,建议一起装上librabbitmq*
    2. yum install rabbitmq-server
    3. #安装时会默认安装erlang相关依赖包。
    4. #加入系统自动启动并立即运行rabbit
    5. systemctl enable rabbitmq-server.service --now

    2. 配置hosts文件

    在所有节点上编辑hosts文件,将各节点的IP地址和主机名映射到一起。这样可以通过主机名进行通信,而不是依赖IP地址。

    这个就不在讲了,直接编辑 /etc/hosts这个文件即可

    个人主机内容参考如下:

    1. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
    2. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
    3. 110.110.10.5 host1
    4. 110.110.10.6 host2
    5. 110.110.10.7 host3

    3. 配置rabbit集群

    一般情况下一个节点的rabbit也差不多够用了,但为了稳定性使用高可用集群还是有必要的,配置集群可以直接编辑每个节点上的RabbitMQ配置文件,可以在/etc/rabbitmq/rabbitmq.conf中修改。常见的配置项:
    # 节点名称
    node_name = rabbit@node1

    # 集群节点列表
    cluster_nodes = {['rabbit@node1', 'rabbit@node2', 'rabbit@node3'], disc}

    # Cookie值,用于节点间通信
    erlang_cookie = abcde12345fghij

    还有自定义rabbit的ip,各类服务端口,还有ssl等高级配置在这里不说了。

    注意,这些配置项必须在所有节点上保持一致。

    命令方式配置集群

    默认情况下rabbit会直接获取hostname作为节点名,所以不用去配置文件中修改,这里主要讲使用命令直接配置和启动rabbit集群。

    1. ### 先配置管理节点,再将管理节点cookie复制到其他节点
    2. for i in {host1,host2,host3};do ssh $i systemctl stop rabbitmq-server;done
    3. for i in {host1,host2,host3};do scp /var/lib/rabbitmq/.erlang.cookie $i:/var/lib/rabbitmq/.erlang.cookie;done
    4. for i in {host1,host2,host3};do ssh $i chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie;done
    5. for i in {host1,host2,host3};do ssh $i chmod 400 /var/lib/rabbitmq/.erlang.cookie;done
    6. for i in {host1,host2,host3};do ssh $i systemctl start rabbitmq-server;done
    7. ###节点加入集群,从拟定的主节点以外的其他节点操作,新加入节点操作也一样。;
    8. rabbitmqctl stop_app
    9. rabbitmqctl join_cluster --ram rabbit@host1
    10. rabbitmqctl start_app
    11. # 查看rabbitmq集群服务状态,每加入一个节点都可以查看一下是否加入成功
    12. rabbitmqctl cluster_status
    13. # 单个新节点加入集群操作,在新节点上操作,与上面多节点操作基本一致。
    14. systemctl stop rabbitmq-server
    15. scp host1:/var/lib/rabbitmq/.erlang.cookie /var/lib/rabbitmq/.erlang.cookie
    16. chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie
    17. chmod 400 /var/lib/rabbitmq/.erlang.cookie
    18. systemctl start rabbitmq-server
    19. rabbitmqctl stop_app
    20. rabbitmqctl join_cluster --ram rabbit@host1
    21. rabbitmqctl start_app

    读写测试

    1. 写入和读取测试:
    2. python
    3. import pika
    4. # 连接到 rabbitmq 服务器
    5. connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
    6. channel = connection.channel()
    7. # 定义队列名称
    8. queue_name = 'test_queue'
    9. # 向队列写入消息
    10. channel.queue_declare(queue=queue_name)
    11. channel.basic_publish(exchange='',
    12. routing_key=queue_name,
    13. body='Hello World!')
    14. print(" [x] Sent 'Hello World!'")
    15. # 从队列中读取消息
    16. method_frame, header_frame, body = channel.basic_get(queue=queue_name, auto_ack=True)
    17. if method_frame:
    18. print(" [x] Received %r" % body)
    19. else:
    20. print('No message returned')
    21. # 关闭连接
    22. connection.close()
    23. # 在上述代码中,我们首先连接到了本地的 rabbitmq 服务器。然后定义了一个名为 test_queue 的队列,并向队列中写入了一条消息:Hello World!。接着,我们又从队列中读取了一条消息,并将其打印出来。

    在Node.js中使用RabbitMQ 

    1. Node.js中使用RabbitMQ需要先安装amqplib库,可以通过npm进行安装:
    2. npm install amqplib
    3. ##以下是使用RabbitMQ的基本步骤:
    4. ##建立与RabbitMQ服务器的连接
    5. const amqp = require('amqplib');
    6. amqp.connect('amqp://localhost').then(function(conn) {
    7. //执行后续操作
    8. });
    9. ###创建通道(channel)
    10. conn.createChannel().then(function(ch) {
    11. //执行后续操作
    12. });
    13. #发送消息
    14. const queueName = "hello";
    15. ch.assertQueue(queueName, { durable: false });
    16. ch.sendToQueue(queueName, new Buffer('Hello World!'));
    17. # 接收消息
    18. const queueName = "hello";
    19. ch.assertQueue(queueName, { durable: false });
    20. ch.consume(queueName, function(msg) {
    21. console.log("Received message: %s", msg.content.toString());
    22. }, { noAck: true });
    23. #######完整示例代码:
    24. const amqp = require('amqplib');
    25. amqp.connect('amqp://localhost').then(function(conn) {
    26. conn.createChannel().then(function(ch) {
    27. const queueName = "hello";
    28. ch.assertQueue(queueName, { durable: false });
    29. ch.sendToQueue(queueName, new Buffer('Hello World!'));
    30. ch.assertQueue(queueName, { durable: false });
    31. ch.consume(queueName, function(msg) {
    32. console.log("Received message: %s", msg.content.toString());
    33. }, { noAck: true });
    34. });
    35. }).catch(function(err) {
    36. console.log('Error:', err);
    37. });

    4. 常用管理命令

    1. #添加新用户
    2. sudo rabbitmqctl add_user username password
    3. #删除用户
    4. sudo rabbitmqctl delete_user username
    5. #分配用户权限
    6. sudo rabbitmqctl set_permissions -p / virtual-hostname 'username' '.*' '.*' '.*'
    7. #查看用户列表
    8. sudo rabbitmqctl list_users
    9. #查看队列列表
    10. sudo rabbitmqctl list_queues
    11. #查看交换机列表
    12. sudo rabbitmqctl list_exchanges
    13. #查看绑定列表
    14. sudo rabbitmqctl list_bindings
    15. #查看 vhost 列表
    16. sudo rabbitmqctl list_vhosts
    17. #查看某个 vhost 的权限控制列表
    18. sudo rabbitmqctl list_permissions -p virtual-hostname
    19. #查看 RabbitMQ 服务器信息
    20. sudo rabbitmqctl status

    5. 设置集群policy设置

    1. ##语句格式
    2. rabbitmqctl set_policy [-p ]
    3. rabbitmqctl clear_policy [-p ]
    4. rabbitmqctl list_policies [-p ]
    5. ## [ host1 ] 设置 ha-mode 高可用模式
    6. rabbitmqctl set_policy ha-all '^(?!amq\.).*' '{"ha-mode": "all"}';
    7. ## 置一个队列的最大长度为1000条消息:
    8. rabbitmqctl set_policy max-length-1000 "^my-queue$" '{"max-length":1000}' --apply-to queues

    6. 启用web面板插件

    1. # 启用web插件
    2. rabbitmq-plugins enable rabbitmq_management
    3. ##在本服务器或者同网段其他主机打开浏览器即可访问rabbitmq集群状态和管理页面

    使用前面命令添加用户并设置为管理员即可登陆web界面。 

    7. rabbitmq配置文件参考

    1. ###一般情况下不用在这里修改配置文件,但自定义参数的时候还是很有用的。
    2. cat /etc/rabbitmq/rabbitmq.conf
    3. ## This example configuration file demonstrates various settings
    4. ## available via rabbitmq.conf. It primarily focuses core broker settings
    5. ## but some tier 1 plugin settings are also covered.
    6. ##
    7. ## This file is AN EXAMPLE. It is NOT MEANT TO BE USED IN PRODUCTION. Instead of
    8. ## copying the entire (large!) file, create or generate a new rabbitmq.conf for the target system
    9. ## and populate it with the necessary settings.
    10. ##
    11. ## See https://rabbitmq.com/configure.html to learn about how to configure RabbitMQ,
    12. ## the ini-style format used by rabbitmq.conf, how it is different from `advanced.config`,
    13. ## how to verify effective configuration, and so on.
    14. ##
    15. ## See https://rabbitmq.com/documentation.html for the rest of RabbitMQ documentation.
    16. ##
    17. ## In case you have questions, please use RabbitMQ community Slack and the rabbitmq-users Google group
    18. ## instead of GitHub issues.
    19. # ======================================
    20. # Core broker section
    21. # ======================================
    22. ####这下面的5672,5671如果已经被占用时或者为了安全考虑可修改为其他端口,在服务应用时也需要调整成新的端口
    23. ## Networking
    24. ## ====================
    25. ##
    26. ## Related doc guide: https://rabbitmq.com/networking.html.
    27. ##
    28. ## By default, RabbitMQ will listen on all interfaces, using
    29. ## the standard (reserved) AMQP 0-9-1 and 1.0 port.
    30. ##
    31. # listeners.tcp.default = 5672
    32. ## To listen on a specific interface, provide an IP address with port.
    33. ## For example, to listen only on localhost for both IPv4 and IPv6:
    34. ##
    35. # IPv4
    36. # listeners.tcp.local = 127.0.0.1:5672
    37. # IPv6
    38. # listeners.tcp.local_v6 = ::1:5672
    39. ## You can define multiple listeners using listener names
    40. # listeners.tcp.other_port = 5673
    41. # listeners.tcp.other_ip = 10.10.10.10:5672
    42. ## TLS listeners are configured in the same fashion as TCP listeners,
    43. ## including the option to control the choice of interface.
    44. ##
    45. # listeners.ssl.default = 5671
    46. ## It is possible to disable regular TCP (non-TLS) listeners. Clients
    47. ## not configured to use TLS and the correct TLS-enabled port won't be able
    48. ## to connect to this node.
    49. # listeners.tcp = none
    50. ## Number of Erlang processes that will accept connections for the TCP
    51. ## and TLS listeners.
    52. ##
    53. # num_acceptors.tcp = 10
    54. # num_acceptors.ssl = 10
    55. ## Socket writer will force GC every so many bytes transferred.
    56. ## Default is 1 GiB (`1000000000`). Set to 'off' to disable.
    57. ##
    58. # socket_writer.gc_threshold = 1000000000
    59. #
    60. ## To disable:
    61. # socket_writer.gc_threshold = off
    62. ## Maximum amount of time allowed for the AMQP 0-9-1 and AMQP 1.0 handshake
    63. ## (performed after socket connection and TLS handshake) to complete, in milliseconds.
    64. ##
    65. # handshake_timeout = 10000
    66. ## Set to 'true' to perform reverse DNS lookups when accepting a
    67. ## connection. rabbitmqctl and management UI will then display hostnames
    68. ## instead of IP addresses. Default value is `false`.
    69. ##
    70. # reverse_dns_lookups = false
    71. ##
    72. ## Security, Access Control
    73. ## ==============
    74. ##
    75. ## Related doc guide: https://rabbitmq.com/access-control.html.
    76. ## The default "guest" user is only permitted to access the server
    77. ## via a loopback interface (e.g. localhost).
    78. ## {loopback_users, [<<"guest">>]},
    79. ##
    80. # loopback_users.guest = true
    81. ## Uncomment the following line if you want to allow access to the
    82. ## guest user from anywhere on the network.
    83. # loopback_users.guest = false
    84. ## TLS configuration.
    85. ##
    86. ## Related doc guide: https://rabbitmq.com/ssl.html.
    87. ##
    88. # listeners.ssl.1 = 5671
    89. #
    90. # ssl_options.verify = verify_peer
    91. # ssl_options.fail_if_no_peer_cert = false
    92. # ssl_options.cacertfile = /path/to/cacert.pem
    93. # ssl_options.certfile = /path/to/cert.pem
    94. # ssl_options.keyfile = /path/to/key.pem
    95. #
    96. # ssl_options.honor_cipher_order = true
    97. # ssl_options.honor_ecc_order = true
    98. #
    99. ## These are highly recommended for TLSv1.2 but cannot be used
    100. ## with TLSv1.3. If TLSv1.3 is enabled, these lines MUST be removed.
    101. # ssl_options.client_renegotiation = false
    102. # ssl_options.secure_renegotiate = true
    103. #
    104. ## Limits what TLS versions the server enables for client TLS
    105. ## connections. See https://www.rabbitmq.com/ssl.html#tls-versions for details.
    106. ##
    107. ## Cutting edge TLS version which requires recent client runtime
    108. ## versions and has no cipher suite in common with earlier TLS versions.
    109. # ssl_options.versions.1 = tlsv1.3
    110. ## Enables TLSv1.2 for best compatibility
    111. # ssl_options.versions.2 = tlsv1.2
    112. ## Older TLS versions have known vulnerabilities and are being phased out
    113. ## from wide use.
    114. ## Limits what cipher suites the server will use for client TLS
    115. ## connections. Narrowing this down can prevent some clients
    116. ## from connecting.
    117. ## If TLSv1.3 is enabled and cipher suites are overridden, TLSv1.3-specific
    118. ## cipher suites must also be explicitly enabled.
    119. ## See https://www.rabbitmq.com/ssl.html#cipher-suites and https://wiki.openssl.org/index.php/TLS1.3#Ciphersuites
    120. ## for details.
    121. #
    122. ## The example below uses TLSv1.3 cipher suites only
    123. #
    124. # ssl_options.ciphers.1 = TLS_AES_256_GCM_SHA384
    125. # ssl_options.ciphers.2 = TLS_AES_128_GCM_SHA256
    126. # ssl_options.ciphers.3 = TLS_CHACHA20_POLY1305_SHA256
    127. # ssl_options.ciphers.4 = TLS_AES_128_CCM_SHA256
    128. # ssl_options.ciphers.5 = TLS_AES_128_CCM_8_SHA256
    129. #
    130. ## The example below uses TLSv1.2 cipher suites only
    131. #
    132. # ssl_options.ciphers.1 = ECDHE-ECDSA-AES256-GCM-SHA384
    133. # ssl_options.ciphers.2 = ECDHE-RSA-AES256-GCM-SHA384
    134. # ssl_options.ciphers.3 = ECDHE-ECDSA-AES256-SHA384
    135. # ssl_options.ciphers.4 = ECDHE-RSA-AES256-SHA384
    136. # ssl_options.ciphers.5 = ECDH-ECDSA-AES256-GCM-SHA384
    137. # ssl_options.ciphers.6 = ECDH-RSA-AES256-GCM-SHA384
    138. # ssl_options.ciphers.7 = ECDH-ECDSA-AES256-SHA384
    139. # ssl_options.ciphers.8 = ECDH-RSA-AES256-SHA384
    140. # ssl_options.ciphers.9 = DHE-RSA-AES256-GCM-SHA384
    141. # ssl_options.ciphers.10 = DHE-DSS-AES256-GCM-SHA384
    142. # ssl_options.ciphers.11 = DHE-RSA-AES256-SHA256
    143. # ssl_options.ciphers.12 = DHE-DSS-AES256-SHA256
    144. # ssl_options.ciphers.13 = ECDHE-ECDSA-AES128-GCM-SHA256
    145. # ssl_options.ciphers.14 = ECDHE-RSA-AES128-GCM-SHA256
    146. # ssl_options.ciphers.15 = ECDHE-ECDSA-AES128-SHA256
    147. # ssl_options.ciphers.16 = ECDHE-RSA-AES128-SHA256
    148. # ssl_options.ciphers.17 = ECDH-ECDSA-AES128-GCM-SHA256
    149. # ssl_options.ciphers.18 = ECDH-RSA-AES128-GCM-SHA256
    150. # ssl_options.ciphers.19 = ECDH-ECDSA-AES128-SHA256
    151. # ssl_options.ciphers.20 = ECDH-RSA-AES128-SHA256
    152. # ssl_options.ciphers.21 = DHE-RSA-AES128-GCM-SHA256
    153. # ssl_options.ciphers.22 = DHE-DSS-AES128-GCM-SHA256
    154. # ssl_options.ciphers.23 = DHE-RSA-AES128-SHA256
    155. # ssl_options.ciphers.24 = DHE-DSS-AES128-SHA256
    156. # ssl_options.ciphers.25 = ECDHE-ECDSA-AES256-SHA
    157. # ssl_options.ciphers.26 = ECDHE-RSA-AES256-SHA
    158. # ssl_options.ciphers.27 = DHE-RSA-AES256-SHA
    159. # ssl_options.ciphers.28 = DHE-DSS-AES256-SHA
    160. # ssl_options.ciphers.29 = ECDH-ECDSA-AES256-SHA
    161. # ssl_options.ciphers.30 = ECDH-RSA-AES256-SHA
    162. # ssl_options.ciphers.31 = ECDHE-ECDSA-AES128-SHA
    163. # ssl_options.ciphers.32 = ECDHE-RSA-AES128-SHA
    164. # ssl_options.ciphers.33 = DHE-RSA-AES128-SHA
    165. # ssl_options.ciphers.34 = DHE-DSS-AES128-SHA
    166. # ssl_options.ciphers.35 = ECDH-ECDSA-AES128-SHA
    167. # ssl_options.ciphers.36 = ECDH-RSA-AES128-SHA
    168. # ssl_options.bypass_pem_cache = true
    169. ## Select an authentication/authorisation backend to use.
    170. ##
    171. ## Alternative backends are provided by plugins, such as rabbitmq-auth-backend-ldap.
    172. ##
    173. ## NB: These settings require certain plugins to be enabled.
    174. ##
    175. ## Related doc guides:
    176. ##
    177. ## * https://rabbitmq.com/plugins.html
    178. ## * https://rabbitmq.com/access-control.html
    179. ##
    180. # auth_backends.1 = rabbit_auth_backend_internal
    181. ## uses separate backends for authentication and authorisation,
    182. ## see below.
    183. # auth_backends.1.authn = rabbit_auth_backend_ldap
    184. # auth_backends.1.authz = rabbit_auth_backend_internal
    185. ## The rabbitmq_auth_backend_ldap plugin allows the broker to
    186. ## perform authentication and authorisation by deferring to an
    187. ## external LDAP server.
    188. ##
    189. ## Relevant doc guides:
    190. ##
    191. ## * https://rabbitmq.com/ldap.html
    192. ## * https://rabbitmq.com/access-control.html
    193. ##
    194. ## uses LDAP for both authentication and authorisation
    195. # auth_backends.1 = rabbit_auth_backend_ldap
    196. ## uses HTTP service for both authentication and
    197. ## authorisation
    198. # auth_backends.1 = rabbit_auth_backend_http
    199. ## uses two backends in a chain: HTTP first, then internal
    200. # auth_backends.1 = rabbit_auth_backend_http
    201. # auth_backends.2 = rabbit_auth_backend_internal
    202. ## Authentication
    203. ## The built-in mechanisms are 'PLAIN',
    204. ## 'AMQPLAIN', and 'EXTERNAL' Additional mechanisms can be added via
    205. ## plugins.
    206. ##
    207. ## Related doc guide: https://rabbitmq.com/authentication.html.
    208. ##
    209. # auth_mechanisms.1 = PLAIN
    210. # auth_mechanisms.2 = AMQPLAIN
    211. ## The rabbitmq-auth-mechanism-ssl plugin makes it possible to
    212. ## authenticate a user based on the client's x509 (TLS) certificate.
    213. ## Related doc guide: https://rabbitmq.com/authentication.html.
    214. ##
    215. ## To use auth-mechanism-ssl, the EXTERNAL mechanism should
    216. ## be enabled:
    217. ##
    218. # auth_mechanisms.1 = PLAIN
    219. # auth_mechanisms.2 = AMQPLAIN
    220. # auth_mechanisms.3 = EXTERNAL
    221. ## To force x509 certificate-based authentication on all clients,
    222. ## exclude all other mechanisms (note: this will disable password-based
    223. ## authentication even for the management UI!):
    224. ##
    225. # auth_mechanisms.1 = EXTERNAL
    226. ## This pertains to both the rabbitmq-auth-mechanism-ssl plugin and
    227. ## STOMP ssl_cert_login configurations. See the RabbitMQ STOMP plugin
    228. ## configuration section later in this file and the README in
    229. ## https://github.com/rabbitmq/rabbitmq-auth-mechanism-ssl for further
    230. ## details.
    231. ##
    232. ## To use the TLS cert's CN instead of its DN as the username
    233. ##
    234. # ssl_cert_login_from = common_name
    235. ## TLS handshake timeout, in milliseconds.
    236. ##
    237. # ssl_handshake_timeout = 5000
    238. ## Cluster name
    239. ##
    240. # cluster_name = dev3.eng.megacorp.local
    241. ## Password hashing implementation. Will only affect newly
    242. ## created users. To recalculate hash for an existing user
    243. ## it's necessary to update her password.
    244. ##
    245. ## To use SHA-512, set to rabbit_password_hashing_sha512.
    246. ##
    247. # password_hashing_module = rabbit_password_hashing_sha256
    248. ## When importing definitions exported from versions earlier
    249. ## than 3.6.0, it is possible to go back to MD5 (only do this
    250. ## as a temporary measure!) by setting this to rabbit_password_hashing_md5.
    251. ##
    252. # password_hashing_module = rabbit_password_hashing_md5
    253. ##
    254. ## Default User / VHost
    255. ## ====================
    256. ##
    257. ## On first start RabbitMQ will create a vhost and a user. These
    258. ## config items control what gets created.
    259. ## Relevant doc guide: https://rabbitmq.com/access-control.html
    260. ##
    261. # default_vhost = /
    262. # default_user = guest
    263. # default_pass = guest
    264. # default_permissions.configure = .*
    265. # default_permissions.read = .*
    266. # default_permissions.write = .*
    267. ## Tags for default user
    268. ##
    269. ## For more details about tags, see the documentation for the
    270. ## Management Plugin at https://rabbitmq.com/management.html.
    271. ##
    272. # default_user_tags.administrator = true
    273. ## Define other tags like this:
    274. # default_user_tags.management = true
    275. # default_user_tags.custom_tag = true
    276. ##
    277. ## Additional network and protocol related configuration
    278. ## =====================================================
    279. ##
    280. ## Set the server AMQP 0-9-1 heartbeat timeout in seconds.
    281. ## RabbitMQ nodes will send heartbeat frames at roughly
    282. ## the (timeout / 2) interval. Two missed heartbeats from
    283. ## a client will close its connection.
    284. ##
    285. ## Values lower than 6 seconds are very likely to produce
    286. ## false positives and are not recommended.
    287. ##
    288. ## Related doc guides:
    289. ##
    290. ## * https://rabbitmq.com/heartbeats.html
    291. ## * https://rabbitmq.com/networking.html
    292. ##
    293. # heartbeat = 60
    294. ## Set the max permissible size of an AMQP frame (in bytes).
    295. ##
    296. # frame_max = 131072
    297. ## Set the max frame size the server will accept before connection
    298. ## tuning occurs
    299. ##
    300. # initial_frame_max = 4096
    301. ## Set the max permissible number of channels per connection.
    302. ## 0 means "no limit".
    303. ##
    304. # channel_max = 128
    305. ## Customising TCP Listener (Socket) Configuration.
    306. ##
    307. ## Related doc guides:
    308. ##
    309. ## * https://rabbitmq.com/networking.html
    310. ## * https://www.erlang.org/doc/man/inet.html#setopts-2
    311. ##
    312. # tcp_listen_options.backlog = 128
    313. # tcp_listen_options.nodelay = true
    314. # tcp_listen_options.exit_on_close = false
    315. #
    316. # tcp_listen_options.keepalive = true
    317. # tcp_listen_options.send_timeout = 15000
    318. #
    319. # tcp_listen_options.buffer = 196608
    320. # tcp_listen_options.sndbuf = 196608
    321. # tcp_listen_options.recbuf = 196608
    322. ##
    323. ## Resource Limits & Flow Control
    324. ## ==============================
    325. ##
    326. ## Related doc guide: https://rabbitmq.com/memory.html.
    327. ## Memory-based Flow Control threshold.
    328. ##
    329. # vm_memory_high_watermark.relative = 0.4
    330. ## Alternatively, we can set a limit (in bytes) of RAM used by the node.
    331. ##
    332. # vm_memory_high_watermark.absolute = 1073741824
    333. ## Or you can set absolute value using memory units (with RabbitMQ 3.6.0+).
    334. ## Absolute watermark will be ignored if relative is defined!
    335. ##
    336. # vm_memory_high_watermark.absolute = 2GB
    337. ##
    338. ## Supported unit symbols:
    339. ##
    340. ## k, kiB: kibibytes (2^10 - 1,024 bytes)
    341. ## M, MiB: mebibytes (2^20 - 1,048,576 bytes)
    342. ## G, GiB: gibibytes (2^30 - 1,073,741,824 bytes)
    343. ## kB: kilobytes (10^3 - 1,000 bytes)
    344. ## MB: megabytes (10^6 - 1,000,000 bytes)
    345. ## GB: gigabytes (10^9 - 1,000,000,000 bytes)
    346. ## Fraction of the high watermark limit at which queues start to
    347. ## page message out to disc in order to free up memory.
    348. ## For example, when vm_memory_high_watermark is set to 0.4 and this value is set to 0.5,
    349. ## paging can begin as early as when 20% of total available RAM is used by the node.
    350. ##
    351. ## Values greater than 1.0 can be dangerous and should be used carefully.
    352. ##
    353. ## One alternative to this is to use durable queues and publish messages
    354. ## as persistent (delivery mode = 2). With this combination queues will
    355. ## move messages to disk much more rapidly.
    356. ##
    357. ## Another alternative is to configure queues to page all messages (both
    358. ## persistent and transient) to disk as quickly
    359. ## as possible, see https://rabbitmq.com/lazy-queues.html.
    360. ##
    361. # vm_memory_high_watermark_paging_ratio = 0.5
    362. ## Selects Erlang VM memory consumption calculation strategy. Can be `allocated`, `rss` or `legacy` (aliased as `erlang`),
    363. ## Introduced in 3.6.11. `rss` is the default as of 3.6.12.
    364. ## See https://github.com/rabbitmq/rabbitmq-server/issues/1223 and rabbitmq/rabbitmq-common#224 for background.
    365. # vm_memory_calculation_strategy = rss
    366. ## Interval (in milliseconds) at which we perform the check of the memory
    367. ## levels against the watermarks.
    368. ##
    369. # memory_monitor_interval = 2500
    370. ## The total memory available can be calculated from the OS resources
    371. ## - default option - or provided as a configuration parameter.
    372. # total_memory_available_override_value = 2GB
    373. ## Set disk free limit (in bytes). Once free disk space reaches this
    374. ## lower bound, a disk alarm will be set - see the documentation
    375. ## listed above for more details.
    376. ##
    377. ## Absolute watermark will be ignored if relative is defined!
    378. # disk_free_limit.absolute = 50000
    379. ## Or you can set it using memory units (same as in vm_memory_high_watermark)
    380. ## with RabbitMQ 3.6.0+.
    381. # disk_free_limit.absolute = 500KB
    382. # disk_free_limit.absolute = 50mb
    383. # disk_free_limit.absolute = 5GB
    384. ## Alternatively, we can set a limit relative to total available RAM.
    385. ##
    386. ## Values lower than 1.0 can be dangerous and should be used carefully.
    387. # disk_free_limit.relative = 2.0
    388. ##
    389. ## Clustering
    390. ## =====================
    391. ##
    392. # cluster_partition_handling = ignore
    393. ## Pauses all nodes on the minority side of a partition. The cluster
    394. ## MUST have an odd number of nodes (3, 5, etc)
    395. # cluster_partition_handling = pause_minority
    396. ## pause_if_all_down strategy require additional configuration
    397. # cluster_partition_handling = pause_if_all_down
    398. ## Recover strategy. Can be either 'autoheal' or 'ignore'
    399. # cluster_partition_handling.pause_if_all_down.recover = ignore
    400. ## Node names to check
    401. # cluster_partition_handling.pause_if_all_down.nodes.1 = rabbit@localhost
    402. # cluster_partition_handling.pause_if_all_down.nodes.2 = hare@localhost
    403. ## Mirror sync batch size, in messages. Increasing this will speed
    404. ## up syncing but total batch size in bytes must not exceed 2 GiB.
    405. ## Available in RabbitMQ 3.6.0 or later.
    406. ##
    407. # mirroring_sync_batch_size = 4096
    408. ## Make clustering happen *automatically* at startup. Only applied
    409. ## to nodes that have just been reset or started for the first time.
    410. ##
    411. ## Relevant doc guide: https://rabbitmq.com//cluster-formation.html
    412. ##
    413. ###这里设置集群,所有节点必须保持一致,当然也可以按照前面命令的方式进行设置
    414. # cluster_formation.peer_discovery_backend = rabbit_peer_discovery_classic_config
    415. #
    416. # cluster_formation.classic_config.nodes.1 = rabbit1@hostname
    417. # cluster_formation.classic_config.nodes.2 = rabbit2@hostname
    418. # cluster_formation.classic_config.nodes.3 = rabbit3@hostname
    419. # cluster_formation.classic_config.nodes.4 = rabbit4@hostname
    420. ## DNS-based peer discovery. This backend will list A records
    421. ## of the configured hostname and perform reverse lookups for
    422. ## the addresses returned.
    423. # cluster_formation.peer_discovery_backend = rabbit_peer_discovery_dns
    424. # cluster_formation.dns.hostname = discovery.eng.example.local
    425. ## This node's type can be configured. If you are not sure
    426. ## what node type to use, always use 'disc'.
    427. # cluster_formation.node_type = disc
    428. ## Interval (in milliseconds) at which we send keepalive messages
    429. ## to other cluster members. Note that this is not the same thing
    430. ## as net_ticktime; missed keepalive messages will not cause nodes
    431. ## to be considered down.
    432. ##
    433. # cluster_keepalive_interval = 10000
    434. ##
    435. ## Statistics Collection
    436. ## =====================
    437. ##
    438. ## Statistics collection interval (in milliseconds). Increasing
    439. ## this will reduce the load on management database.
    440. ##
    441. # collect_statistics_interval = 5000
    442. ## Fine vs. coarse statistics
    443. #
    444. # This value is no longer meant to be configured directly.
    445. #
    446. # See https://www.rabbitmq.com/management.html#fine-stats.
    447. ##
    448. ## Ra Settings
    449. ## =====================
    450. ##
    451. # raft.segment_max_entries = 65536
    452. # raft.wal_max_size_bytes = 1048576
    453. # raft.wal_max_batch_size = 4096
    454. # raft.snapshot_chunk_size = 1000000
    455. ##
    456. ## Misc/Advanced Options
    457. ## =====================
    458. ##
    459. ## NB: Change these only if you understand what you are doing!
    460. ##
    461. ## Timeout used when waiting for Mnesia tables in a cluster to
    462. ## become available.
    463. ##
    464. # mnesia_table_loading_retry_timeout = 30000
    465. ## Retries when waiting for Mnesia tables in the cluster startup. Note that
    466. ## this setting is not applied to Mnesia upgrades or node deletions.
    467. ##
    468. # mnesia_table_loading_retry_limit = 10
    469. ## Size in bytes below which to embed messages in the queue index.
    470. ## Related doc guide: https://rabbitmq.com/persistence-conf.html
    471. ##
    472. # queue_index_embed_msgs_below = 4096
    473. ## You can also set this size in memory units
    474. ##
    475. # queue_index_embed_msgs_below = 4kb
    476. ## Whether or not to enable background periodic forced GC runs for all
    477. ## Erlang processes on the node in "waiting" state.
    478. ##
    479. ## Disabling background GC may reduce latency for client operations,
    480. ## keeping it enabled may reduce median RAM usage by the binary heap
    481. ## (see https://www.erlang-solutions.com/blog/erlang-garbage-collector.html).
    482. ##
    483. ## Before trying this option, please take a look at the memory
    484. ## breakdown (https://www.rabbitmq.com/memory-use.html).
    485. ##
    486. # background_gc_enabled = false
    487. ## Target (desired) interval (in milliseconds) at which we run background GC.
    488. ## The actual interval will vary depending on how long it takes to execute
    489. ## the operation (can be higher than this interval). Values less than
    490. ## 30000 milliseconds are not recommended.
    491. ##
    492. # background_gc_target_interval = 60000
    493. ## Whether or not to enable proxy protocol support.
    494. ## Once enabled, clients cannot directly connect to the broker
    495. ## anymore. They must connect through a load balancer that sends the
    496. ## proxy protocol header to the broker at connection time.
    497. ## This setting applies only to AMQP clients, other protocols
    498. ## like MQTT or STOMP have their own setting to enable proxy protocol.
    499. ## See the plugins documentation for more information.
    500. ##
    501. # proxy_protocol = false
    502. ## Overriden product name and version.
    503. ## They are set to "RabbitMQ" and the release version by default.
    504. # product.name = RabbitMQ
    505. # product.version = 1.2.3
    506. ## "Message of the day" file.
    507. ## Its content is used to expand the logged and printed banners.
    508. ## Default to /etc/rabbitmq/motd on Unix, %APPDATA%\RabbitMQ\motd.txt
    509. ## on Windows.
    510. # motd_file = /etc/rabbitmq/motd
    511. ## Consumer timeout
    512. ## If a message delivered to a consumer has not been acknowledge before this timer
    513. ## triggers the channel will be force closed by the broker. This ensure that
    514. ## faultly consumers that never ack will not hold on to messages indefinitely.
    515. ##
    516. # consumer_timeout = 900000
    517. ## ----------------------------------------------------------------------------
    518. ## Advanced Erlang Networking/Clustering Options.
    519. ##
    520. ## Related doc guide: https://rabbitmq.com/clustering.html
    521. ## ----------------------------------------------------------------------------
    522. # ======================================
    523. # Kernel section
    524. # ======================================
    525. ## Timeout used to detect peer unavailability, including CLI tools.
    526. ## Related doc guide: https://www.rabbitmq.com/nettick.html.
    527. ##
    528. # net_ticktime = 60
    529. ## Inter-node communication port range.
    530. ## The parameters inet_dist_listen_min and inet_dist_listen_max
    531. ## can be configured in the classic config format only.
    532. ## Related doc guide: https://www.rabbitmq.com/networking.html#epmd-inet-dist-port-range.
    533. ## ----------------------------------------------------------------------------
    534. ## RabbitMQ Management Plugin
    535. ##
    536. ## Related doc guide: https://rabbitmq.com/management.html.
    537. ## ----------------------------------------------------------------------------
    538. # =======================================
    539. # Management section
    540. # =======================================
    541. ## Preload schema definitions from the following JSON file.
    542. ## Related doc guide: https://rabbitmq.com/management.html#load-definitions.
    543. ##
    544. # management.load_definitions = /path/to/exported/definitions.json
    545. ## Log all requests to the management HTTP API to a file.
    546. ##
    547. # management.http_log_dir = /path/to/access.log
    548. ##这里就是web插件的访问地址和端口设置了,变更后访问地址也要跟着变更才能访问到
    549. ## HTTP listener and embedded Web server settings.
    550. # ## See https://rabbitmq.com/management.html for details.
    551. #
    552. # management.tcp.port = 15672
    553. # management.tcp.ip = 0.0.0.0
    554. #
    555. # management.tcp.shutdown_timeout = 7000
    556. # management.tcp.max_keepalive = 120
    557. # management.tcp.idle_timeout = 120
    558. # management.tcp.inactivity_timeout = 120
    559. # management.tcp.request_timeout = 120
    560. # management.tcp.compress = true
    561. ##https配置,一般内网我们就不配置了,外网可以做url重写
    562. ## HTTPS listener settings.
    563. ## See https://rabbitmq.com/management.html and https://rabbitmq.com/ssl.html for details.
    564. ##
    565. # management.ssl.port = 15671
    566. # management.ssl.cacertfile = /path/to/ca_certificate.pem
    567. # management.ssl.certfile = /path/to/server_certificate.pem
    568. # management.ssl.keyfile = /path/to/server_key.pem
    569. ## More TLS options
    570. # management.ssl.honor_cipher_order = true
    571. # management.ssl.honor_ecc_order = true
    572. ## These are highly recommended for TLSv1.2 but cannot be used
    573. ## with TLSv1.3. If TLSv1.3 is enabled, these lines MUST be removed.
    574. # management.ssl.client_renegotiation = false
    575. # management.ssl.secure_renegotiate = true
    576. ## Supported TLS versions
    577. # management.ssl.versions.1 = tlsv1.2
    578. ## Cipher suites the server is allowed to use
    579. # management.ssl.ciphers.1 = ECDHE-ECDSA-AES256-GCM-SHA384
    580. # management.ssl.ciphers.2 = ECDHE-RSA-AES256-GCM-SHA384
    581. # management.ssl.ciphers.3 = ECDHE-ECDSA-AES256-SHA384
    582. # management.ssl.ciphers.4 = ECDHE-RSA-AES256-SHA384
    583. # management.ssl.ciphers.5 = ECDH-ECDSA-AES256-GCM-SHA384
    584. # management.ssl.ciphers.6 = ECDH-RSA-AES256-GCM-SHA384
    585. # management.ssl.ciphers.7 = ECDH-ECDSA-AES256-SHA384
    586. # management.ssl.ciphers.8 = ECDH-RSA-AES256-SHA384
    587. # management.ssl.ciphers.9 = DHE-RSA-AES256-GCM-SHA384
    588. ## URL path prefix for HTTP API and management UI
    589. # management.path_prefix = /a-prefix
    590. ## One of 'basic', 'detailed' or 'none'. See
    591. ## https://rabbitmq.com/management.html#fine-stats for more details.
    592. # management.rates_mode = basic
    593. ## Configure how long aggregated data (such as message rates and queue
    594. ## lengths) is retained. Please read the plugin's documentation in
    595. ## https://rabbitmq.com/management.html#configuration for more
    596. ## details.
    597. ## Your can use 'minute', 'hour' and 'day' keys or integer key (in seconds)
    598. # management.sample_retention_policies.global.minute = 5
    599. # management.sample_retention_policies.global.hour = 60
    600. # management.sample_retention_policies.global.day = 1200
    601. # management.sample_retention_policies.basic.minute = 5
    602. # management.sample_retention_policies.basic.hour = 60
    603. # management.sample_retention_policies.detailed.10 = 5
    604. ## ----------------------------------------------------------------------------
    605. ## RabbitMQ Shovel Plugin
    606. ##
    607. ## Related doc guide: https://rabbitmq.com/shovel.html
    608. ## ----------------------------------------------------------------------------
    609. ## See advanced.config.example for a Shovel plugin example
    610. ## ----------------------------------------------------------------------------
    611. ## RabbitMQ STOMP Plugin
    612. ##
    613. ## Related doc guide: https://rabbitmq.com/stomp.html
    614. ## ----------------------------------------------------------------------------
    615. # =======================================
    616. # STOMP section
    617. # =======================================
    618. ## See https://rabbitmq.com/stomp.html for details.
    619. ## TCP listeners.
    620. ##
    621. # stomp.listeners.tcp.1 = 127.0.0.1:61613
    622. # stomp.listeners.tcp.2 = ::1:61613
    623. ## TCP listener settings
    624. ##
    625. # stomp.tcp_listen_options.backlog = 2048
    626. # stomp.tcp_listen_options.recbuf = 131072
    627. # stomp.tcp_listen_options.sndbuf = 131072
    628. #
    629. # stomp.tcp_listen_options.keepalive = true
    630. # stomp.tcp_listen_options.nodelay = true
    631. #
    632. # stomp.tcp_listen_options.exit_on_close = true
    633. # stomp.tcp_listen_options.send_timeout = 120
    634. ## Proxy protocol support
    635. ##
    636. # stomp.proxy_protocol = false
    637. ## TLS listeners
    638. ## See https://rabbitmq.com/stomp.html and https://rabbitmq.com/ssl.html for details.
    639. # stomp.listeners.ssl.default = 61614
    640. #
    641. # ssl_options.cacertfile = path/to/cacert.pem
    642. # ssl_options.certfile = path/to/cert.pem
    643. # ssl_options.keyfile = path/to/key.pem
    644. # ssl_options.verify = verify_peer
    645. # ssl_options.fail_if_no_peer_cert = true
    646. ## Number of Erlang processes that will accept connections for the TCP
    647. ## and TLS listeners.
    648. ##
    649. # stomp.num_acceptors.tcp = 10
    650. # stomp.num_acceptors.ssl = 1
    651. ## Additional TLS options
    652. ## Extract a name from the client's certificate when using TLS.
    653. ##
    654. # stomp.ssl_cert_login = true
    655. ## Set a default user name and password. This is used as the default login
    656. ## whenever a CONNECT frame omits the login and passcode headers.
    657. ##
    658. ## Please note that setting this will allow clients to connect without
    659. ## authenticating!
    660. ##
    661. # stomp.default_user = guest
    662. # stomp.default_pass = guest
    663. ## If a default user is configured, or you have configured use TLS client
    664. ## certificate based authentication, you can choose to allow clients to
    665. ## omit the CONNECT frame entirely. If set to true, the client is
    666. ## automatically connected as the default user or user supplied in the
    667. ## TLS certificate whenever the first frame sent on a session is not a
    668. ## CONNECT frame.
    669. ##
    670. # stomp.implicit_connect = true
    671. ## Whether or not to enable proxy protocol support.
    672. ## Once enabled, clients cannot directly connect to the broker
    673. ## anymore. They must connect through a load balancer that sends the
    674. ## proxy protocol header to the broker at connection time.
    675. ## This setting applies only to STOMP clients, other protocols
    676. ## like MQTT or AMQP have their own setting to enable proxy protocol.
    677. ## See the plugins or broker documentation for more information.
    678. ##
    679. # stomp.proxy_protocol = false
    680. ## ----------------------------------------------------------------------------
    681. ## RabbitMQ MQTT Adapter
    682. ##
    683. ## See https://github.com/rabbitmq/rabbitmq-mqtt/blob/stable/README.md
    684. ## for details
    685. ## ----------------------------------------------------------------------------
    686. # =======================================
    687. # MQTT section
    688. # =======================================
    689. ## TCP listener settings.
    690. ##
    691. # mqtt.listeners.tcp.1 = 127.0.0.1:61613
    692. # mqtt.listeners.tcp.2 = ::1:61613
    693. ## TCP listener options (as per the broker configuration).
    694. ##
    695. # mqtt.tcp_listen_options.backlog = 4096
    696. # mqtt.tcp_listen_options.recbuf = 131072
    697. # mqtt.tcp_listen_options.sndbuf = 131072
    698. #
    699. # mqtt.tcp_listen_options.keepalive = true
    700. # mqtt.tcp_listen_options.nodelay = true
    701. #
    702. # mqtt.tcp_listen_options.exit_on_close = true
    703. # mqtt.tcp_listen_options.send_timeout = 120
    704. ## TLS listener settings
    705. ## ## See https://rabbitmq.com/mqtt.html and https://rabbitmq.com/ssl.html for details.
    706. #
    707. # mqtt.listeners.ssl.default = 8883
    708. #
    709. # ssl_options.cacertfile = /path/to/tls/ca_certificate_bundle.pem
    710. # ssl_options.certfile = /path/to/tls/server_certificate.pem
    711. # ssl_options.keyfile = /path/to/tls/server_key.pem
    712. # ssl_options.verify = verify_peer
    713. # ssl_options.fail_if_no_peer_cert = true
    714. #
    715. ## Number of Erlang processes that will accept connections for the TCP
    716. ## and TLS listeners.
    717. ##
    718. # mqtt.num_acceptors.tcp = 10
    719. # mqtt.num_acceptors.ssl = 10
    720. ## Whether or not to enable proxy protocol support.
    721. ## Once enabled, clients cannot directly connect to the broker
    722. ## anymore. They must connect through a load balancer that sends the
    723. ## proxy protocol header to the broker at connection time.
    724. ## This setting applies only to STOMP clients, other protocols
    725. ## like STOMP or AMQP have their own setting to enable proxy protocol.
    726. ## See the plugins or broker documentation for more information.
    727. ##
    728. # mqtt.proxy_protocol = false
    729. ## Set the default user name and password used for anonymous connections (when client
    730. ## provides no credentials). Anonymous connections are highly discouraged!
    731. ##
    732. # mqtt.default_user = guest
    733. # mqtt.default_pass = guest
    734. ## Enable anonymous connections. If this is set to false, clients MUST provide
    735. ## credentials in order to connect. See also the mqtt.default_user/mqtt.default_pass
    736. ## keys. Anonymous connections are highly discouraged!
    737. ##
    738. # mqtt.allow_anonymous = true
    739. ## If you have multiple vhosts, specify the one to which the
    740. ## adapter connects.
    741. ##
    742. # mqtt.vhost = /
    743. ## Specify the exchange to which messages from MQTT clients are published.
    744. ##
    745. # mqtt.exchange = amq.topic
    746. ## Specify TTL (time to live) to control the lifetime of non-clean sessions.
    747. ##
    748. # mqtt.subscription_ttl = 1800000
    749. ## Set the prefetch count (governing the maximum number of unacknowledged
    750. ## messages that will be delivered).
    751. ##
    752. # mqtt.prefetch = 10
    753. ## ----------------------------------------------------------------------------
    754. ## RabbitMQ AMQP 1.0 Support
    755. ##
    756. ## See https://github.com/rabbitmq/rabbitmq-amqp1.0/blob/stable/README.md.
    757. ## ----------------------------------------------------------------------------
    758. # =======================================
    759. # AMQP 1.0 section
    760. # =======================================
    761. ## Connections that are not authenticated with SASL will connect as this
    762. ## account. See the README for more information.
    763. ##
    764. ## Please note that setting this will allow clients to connect without
    765. ## authenticating!
    766. ##
    767. # amqp1_0.default_user = guest
    768. ## Enable protocol strict mode. See the README for more information.
    769. ##
    770. # amqp1_0.protocol_strict_mode = false
    771. ## Logging settings.
    772. ##
    773. ## See https://rabbitmq.com/logging.html for details.
    774. ##
    775. ## Log directory, taken from the RABBITMQ_LOG_BASE env variable by default.
    776. ##
    777. # log.dir = /var/log/rabbitmq
    778. ## Logging to file. Can be false or a filename.
    779. ## Default:
    780. # log.file = rabbit.log
    781. ## To disable logging to a file
    782. # log.file = false
    783. ## Log level for file logging
    784. ##
    785. # log.file.level = info
    786. ## File rotation config. No rotation by default.
    787. ## DO NOT SET rotation date to ''. Leave the value unset if "" is the desired value
    788. # log.file.rotation.date = $D0
    789. # log.file.rotation.size = 0
    790. ## Logging to console (can be true or false)
    791. ##
    792. # log.console = false
    793. ## Log level for console logging
    794. ##
    795. # log.console.level = info
    796. ## Logging to the amq.rabbitmq.log exchange (can be true or false)
    797. ##
    798. # log.exchange = false
    799. ## Log level to use when logging to the amq.rabbitmq.log exchange
    800. ##
    801. # log.exchange.level = info
    802. ## ----------------------------------------------------------------------------
    803. ## RabbitMQ LDAP Plugin
    804. ##
    805. ## Related doc guide: https://rabbitmq.com/ldap.html.
    806. ##
    807. ## ----------------------------------------------------------------------------
    808. # =======================================
    809. # LDAP section
    810. # =======================================
    811. ##
    812. ## Connecting to the LDAP server(s)
    813. ## ================================
    814. ##
    815. ## Specify servers to bind to. You *must* set this in order for the plugin
    816. ## to work properly.
    817. ##
    818. # auth_ldap.servers.1 = your-server-name-goes-here
    819. ## You can define multiple servers
    820. # auth_ldap.servers.2 = your-other-server
    821. ## Connect to the LDAP server using TLS
    822. ##
    823. # auth_ldap.use_ssl = false
    824. ## Specify the LDAP port to connect to
    825. ##
    826. # auth_ldap.port = 389
    827. ## LDAP connection timeout, in milliseconds or 'infinity'
    828. ##
    829. # auth_ldap.timeout = infinity
    830. ## Or number
    831. # auth_ldap.timeout = 500
    832. ## Enable logging of LDAP queries.
    833. ## One of
    834. ## - false (no logging is performed)
    835. ## - true (verbose logging of the logic used by the plugin)
    836. ## - network (as true, but additionally logs LDAP network traffic)
    837. ##
    838. ## Defaults to false.
    839. ##
    840. # auth_ldap.log = false
    841. ## Also can be true or network
    842. # auth_ldap.log = true
    843. # auth_ldap.log = network
    844. ##
    845. ## Authentication
    846. ## ==============
    847. ##
    848. ## Pattern to convert the username given through AMQP to a DN before
    849. ## binding
    850. ##
    851. # auth_ldap.user_dn_pattern = cn=${username},ou=People,dc=example,dc=com
    852. ## Alternatively, you can convert a username to a Distinguished
    853. ## Name via an LDAP lookup after binding. See the documentation for
    854. ## full details.
    855. ## When converting a username to a dn via a lookup, set these to
    856. ## the name of the attribute that represents the user name, and the
    857. ## base DN for the lookup query.
    858. ##
    859. # auth_ldap.dn_lookup_attribute = userPrincipalName
    860. # auth_ldap.dn_lookup_base = DC=gopivotal,DC=com
    861. ## Controls how to bind for authorisation queries and also to
    862. ## retrieve the details of users logging in without presenting a
    863. ## password (e.g., SASL EXTERNAL).
    864. ## One of
    865. ## - as_user (to bind as the authenticated user - requires a password)
    866. ## - anon (to bind anonymously)
    867. ## - {UserDN, Password} (to bind with a specified user name and password)
    868. ##
    869. ## Defaults to 'as_user'.
    870. ##
    871. # auth_ldap.other_bind = as_user
    872. ## Or can be more complex:
    873. # auth_ldap.other_bind.user_dn = User
    874. # auth_ldap.other_bind.password = Password
    875. ## If user_dn and password defined - other options is ignored.
    876. # -----------------------------
    877. # Too complex section of LDAP
    878. # -----------------------------
    879. ##
    880. ## Authorisation
    881. ## =============
    882. ##
    883. ## The LDAP plugin can perform a variety of queries against your
    884. ## LDAP server to determine questions of authorisation.
    885. ##
    886. ## Related doc guide: https://rabbitmq.com/ldap.html#authorisation.
    887. ## Following configuration should be defined in advanced.config file
    888. ## DO NOT UNCOMMENT THESE LINES!
    889. ## Set the query to use when determining vhost access
    890. ##
    891. ## {vhost_access_query, {in_group,
    892. ## "ou=${vhost}-users,ou=vhosts,dc=example,dc=com"}},
    893. ## Set the query to use when determining resource (e.g., queue) access
    894. ##
    895. ## {resource_access_query, {constant, true}},
    896. ## Set queries to determine which tags a user has
    897. ##
    898. ## {tag_queries, []}
    899. # ]},
    900. # -----------------------------

  • 相关阅读:
    深度概括:这应该是介绍时序异常检测最全的了
    智能优化算法Matlab源码大礼包领取
    【华为机试题 HJ108】求最小公倍数
    基于Socket编程Java和mysql实现的简易微信设计
    【pyhton案例01】:5个有趣练习
    【Python21天学习挑战赛】-爬虫(B站)程序示例
    CentOS7.9 安装postgresql
    动态顺序串的基本实现
    ROS 导航
    开放式激光振镜运动控制器(一):ZMC408SCAN接口与功能
  • 原文地址:https://blog.csdn.net/zrc_xiaoguo/article/details/134199812