Chapter 5 Queue management 队列管理程序 qmgr 是整个postfix 的枢纽。 共设置五个不同用途的队列, queue_directory 设置队列队列的位置 一般是 /var/spool/postfix/ /var/spool/postfix/active/ 活动队列 /var/spool/postfix/incoming 输入队列 /var/spool/postfix/deferred/ 等待队列 /var/spool/postfix/corrupt/ 故障队列 /var/spool/postfix/hold/ 保留队列 通常情况下,qmgr 能自动管理这些队列,如需手工管理,可使用 postsuper和postqueue
5.1 How qmgr Works qmgr 将邮件移到活动队列,并选择适合的MDA来投递,如果一切顺利,你会看不见邮件停留在活动队列里面,除非postfix正在连接一个特别慢的系统,超过30秒无法链接,Postfix便会认为暂时不可达 暂时无法送达的邮件会被放到 defered queue 5.1.1 Deferred Mail 留在defered queue 里面的邮件,会等待被成功投递,或者因为超时而被退回给原寄件人。退信通知函和遭退邮件的总和大小不得超过 bounce_size_limit ,如果超过,就只会收到 退信函,而没有原始邮件 5.1.2 Queue Scheduling 队列调度 maximal_queue_lifetime 限定一封邮件最多在 defered queue 里面的最长时间,如果超过这个时间,就退回给发件人 如果希望第一次失败就退回给发件人,可以设置为0 queue_run_delay 决定多长时间 postfix 检查一次 defered queue, postfix重新投递等待邮件的频度上下线,由 maximal_backoff_time 和 minimal_backoff_time,每次邮件投递失败都增加下次投递的时间,但最长只能到maximal_backoff_time,最短是minimal_backoff_time 5.1.3 Message Delivery 大部分的的MDA都有能力同时投递多封邮件到到同一目的地,但是收信系统不一定有次能力,postfix使用如下调度算法 MDA第一次只能同时送出 initial_destination_concurrency 封邮件,如果成功,第二次会增加数量,知道发现目的系统不能承担当前的符合,或是已经达到上限 default_destination_concurrency_limit ,可以适当的提高initial_destination_concurrency的值,但是不要超过maxproc postfix附带的mda,每个都带有一个mda_initial_destination_concurrency , mda_destination_concurrency_limit ,他们的优先级高于 initial_destination_concurrency, 和 default_destination_concurrency_limit , lmtp_initial_destination_concurrency = $initial_destination_concurrency default_destination_concurrency_limit = 20 lmtp_destination_recipient_limit = $default_destination_recipient_limit 用来限定最大的收件人数量 default_destination_concurrency_limit 和default_destination_recipient_limit 的区别在于,前者是本地MDA投递邮件的最大并发 后者是postfix 交给本地MDA是的最大收件人数。 5.1.4 Corrupt message 故障队列用于存储受损邮件,可以通过队列管理工具查看,如果这个里面邮件很多,通常是操作系统或者硬件故障的征兆 5.1.5 Error Notifications 错误通知函 Postfix 可发出错误通知函给 管理员 Postfix 将错误通知划分为 7大类 管理员可以设定 notify_classes 来决定要收哪些类型的错误通知
5.2 Queue Tools Postfix 提供队列管理的两个重要工具是 postsuper 和 postqueue 5.2.1 List the Queue postqueue -p 或者 mailq -Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
Queue ID 后面是 *号,表示这个邮件在 active queue ,!号表示在hold queue,什么都没有表示在 deferred queue 5.2.2 Deleting Messages postsuper -d DBA3F1A9 postsuper -d ALL 参数必须是大写的
5.2.3 Holding Messages hold queue 长期保留你想保存在队列里面的邮件,里面的邮件不会被投递 postsuper -h DBA3F1A9: 将邮件DBA3F1A9 挪入hold queue postsuper -H DBA3F1A9: 将邮件DBA3F1A9 挪回原有的队列
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient------- postsuper -r ALL postsuper -r DBA3F1A9 重排后queue id 会改变
5.2.5 Displaying Messages The postcat command displays the contents of a queue file: 5.2.6 Flushing Messages postqueue -f : 立即重新投递队列里面的滞留邮件 postqueue -s : 只投递fast_flush_domains 中定义的收件域的邮件 postqueue -s example.com : 只投递指定收信域的邮件
|
|