服务器时间同步设立
服务器时间同步设置
服务器时钟同步:为确保系统的正常运行,需要所有服务器,与标准时间保持时钟同步。
范围:Oracle DB所在的服务器,Tomcat服务器。
设置方式——
Windows系统:控制面板-日期和时间-Internet时间,点选“自动与 Internet 时间服务器同步(S)”。
CentOS系统:
1)安装 ntpdate:#yum install ntp
2)实现定时同步
2.1)#crontab -e (打开文件)
2.2)在后面添加行:* */6 * * * /usr/sbin/ntpdate -u pool.ntp.org (使用命令crontab -u user -e命令编辑用户user的cron(c)作业。用户通过编辑文件来增加或修改任何作业请求。或者编辑/var/spool/cron/username
username这个文件直接放的是cron要执行的命令。 日志信息:/var/spool/mail/root)
2.3)保存退出
如果想要配置其他局域网机器同步某台具有外网权限机器时间时,该台外网权限机器需要开启ntp服务,并开机启动:
启动ntp服务器
服务器时钟同步:为确保系统的正常运行,需要所有服务器,与标准时间保持时钟同步。
范围:Oracle DB所在的服务器,Tomcat服务器。
设置方式——
Windows系统:控制面板-日期和时间-Internet时间,点选“自动与 Internet 时间服务器同步(S)”。
CentOS系统:
1)安装 ntpdate:#yum install ntp
2)实现定时同步
2.1)#crontab -e (打开文件)
2.2)在后面添加行:* */6 * * * /usr/sbin/ntpdate -u pool.ntp.org (使用命令crontab -u user -e命令编辑用户user的cron(c)作业。用户通过编辑文件来增加或修改任何作业请求。或者编辑/var/spool/cron/username
username这个文件直接放的是cron要执行的命令。 日志信息:/var/spool/mail/root)
2.3)保存退出
# Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * user-name command to be executed
如果想要配置其他局域网机器同步某台具有外网权限机器时间时,该台外网权限机器需要开启ntp服务,并开机启动:
启动ntp服务器
[root@11g ~]# /etc/init.d/ntpd start 启动 Starting ntpd: [ OK ] [root@11g ~]# chkconfig ntpd on 设置开机自启动ntpd服务