radondb / radondb-postgresql-operator

Apache License 2.0
41 stars 11 forks source link

How to specify the time zone configuration when creating a cluster? #21

Closed zhangao4833 closed 2 years ago

zhangao4833 commented 2 years ago

How to specify the time zone configuration when creating a cluster?Generally, the container can be specified with PGTZ environment variable, but I can't find the corresponding parameter configuration in the help document.

zhl003 commented 2 years ago

Default time zone base on your local machine, our container hasn't a parameter to specify timezone ,but this not a problem ,PG has very convenient way to set timezone for client or server side , example : session level / user level /db level just run SQL set timezone xxx or alter database xx set timezone =xxx if you want take effect after restart, you can edit the global config configmap like this :

kubectl edit cm -n pgo  demo-pgha-config
# Add below to data/demo-dcs-config/postgresql/parameters
        log_timezone : 'US/Pacific'
        timezone : 'US/Pacific'
then reload/restart postgresql cluster :
pgo reload demo -n pgo/pgo restart demo -n pgo