对于 MongoDB 3.6 版本的时区配置,可以通过以下步骤进行设置:
打开 MongoDB 的配置文件
/etc/mongod.conf。添加以下参数到
systemLog部分:
systemLog:
...
component:
...
timeZoneInfo: /usr/share/zoneinfo/<Zone>/<SubZone>
其中 <Zone> 和 <SubZone> 分别为你系统中的主时区和子时区信息。
在启动 mongod 时添加
--setParameter参数来指定时间戳的格式和时区信息。例如:mongod --setParameter "timeStampFormat=iso8601-utc" --setParameter "timeZoneInfo=/usr/share/zoneinfo/<Zone>/<SubZone>"如果你使用了 replica set,请在每个节点上重复以上操作。
最后,重启 mongod 服务使得配置生效。
希望以上内容能够解决你的问题。如果还有其他疑问,请随时提出。




