ntp

Centos7下时间同步设置

限于喜欢 提交于 2020-01-13 01:43:55
Centos没有设置时区,导致时间不准确,在做定时器之类的时,会出现时间不准的问题 1、安装ntp服务软件包:yum install ntp -y 2、将ntp设置为缺省启动:systemctl enable ntpd 3、启动ntp服务:service ntpd restart 4. 将系统时区改为上海时间(即CST时区):ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 5. 输入date命令查看时间是否与当前时间一致 yum install ntp -y #安装ntp ntpdate -u ntp1.aliyun.com #同步时间 systemctl enable ntpd #将ntp设为缺省启动,这样一开机就会启动校准时间 service ntpd restart #启动ntp服务 ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #改为上海时区 来源: CSDN 作者: shenming98 链接: https://blog.csdn.net/qq_42679299/article/details/103753792

How can I get the actual date and time if the device date and time are inaccurate?

◇◆丶佛笑我妖孽 提交于 2020-01-11 05:00:10
问题 I noticed that if I set my device time manually, and turn off the automatic time sync on my iOS device, [NSDate date] returns the date and time assuming the device time is correct--which it may not be. Since the docs mention that NSDate has some sort of sync with NTP, I am wondering if there is any built-in way to get the accurate date and time instead of having to assume the device date and time is correct. 回答1: Perhaps https://github.com/jbenet/ios-ntp can help you? It's a library that can

MySQL主从复制

谁说胖子不能爱 提交于 2020-01-10 21:56:36
MySQL主从复制 案例概述 在企业网站中,后端MySQL数据库只有一台时,会有以下问题: 单点故障服务不可用 无法处理大量的并发数据请求 数据丢失 改造办法 增加MySQL数据库服务器,对数据进行备份,形成主备 确保主备MySQL数据库服务器数据是一样的 主服务器宕机了,备份服务器继续工作,数据有保障 MySQL的主从复制与读写分离是密切相关的 更高级的解决方案 通过主从复制的方式来同步数据,在通过读写分离提升数据库的并发能力 Amoeba 变形虫 案例实施 1.所有服务器关闭firewalld或者进行规则设置 2.建立时间同步环境 在主服务器上安装ntp时间同步服务器 使用yum安装ntp服务 修改ntp.conf,设置主服务器为时间同步源 在从服务器上进行时间同步 使用yum安装ntpdate并进行时间同步 在三台数据库服务器上安装mysql 编译安装mysql 优化调整 初始化数据库 启动mysql服务并进行root用户密码设置 配置mysql master主服务器 修改/etc/my.cnf配置文件,增加服务器id,配置二进制日志选项 登录mysql服务,授权所有的从服务器复制二进制日志的权限 配置两台从服务器 修改/etc/my.cnf配置文件,增加服务器id,配置二进制日志选项 登录mysql,配置主从同步 实操 实验环境:准备5台centos 7系统的虚拟机

Mysql——主从复制

微笑、不失礼 提交于 2020-01-10 08:20:24
文章目录 一、什么是主从复制 二、主从复制应用场景 三、MySQL主从复制的类型 四、主从复制的工作过程 五、主从复制示例 1、主服务器配置 2、从服务器(slave 1)配置 3、从服务器(slave 2)配置 4、主从复制验证 一、什么是主从复制 MySQL 主从复制是指数据可以从一个MySQL数据库服务器主节点复制到一个或多个从节点。MySQL 默认采用异步复制方式,这样从节点不用一直访问主服务器来更新自己的数据,数据的更新可以在远程连接上进行,从节点可以复制主数据库中的所有数据库或者特定的数据库,或者特定的表。 二、主从复制应用场景 在企业网站中,后端MySQL数据库只有一台时,会存在以下问题: 单点故障,服务不可用 无法处理大量的并发数据请求(导致效率慢,访问超时) 数据丢失 解决方案: 增加MySQL数据库服务器,对数据进行备份,形成主备 确保主备MySQL数据库服务器数据是一样的 主服务宕机了,备份服务器继续工作,数据有保障 解决方案(高级): MySQL主从复制与读写分离是密切相关的 通过主从复制的方式来同步数据,再通过读写分离来提升数据库的并发负载能力 三、MySQL主从复制的类型 基于语句的复制(默认) 在主服务器上执行的语句,从服务器执行同样的语句 基于行的复制 把改变的内容复制到从服务器 混合类型的复制 一旦发现基于语句无法精确复制时,就会采用基于行的复制

修改NTP 服务和时区

北战南征 提交于 2020-01-07 18:15:06
安装ntpd yum install ntpdate timedatectl查看时间各种状态: [root@localhost network-scripts]# timedatectl Local time: Sun 2019-12-29 23:45:49 EST Universal time: Mon 2019-12-30 04:45:49 UTC RTC time: Mon 2019-12-30 13:49:38 Time zone: America/New_York (EST, -0500) NTP enabled: no NTP synchronized: no RTC in local TZ: no DST active: no Last DST change: DST ended at Sun 2019-11-03 01:59:59 EDT Sun 2019-11-03 01:00:00 EST Next DST change: DST begins (the clock jumps one hour forward) at Sun 2020-03-08 01:59:59 EST Sun 2020-03-08 03:00:00 EDT [root@localhost network-scripts]# 开启时钟同步后的状态如下: [root@localhost ~]#

