【问题标题】:Solr last_index_time difference timezone format so output is wrongSolr last_index_time 时差时区格式所以输出错误
【发布时间】:2016-09-23 23:29:29
【问题描述】:

几天前我开始研究 solr,而今天我遇到了 deltaQuery 的问题。 我的服务器时区是 IST,mysql 也在 IST 中提供默认输出。 但 solr dataimport.properties 文件以 UTC 存储时区。

问题是当我选择查询B.modified_on >'${dataimporter.last_index_time}' 时,由于时区而导致时间比较错误。 solr 日志是:- B.modified_on>'2016-09-23 07:39:10' 并且服务器时间是。 $日期 2016 年 9 月 23 日星期五 15:22:20 IST

请建议如何在 IST 或任何其他答案中更改 solr 时区。我不能我的 linux 服务器时区。

【问题讨论】:

  • 有人已经问过这个问题了。检查这个链接stackoverflow.com/questions/39576281/…
  • 我不明白为什么要选择不同的格式,因为日志也写在不同的时区。
  • 原因是因为服务器的时钟始终应该是 UTC,然后时间戳会根据日志记录工具设置转换为本地 TZ。它没有选择不同的格式 - 它明确没有选择任何东西,只是将其保持为 UTC。

标签: solr


【解决方案1】:

Solr 日志默认采用 UTC。要将其更改为 IST,请编辑 solr.in.sh 文件以包含以下行:

# By default the start script uses UTC; override the timezone if needed

SOLR_TIMEZONE="IST"

【讨论】:

  • 哦,是的,我已将 bin/solr 文件更改为 SOLR_TIMEZONE=date '+%Z'。谢谢。
【解决方案2】:

你可以使用MySQL中的CONVERT_TZ函数来convert a datetime field to UTC

CONVERT_TZ(B.modified_on, 'IST', 'UTC') > '${dataimporter.last_index_time}'

.. 应该可以。在 MySQL 命令行会话中尝试一下,看看你得到了正确的 UTC 时间。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-28
    • 2014-01-29
    • 2016-06-21
    • 1970-01-01
    • 1970-01-01
    • 2012-04-01
    相关资源
    最近更新 更多