Linking

Capturing Life & Tech

  • 主页
  • 随笔
  • 关于我
所有文章 外链

Linking

Capturing Life & Tech

  • 主页
  • 随笔
  • 关于我

应用服务器集群时钟同步

阅读数:次 2019-05-06
字数统计: 586字   |   阅读时长≈ 2分

目录

应用服务器集群时钟同步
1.提出问题
2.解决方式
3.搭建 NTP 时间同步服务器
3.1确定ntp server及client
3.2ntp时钟同步配置流程

应用服务器集群时钟同步

1.提出问题

多服务器集群部署时,存在时间不一致的问题,导致程序中代码生成的数据时间对不上,整个业务流程无法正常操作。需要保证所有应用服务器的系统时间完全一致,

2.解决方式

这里使用一台服务器为同步源,建议用负载均衡服务器为同步源。

3.搭建 NTP 时间同步服务器

同步方法如下:(参考「centos7.2上搭建ntp服务器,并实现时间同步」)

3.1确定ntp server及client

服务器系统版本:CentOS 7.3

IP 用处 备注
192.168.1.1 单独一台做为ntp server,时间同步源 Nginx负载均衡服务器
192.168.1.2 ntp client,时间同步客户端 应用服务器1
192.168.1.x xxx 应用服务器x

3.2ntp时钟同步配置流程

1.安装ntp

如果联网了,直接执行 yum install ntp 安装;离线情况下请参考「centos7.1-离线-ntpd服务器搭建」;

2.所有节点(server、client)时区设置为中国区

1
timedatectl set-timezone Asia/Shanghai

3.server节点启动ntp服务

1
2
systemctl start ntpd 
systemctl enable ntpd

4.server节点设置现在准确时间

1
timedatectl set-time HH:MM:%sS

5.server节点ntp.conf设置

设置ntp服务器为其自身;同时设置可以接受连接服务的客户端,其中server设置127.127.1.0为其自身,新增加一个restrict段为可以接受服务的网段。

1
2
3
4
5
6
7
8
9
10
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict ::1
restrict 192.168.0.0 mask 255.255.0.0

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool(http://www.pool.ntp.org/join.html).
server 127.127.1.0

6.重启ntp服务

1
systemctl restart ntpd

7.client节点ntp.conf设置

1
2
3
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool(http://www.pool.ntp.org/join.html).
server 192.168.1.1

8.client节点同步server节点时间

1
ntpdate 192.168.1.1

9.client节点启动ntpd服务

1
2
systemctl start ntpd
systemctl enable ntpd

10.所有节点启动时间同步

1
timedatectl set-ntp yes
  • 本文作者: Linking
  • 本文链接: https://linking.fun/2019/05/06/应用服务器集群时钟同步/
  • 版权声明: 版权所有,转载请注明出处!
  • ntp
  • cs

扫一扫,分享到微信

Java Web 增量更新 shell 脚本
CentOS7离线安装Nginx
  1. 1. 目录
  2. 2. 应用服务器集群时钟同步
    1. 2.1. 1.提出问题
    2. 2.2. 2.解决方式
    3. 2.3. 3.搭建 NTP 时间同步服务器
      1. 2.3.1. 3.1确定ntp server及client
      2. 2.3.2. 3.2ntp时钟同步配置流程
© 2015-2026 Linking
GitHub:hexo-theme-yilia-plus by Litten
本站总访问量次 | 本站访客数人
  • 所有文章
  • 外链

tag:

  • weather
  • 需求
  • essay
  • basketball
  • olympic
  • nginx
  • APPScan
  • SQl盲注
  • xss
  • Ajax
  • ajax
  • ai
  • agent
  • openclaw
  • ccf
  • Nginx
  • HTML5
  • html5
  • hmtl5
  • sse
  • JavaScriptCore
  • Oracle
  • operation
  • Linux
  • deploy
  • Mac Office
  • markdown
  • ListView
  • GridView
  • MySQL
  • 慢查询
  • mongodb
  • 转置
  • thought
  • network
  • ubuntu
  • NetworkManager
  • RFKill
  • Netplan
  • avatar
  • cocoa
  • blog
  • Gitalk
  • container
  • macvlan
  • docker
  • oracle
  • cookie
  • patch
  • gitea
  • git
  • iOS
  • https
  • 多线程
  • bundle
  • 兼容性
  • HTTP
  • 绘图
  • cs
  • java
  • 效率
  • 快捷键
  • route
  • nodejs
  • pip
  • arcgis
  • arcgis 建模
  • 标识
  • redis
  • read
  • bookList
  • running
  • showdoc
  • disk
  • unit-test
  • D.Wade
  • thoughts
  • duoduo
  • Python
  • python
  • tomcat
  • 读书节
  • session
  • jdk
  • war
  • 加班
  • Android onclick事件监听
  • 正则
  • 手机品牌匹配
  • ntp
  • OpenLayers
  • Geoserver
  • wechat
  • 微信公众号
  • 爬虫
  • WeChat
  • 张靓颖
  • 动漫
  • vpn
  • PPT
  • MarkDown
  • plan
  • 朱赟
  • 极客时间专栏
  • 极客邦
  • 模块化
  • MVC
  • excel
  • NBA
  • kobe
  • team
  • crawler
  • 进度条
  • ssl
  • book
  • anti-stealing-link
  • Agentic Engineering
  • Vibe Coding
  • Software 3.0
  • Andrej Karpathy
  • LLM
  • Programming

    缺失模块。
    1、请确保node版本大于6.2
    2、在博客根目录(注意不是yilia-plus根目录)执行以下命令:
    npm i hexo-generator-json-content --save

    3、在根目录_config.yml里添加配置:

      jsonContent:
        meta: false
        pages: false
        posts:
          title: true
          date: true
          path: true
          text: false
          raw: false
          content: false
          slug: false
          updated: false
          comments: false
          link: false
          permalink: false
          excerpt: false
          categories: false
          tags: true
    

  • GitHub Trending
  • OpenAI ChatGPT
  • Gitee码云
  • 简书
  • CSDN