Linux下搭建ntp时间服务器

若如初见. 提交于 2020-01-07 08:16:40
NTP是Network Time Protocol的缩写,又称为网络时间协议。是用来使计算机时间同步化的一种协议,它可以使计算机对其服务器或时钟源(如石英钟,GPS等等)做同步化,它可以提供高精准度的时间校正(LAN上与标准间差小于1毫秒,WAN上几十毫秒),且可介由加密确认的方式来防止恶毒的协议攻击。 条件:两个虚拟机 一台服务端、一台客户端 服务端配置: 1.安装ntp服务 yum install ntp ntpdate -y 修改ntp.conf配置文件 cp /etc/ntp.conf /etc/ntp.conf.bak 进行修改配置文件ntp.conf vim /etc/ntp.conf For more information about this file, see the man pages ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5). driftfile /var/lib/ntp/drift #在与上级时间服务器联系时所花费的时间,记录在driftfile参数后面的文件内 Permit time synchronization with our time source, but do not permit the source to query or

在 Linux 下确认 NTP 是否同步的方法

时光怂恿深爱的人放手 提交于 2020-01-07 08:12:41
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> NTP 意即网络时间协议Network Time Protocol,它通过网络同步计算机系统之间的时钟。NTP 服务器可以使组织中的所有服务器保持同步,以准确时间执行基于时间的作业。NTP 客户端会将其时钟与 NTP 服务器同步。 Linux 中有三个 命令 可用于验证 NTP 同步情况。详情如下。在本文中,我们将告诉您如何使用所有这些 命令 验证 NTP 同步。 ntpq:ntpq 是一个标准的 NTP 查询程序。 ntpstat:显示网络世界同步状态。 timedatectl:它控制 systemd 系统中的系统时间和日期。 方法 1:如何使用 ntpq 命令检查 NTP 状态? ntpq 实用程序用于监视 NTP 守护程序 ntpd 的操作并确定性能。 该程序可以以交互模式运行,也可以使用命令行参数进行控制。它通过向服务器发送多个查询来打印出连接的对等项列表。如果 NTP 正常工作,你将获得类似于下面的输出。 # ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== *

NTP服务器搭建

半城伤御伤魂 提交于 2020-01-06 23:37:35
NTP的用途是把计算机的时钟同步到世界协调时UTC,NTP可以使计算机对其服务器或时钟源进行时间同步。 以下为NTP服务器搭建和客户端同步配置 一、服务端配置 1、安装NTP软件包 执行命令:yum install ntp ntpdate -y 2、修改NTP配置文件,修改前注意先备份。 执行命令:cp /etc/ntp.conf{,.bak}  #备份ntp配置文件      vim /etc/ntp.conf restrict 控制相关权限 ignore :关闭所有的 NTP 联机服务 nomodify:客户端不能更改服务端的时间参数,但是客户端可以通过服务端进行网络校时。 notrust :客户端除非通过认证,否则该客户端来源将被视为不信任子网 noquery :不提供客户端的时间查询:用户端不能使用ntpq,ntpc等命令来查询ntp服务器 notrap :,不提供trap远端登陆:拒绝为匹配的主机提供模式 6 控制消息陷阱服务。陷阱服务是 ntpdq 控制消息协议的子系统,用于远程事件日志记录程序。 nopeer :用于阻止主机尝试与服务器对等,并允许欺诈性服务器控制时钟 kod : 访问违规时发送 KoD 包。 restrict -6 表示IPV6地址的权限设置。 restrict default kod nomodify notrap nopeer noquery  

Linux 时区、NTP设置

醉酒当歌 提交于 2020-01-06 23:25:32
CentOS 时区及NTP配置 时区 配置 1.查看当前时区 [root@localhost ~]# ll /etc/localtime lrwxrwxrwx. 1 root root 35 Dec 23 22:58 /etc/localtime -> ../usr/share/zoneinfo/Asia/Shanghai 2.修改时区 [root@localhost ~]# timedatectl list-timezones |grep Shanghai Asia/Shanghai [root@localhost ~]# timedatectl set-timezone Asia/Shanghai 软链接方式修改 ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime NTP 配置 同步时间,可以使用ntpdate命令,也可以使用ntpd服务。 ntpdate命令需要配合计划任务来执行,定期强制同步时间;如果使用ntpd是创建了ntp的服务进程 ,该进程既可以作为ntp的客户端,也可以作为ntp的服务端,因此建议使用ntpd服务。 1.安装ntpd服务 [root@localhost ~]# yum -y install ntp Loaded plugins: fastestmirror base | 3.6 kB 00

Query domain controllers & NTP servers time w32tm /monitor format output

随声附和 提交于 2020-01-05 09:04:21
问题 I'm using the following to measure the time offset between our domain controllers and ntp servers. $Servers = "ntp.xxxxx,ntp.xxxxx,dc1,dc2,dc3,dca,dcb,dcc" $ListDomains = "domain1","domain2" Foreach ($Server in $ListServers) { $time = (w32tm /stripchart /dataonly /computer:$Server /samples:1)[-1].split("[")[0] "$Server`: `t $Time" #| out-file $timeFile -append $time = "" } ForEach ($Domain in $ListDomains) { "** $Domain **" w32tm /monitor /domain:"$Domain.unisa.edu.au" /nowarn /threads:5 }