'There are 8 hours difference in two client of TDengine

We have an TDengine application. There are more than one clients, including Docker, Linux, and Windows.

I'm using interval(1d), but the time on Windows & Docker is different by 8 hours. I check the timezone setting, they are 'Asia/Shanghai' and Beijing Time. I can't tell what's may be the problem.



Solution 1:[1]

I believe when importing data time is converted based on timezone settings on client and on server just store the value of UTC timestamp. So once you query data on another client, the queried timestamp will be converted based on the timezone setting on that client too. Be careful when you query data based on timestamp make sure considering the time offset between two different. So its better to make consistent client timezone settings to mitigate unexpected result.

Solution 2:[2]

Be careful to set a TZ environment when you want to use TDengine database in docker or a kubernetes cluster.

Like this:

docker run --name tdengine -d -e TZ=Asia/Shanghai tdengine/tdengine

Recommend to use docker-compose to manage the runtime configurations for the TDengine container:

version: "3.7"

networks:
  td:
    external: true

services:
  tdengine:
    image: tdengine/tdengine:2.4.0.16
    networks:
      - td
    environment:
      TZ: Asia/Shanghai
      TAOS_FQDN: localhsot

Check the docker here https://taosdata.github.io/TDengine-Operator/en/2.2-tdengine-with-helm.html if you use TDengine in k8s.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 GeorgeWill93
Solution 2 zitsen