首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何自动重新启动Opensolaris/OmniOS服务/守护进程,记录通知,但不记录syslog的关键错误?

如何自动重新启动Opensolaris/OmniOS服务/守护进程,记录通知,但不记录syslog的关键错误?
EN

Server Fault用户
提问于 2016-09-06 09:17:39
回答 1查看 739关注 0票数 3

以下问题可以看作是与CIFS/AD相关的问题(特定视图),或者是关于服务重新启动、错误处理和日志解析的问题(一般视图)。我将在这里介绍这两个领域,但很高兴收到其中任何一个方面的答案(只需跳过您不感兴趣的部分)。

特定情况: idmap不定期为域控制器

重新扫描

在Windows 2008兼容的Active中,通常存在多个域控制器以实现高可用性。如果所有这些服务器同时不可用,并且具有活动内核SMB/CIFS服务器的OmniOS (r151018)文件服务器(成功地连接到域并按预期工作)启动,则会发生以下情况:

idmap服务试图到达一个DC 60秒,然后放弃.

代码语言:javascript
复制
root@omnios:/root# tail -n 20 /var/svc/log/system-idmap:default.log
@ Tue Sep  6 10:19:42 2016
Global Catalog servers not configured/discoverable
Domain controller servers not configured/discoverable
created thread ID 3 - 1 threads currently active
[ Sep  6 10:19:42 Method "start" exited with status 0. ]
@ Tue Sep  6 10:19:53 2016
created thread ID 4 - 2 threads currently active
getdcname wait begin
@ Tue Sep  6 10:19:57 2016
DNS: _ldap._tcp.dc._msdcs.testdomain.intranet: Host name lookup failure
@ Tue Sep  6 10:20:08 2016
getdcname timeout
@ Tue Sep  6 10:20:12 2016
DNS: _ldap._tcp.dc._msdcs.testdomain.intranet: Host name lookup failure
@ Tue Sep  6 10:20:27 2016
DNS: _ldap._tcp.dc._msdcs.testdomain.intranet: Host name lookup failure
@ Tue Sep  6 10:20:42 2016
DNS: _ldap._tcp.dc._msdcs.testdomain.intranet: Host name lookup failure
Domain discovery took 60 sec.
Check the DNS configuration.

..。但并不是关键的失败:

代码语言:javascript
复制
root@omnios:/root# svcs -xv idmap
svc:/system/idmap:default (Native Identity Mapping Service)
 State: online since Tue Sep  6 10:19:42 2016
   See: man -M /usr/share/man -s 1M idmapd
   See: man -M /usr/share/man -s 1M idmap
   See: /var/svc/log/system-idmap:default.log
Impact: None.

之后,smbd每分钟都在syslog中抱怨它找不到DC:

代码语言:javascript
复制
smbd[525]: [ID 510351 daemon.notice] smb_locate_dc status 0xc0000233
smbd[525]: [ID 199031 daemon.notice] smbd_dc_update: testdomain.intranet: locate failed

这种情况即使在DC恢复联机并可到达之后也仍然存在。通过使用idmap重新启动svcadm restart idmap,它立即开始工作。当然,由于这些故障可能是在没有计划的情况下发生的,所以不应该用手工进行。

  • 如何编写脚本重新启动idmap,以便在这些事件上自动发生?我确实尝试过使用SMF,但这似乎只适用于崩溃的服务,而idmap没有报告任何问题(而smbd只报告通知)。另一种可能是不断地监视日志文件和事件的grep,但在我看来,这似乎效率低下。我还试图将config/rediscovery_interval值减少到60秒,但它似乎被忽略了(或者在这里不适用)。
  • 或者,解决问题的方法是什么呢?不幸的是,我没有发现任何有用的东西,除了承认完全重启是如何解决问题的帖子(因为idmap也是在那里重新启动的)。

编辑:只有svccfg -s idmap listprop的输出,我所做的改变是config/rediscovery_interval (默认的3600),ID被手动移除。

