Debian11系统Redis源码安装 #!/bin/bash# Debian11 Redis6.2.6安装# 安装依赖包apt install gcc make pkg-config -y# 解压tar xf redis-6.2.6.tar.gz # 开始安装cd redis-6.2.6# 编译makemake install# 安装目录 usr/local/bin/root@debian112:~# ll /usr/local/bin/总用量 25048-rwxr-xr-x 1 root root
利用Shell脚本校验数据一致性 #!/bin/bash######################################检测两台服务器指定目录下的文件一致性######################################通过对比两台服务器上文件的md5值,达到检测一致性的目的# 服务器需要校验的目录current_dir=/data/tomcat# 远端服务器ip地址des_ip=192.168.2.1# 当前服务器的数据校验md5值find $current_dir -type f|xarg
Debian11更新阿里镜像源 # 进入源配置文件存放路径cd /etc/apt# 备份系统源mv sources.list{,.bak}# 查看系统版本,然后阿里云镜像站更换相应版本源more /etc/debian_version # 拷贝阿里云镜像源vim sources.list # 直接删除旧源,复制阿里云源# 更新源列表apt update...
生产环境MySQL一键安装脚本(编译模式) #!/bin/bash#编译安装MySQL脚本#date:2019-10-18#Auther:liush#适用于RedHat和CentOS系列clearecho "+------------------------------------------------------------------------+"echo "| 一、本脚本自带安装MySQL5.7,适用于RedHat平台系列 |"echo "+------------
MySQL用GTID方式恢复数据 MySQL用GTID方式恢复数据1、先登录MySQL系统查看当前的binlog日志# 找到binlog文件路径mysql> show master status;# 查看gtid号,每个gtid号都在执行语句之前生成(切记)mysql> show binlog events in 'mysql-bin.000004' 2、开始导出数据[root@test ~]# mysqlbinlog --skip-gtids --include-gtids='b09afa63-11d5-1
MySQL批量恢复数据 #创建 for i in `cat /opt/txt.txt` do #/opt/txt.txt存放数据库名,一个库名一行 # $i是库名 # 创建数据库 mysql -uroot -p123456 -e "CREATE DATABASE $i;" done #恢复 for i in `cat /opt/txt.txt` do # $i是库名 #导入mysql数据库,请先备份 #sql文件存放路径/opt/data/$i.
iptables配置实例 查看当前所有规则iptables -L -n 查看所有规则iptables -nL --line-number 显示行iptables -nvL --line-number 显示行清空所有配置iptables -Fiptables -Xiptables -Z允许ssh端口及lookback规则iptables -A INPUT -i lo -j ACCEPTiptables -A OUTPUT -o lo -j ACCEPTiptables -A INPUT -p tcp --dp
MySQL查看库的大小 #查所有据库的表大小(全部)select table_schema as '表名', table_name as '表名',table_rows as '记录数',truncate(data_length/1024/1024, 2) as '数据容量(MB)',truncate(index_length/1024/1024, 2) as '索引容量(MB)'from information_schema.tablesorder by data_length desc, index_length de.
Python获取文件内的下一行数据 #!/usr/bin/env python# Version = 3.8.1# -*- coding: utf-8 -*-#date:2020-01-10def ReadMe(path): """ 查找文件中某个元素的下一行内容 """ list_all = [] #定义空列表 with open(path, mode="r", encoding="utf-8") as file: for line in file:
Python计算文件大小 #!/usr/bin/env python-- coding: utf-8 --“”"#------------------------------------------------------------------------------file: 统计文件大小.pyAuthor: liushDate: 2019/11/19#------------------------------------------------------------------------------“..
获取Linux系统的网卡ip地址 ip -4 addr | sed -ne 's|^.* inet \([^/]*\)/.* scope global.*$|\1|p' | awk '{print $1}' | head -1
Debian 11.2安装ssh服务 Debian 11.2安装ssh服务#!/bin/bashdebian 11.2 安装ssh切换到root用户#更新软件源apt-get update安装sshapt-get install ssh备份ssh的配置文件cp /etc/ssh/sshd_config{,.bak}修改配置文件如下root@localhost:~# more /etc/ssh/sshd_config| grep -v "^#" |grep -v "^$"Include /etc/ssh/sshd
Tomcat安装指南 卸载系统自带openjdk[root@tomcat ~]# rm -rf $(which java)安装下载的jdk[root@tomcat ~]# tar xf jdk-xxx-linux-x64.tar.gz[root@tomcat ~]# mv jdkxxx/ /opt/app/jdk解压安装Tomcat[root@tomcat ~]# tar xf apache-tomcat-xxx.tar.gz[root@tomcat ~]# mv apache-tomcat-xxx /opt/
Nginx规则配置实例 配置某个ip或者页面禁止访问及跳转方法server{ listen 80; server_name www.xxx.com.cn; location / { proxy_redirect off; proxy_set_header host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forward
ubuntu20修改ip地址方法 ubuntu新系统都是yaml方式修改了,注意yaml格式缩进,网卡目录root@super:~# ll /etc/netplan/实例如下,修改完保存即可root@super:~# more /etc/netplan/00-installer-config.yaml# This is the network config written by 'subiquity'network: ethernets: ens32: addresses: - 172.12
centos7启用iptable 安装iptablesyum install iptables-services停用firewalldsystemctl stop firewalldsystemctl disable firewalld启用iptablessystemctl enable iptablessystemctl start iptables保存iptables规则service iptables save重启service iptables restart...
Linux记录用户执行命令 #!/bin/bash# By lumia98@vip.qq.com# 记录用户执行命令及IP地址# 文件存放在 /etc/profile.d 或者/etc/profile# source /etc/profile 生效;# 登录提示权限不足可以忽略,因为这是禁止用户删除权限提示;# Linux系统记录每个用户执行的命令# 创建目录hislog_dir="/tmp/hislog"[ -d ${hislog_dir} ] || mkdir -p ${hislog_dir}# 第一次请先