8种机械键盘轴体对比
本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选?
Postgresql 进行日志分析时发现,Pg数据库时间存在异常; Postgresql数据库时间与Linux服务器时间不一致
主要排查:postgresql.conf 加载timezone 问题
进入psql查看show time zone; select now();
查看系统date ; hwclock ;
设置ntp 时间同步
“系统时间” & “硬件时间”
系统时间: 一般说来就是我们执行 date 命令看到的时间,linux系统下所有的时间调用(除了直接访问硬件时间的命令)都是使用的这个时间。
硬件时间: 主板上BIOS中的时间,由主板电池供电来维持运行,系统开机时要读取这个时间,并根据它来设定系统时间(注意:系统启动时根据硬件时间设定系统时间的过程可能存在时区换算,这要视具体的系统及相关设置而定)。
查看系统时间1date
设置系统时间1date --set “2012-12-17 10:19"
查看系统时区:1date -R
hwclock命令1
2
3-r, --show 读取并打印硬件时钟(read hardware clock and print result)
-s, --hctosys 将硬件时钟同步到系统时钟(set the system time from the hardware clock)
-w, --systohc 将系统时钟同步到硬件时钟(set the hardware clock to the current system time)
如果使用date命令修改了系统时间,并不会自动去修改硬件时钟,因此,当系统下次重启时,系统时钟还会从硬件时钟去取,date设置的时间就无效了。因此需要hwclock命令再来同步系统时钟到硬件时钟,这样下次启动的时候内核则会读取正确的硬件时间到系统时间。
查看Linux服务器时区: Date -R
110主库:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30Fri 23 Nov 2018 11:21:28 AM CST -0.914369 seconds
Fri Nov 23 11:21:53 CST 2018
Fri, 23 Nov 2018 11:21:55 +0800 ;; 东八区;
psql (10.6)
Type "help" for help.
highgo=# select now();
now
-------------------------------
2018-11-23 11:22:31.308625+08
(1 row)
highgo=# show time zone;
TimeZone
----------
PRC
(1 row)
[[email protected] data]$ grep timezone postgresql.conf
log_timezone = 'PRC'
timezone = 'PRC'
#timezone_abbreviations = 'Default' # Select the set of available time zone
# share/timezonesets/.
101备库:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30Fri 23 Nov 2018 11:23:06 AM CST -0.969391 seconds
Fri Nov 23 11:23:46 CST 2018
Fri, 23 Nov 2018 11:23:58 +0800
psql (10.6)
Type "help" for help.
highgo=# select now();
now
-------------------------------
2018-11-23 11:25:13.317304+08
(1 row)
highgo=#
highgo=# show time zone;
TimeZone
----------
PRC
(1 row)
[[email protected] data]$ grep timezone postgresql.conf
log_timezone = 'PRC'
timezone = 'PRC'
#timezone_abbreviations = 'Default' # Select the set of available time zone
# share/timezonesets/.
106备库:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28Thu 22 Nov 2018 10:24:52 PM EST -0.359908 seconds
Fri, 23 Nov 2018 11:26:04 -0500 ;;; 西五区;
Fri Nov 23 11:26:05 EST 2018
psql (10.6)
Type "help" for help.
highgo=# select now();
now
-------------------------------
2018-11-24 00:26:35.379415+08
(1 row)
highgo=# show time zone;
TimeZone
----------
PRC
[[email protected] data]$ grep timezone postgresql.conf
log_timezone = 'PRC'
timezone = 'PRC'
#timezone_abbreviations = 'Default' # Select the set of available time zone
# share/timezonesets/.
猜测与106机器上 时区有关.
TZSelect 修改时区
此时并不会生效, 手动执行1TZ='Asia/Shanghai'; export TZ
查看时区:1
2Fri, 23 Nov 2018 11:33:48 +0800
刷新系统时间到硬件1
2
3
4
5
6
7Thu 22 Nov 2018 10:32:39 PM EST -0.656779 seconds
Fri 23 Nov 2018 11:34:01 AM CST -0.344289 seconds
数据库重启:1pg_ctl restart
查看数据库时间:1
2
3
4
5highgo=# select now();
now
-------------------------------
2018-11-23 11:36:55.601811+08
(1 row)
ntp 时间同步
yum -y install ntpdate ntp
同步在线网络时间。
ntpdate xxxx
crontab: 每十分钟调整一次时间1*/10 * * * * ntpdate time.nist.gov #域名或IP