代码语言:javascript
复制
config                                           application
config/id_cache_timeout                          count    86400
config/list_size_limit                           count    0
config/name_cache_timeout                        count    604800
config/preferred_dc                              astring
config/stability                                 astring  Unstable
config/use_ads                                   boolean  true
config/use_lsa                                   boolean  true
config/value_authorization                       astring  solaris.smf.value.idmap
config/machine_uuid                              astring  [...]
config/machine_sid                               astring  [...]
config/rediscovery_interval                      count    60
config/domain_name                               astring  testdomain.intranet
debug                                            application
debug/all                                        integer  0
debug/config                                     integer  0
debug/discovery                                  integer  0
debug/dns                                        integer  0
debug/ldap                                       integer  0
debug/mapping                                    integer  0
debug/stability                                  astring  Unstable
debug/value_authorization                        astring  solaris.smf.value.idmap
rpcbind                                          dependency
rpcbind/entities                                 fmri     svc:/network/rpc/bind
rpcbind/grouping                                 astring  require_all
rpcbind/restart_on                               astring  restart
rpcbind/type                                     astring  service
filesystem-minimal                               dependency
filesystem-minimal/entities                      fmri     svc:/system/filesystem/minimal
filesystem-minimal/grouping                      astring  require_all
filesystem-minimal/restart_on                    astring  error
filesystem-minimal/type                          astring  service
manifestfiles                                    framework
manifestfiles/lib_svc_manifest_system_idmap_xml  astring  /lib/svc/manifest/system/idmap.xml
general                                          framework
general/action_authorization                     astring  solaris.smf.manage.idmap
general/entity_stability                         astring  Unstable
general/single_instance                          boolean  true
general/value_authorization                      astring  solaris.smf.manage.idmap
start                                            method
start/exec                                       astring  /usr/lib/idmapd
start/timeout_seconds                            count    60
start/type                                       astring  method
stop                                             method
stop/exec                                        astring  :kill
stop/timeout_seconds                             count    60
stop/type                                        astring  method
refresh                                          method
refresh/exec                                     astring  ":kill -HUP"
refresh/timeout_seconds                          count    60
refresh/type                                     astring  method
tm_common_name                                   template
tm_common_name/C                                 ustring  "Native Identity Mapping Service"
tm_man_idmapd1M                                  template
tm_man_idmapd1M/manpath                          astring  /usr/share/man
tm_man_idmapd1M/section                          astring  1M
tm_man_idmapd1M/title                            astring  idmapd
tm_man_idmap1M                                   template
tm_man_idmap1M/manpath                           astring  /usr/share/man
tm_man_idmap1M/section                           astring  1M
tm_man_idmap1M/title                             astring  idmap

通用问题:如果进程似乎正常运行,如何有效地对syslog消息作出反应?

这个问题可以推广到如何在Solaris上以最有效的方式查看日志文件的问题。我搜索并找到了几个工具,如swatchlogsurferlogwatcher或普通的老cron作业,它们每分钟执行一次,并连接到一个读取dmesg输出的简单脚本。

  • 这是唯一可行的方法,还是有更好的解决方案?
    • 是否有方法告诉SMF,某些进程上的某些通知应该满足操作,即使没有发生任何危急情况?
    • 我偶然发现了故障管理器FMA,但它似乎也只在关键条件下工作,而不只是在通知(或任何用户指定的字符串)上工作。这是正确的吗?

  • 如果这是唯一的方法,你会建议使用什么和为什么?
EN

回答 1

Server Fault用户

发布于 2019-02-12 20:44:55

谢谢你在这个问题上详细说明了这个问题。我最近也点击了它,但要注意的是,MS控制器是运行在(post-)OpenSolaris主机上的VM,并且随着该站点上Win/AD支持的减少,这是唯一幸存的副本。因此,当启动早期(并且idmap是导致多用户服务器的依赖树的一部分)时,VM还没有运行,idmap无法像您发布的那样联系它,smbd会抱怨。我想这比完全启动服务器要好得多,因为这是因为遇到了一个与AD有关的问题。

我认为,作为对您问题的直接回答,还有其他日志记录守护进程:)例如,如果日志消息与您设置的模式匹配,rsyslog可以触发命令。

由于SMF svc日志不是很有条理,我想我们必须为这种情况创建一个临时脚本,以检查/var/svc/ log /.中的特定日志文件。并重新启动服务。

此外,还可以执行延迟操作(例如,echo "svcadm restart idmap" | at now + 10min的init脚本),以便在启动后始终启动它,我猜这就是我在这里要做的。

最后,您可能会在VM启动脚本中添加一些活动,以便在VM启动后启动idmap (因此不依赖于纯硬编码的时间)--但它不是SMF依赖树的一部分,因为idmap在引导过程中非常早就需要.或者至少不是严格的依赖,而是像restart_on这样的东西.

票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/801292

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档