代码改变世界

基于NTP的时间同步

2023-08-30 11:07 by ndzj, 22 阅读, 0 推荐, 收藏, 编辑
摘要:CentOS基于NTP的时间同步(How) 1、安装ntp: yum install ntp 2、修改/etc/ntp.conf # Use public servers from the pool.ntp.org project. # Please consider joining the poo 阅读全文

Python3多线程并发写入数据到MongoDB

2023-08-22 14:34 by ndzj, 15 阅读, 0 推荐, 收藏, 编辑
摘要:!/usr/bin/python ! * coding:utf-8 * from pymongo import MongoClient import threading import time 连接单机 single mongo c = MongoClient(host="192.168.89.15 阅读全文

时间同步服务器

2023-01-31 09:43 by ndzj, 172 阅读, 0 推荐, 收藏, 编辑
摘要:chrony的介绍 chrony是网络时间协议(NTP)的另一种实现,与网络时间协议后台程序(ntpd)不同,它可以更快地且更准确地同步系统时钟,请注意,ntpd仍然包含其中以供需要运行NTP服务的客户使用。 chrony的优势包括以下几点: (1)更快的同步只需要数分钟而非数小时时间,从而最大程度 阅读全文

MySQL 内存检查脚本

2022-12-28 17:38 by ndzj, 41 阅读, 0 推荐, 收藏, 编辑
摘要:#!/bin/sh mysql -uroot -pxxx -h172.16.13.179 -P 3305 -e "show variables; show status" | awk ' { VAR[$1]=$2 } END { MAX_CONN = VAR["max_connections"] M 阅读全文

各压缩工具对比

2022-12-28 17:19 by ndzj, 385 阅读, 0 推荐, 收藏, 编辑
摘要:lz4 zstd tar.gz tar.bz2 pigz 压缩前大小 26G 26G 26G 26G 26G 压缩后大小 6.2G 3.5G 3.6G 2.6G 3.6G 压缩比率 4.19 7.42 7.22 10 7.22 压缩耗时 1m24s 38s 12m54s 107m41s 1m47.s 阅读全文

mongodb shell设置

2022-12-26 10:58 by ndzj, 38 阅读, 0 推荐, 收藏, 编辑
摘要:host=db.serverStatus().host; cmdCount=1; prompt=function(){ return db+"@"+host+" "+(cmdCount++) +">"; } function showDate(){ var today = new Date(); v 阅读全文

Navicat Premium 工具安装和激活

2022-12-06 15:05 by ndzj, 259 阅读, 0 推荐, 收藏, 编辑
摘要:安装包下载: https://pan.baidu.com/s/1-0k7gGalLKhfiqngQMj-fg?pwd=3hpk 安装好navicat工具后不要打开软件,接下来是激活软件 打开激活软件,点Patch,找到安装navicat工具 接下来是点击Generate生成Keygen 最后一步是打 阅读全文

mongodb单实例lvm快照备份和恢复

2022-12-02 13:42 by ndzj, 122 阅读, 0 推荐, 收藏, 编辑
摘要:ps -ef|grep mongo #查看mongodb实例数据目录所在位置 root 1525 1389 3 20:44 pts/0 00:00:17 /usr/local/mongodb/bin/mongod –config /data/mongodb/conf/mongo_config.yml 阅读全文

mysql数据库定期备份

2022-08-29 11:59 by ndzj, 149 阅读, 0 推荐, 收藏, 编辑
摘要:#!/bin/bash username='xxxx' #数据库用户名passw='xxxxx' #密码date_ymd=`date +%Y_%m_%d` #年月日date_hms=`date +%H%M%S` #时分秒filedir='/root/data_backup/' # 备份目录#数据库采 阅读全文

python脚本导数据-2-csv

2022-08-08 21:23 by ndzj, 76 阅读, 0 推荐, 收藏, 编辑
摘要:需求: 工作日常中会有很多这样的情况,产品人员会提OA要求dba导数据(导出的数据放表格文件中),有时数据量要达到几千万,假如是人工导,要导好多次,时间消耗比较多。所以决定写脚本来导。 #!/usr/bin/pythonimport MySQLdbimport sys,osimport timeim 阅读全文