curl -X POST "http://127.0.0.1:8080/test" -d "token=123456&text=你好"
curl -X POST -v "http://192.168.18.90:18001/hnszlyyapi/bdapi/text2audio" -H "Content-Type: application/json" -d "{\"token\":\"12345\",\"text\":\"你好\"}" -k
curl "http://127.0.0.1:8080/test?token=123456&text=你好"
find ./dir -mtime +30 -type f | xargs rm -rf
atime : 文件的 Access time是在读取文件或者执行文件时更改的
mtime :文件的 Modified time是在写入文件时随文件内容的更改而更改的
ctime :文件的 Create time是在写入文件、更改所有者、权限或链接设置时随 Inode 的内容
更改而更改的。
du -sh /*
- wget url
-
- wget -p /home/download url
- tee filename
-
- #追加
- echo "xxx" >> filename
-
- #覆盖
- echo "xxxx" > filename
sed -i 's/aa/dd/g' hosts
maven 仓库地址https://mvnrepository.com/
mvn install:install-file -Dfile=jar包路径 -DgroupId=jar包groupId -DartifactId=jar包artfactId -Dversion=6 -Dpackaging=jar
mvn deploy:deploy-file -DgroupId=com.fcw.org -DartifactId=fcw-app -Dversion=1.1.0-SNAPSHOT -Dfile=fcw-app-1.1.0-SNAPSHOT.jar -Dpackaging=jar -DrepositoryId=maven-snapshots -Durl=https://ip/nexus/repository/maven-snapshots/
mvn deploy:deploy-file -DgroupId=com.fcw.org -DartifactId=fcw-app -Dversion=1.1.0-SNAPSHOT -Dfile=fcw-app-1.1.0-SNAPSHOT.pom -Dpackaging=pom -DrepositoryId=maven-snapshots -Durl=https://ip/nexus/repository/maven-snapshots/
- (1)查看cpu、线程等情况
- top | head -10
-
- (2)对cpu的情况进行采样
- vmstat -n 2 3 (采样3次每次执行2次)
-
- (3)查询系统负载
- mpstat -P ALL 2
-
- (4)查看某个进程对cpu占用情况
- pidstat -u 1 -p [pid]
-
- (5) 查看内存使用情况
- free -m
-
- (6)查看磁盘剩余空间
- df -h
-
- (7)查看磁盘逻辑分区
- lsblk -l
-
- (8)查看磁盘物理分区
- fdisk -l
-
- (9)查看硬件cpu的配置
- lscpu
-
- (10)查看cpu核心数
- cat /proc/cpuinfo |grep 'process' | sort | uniq | wc -l
-
- (11)查看内存情况(GB单位)
- cat /proc/meminfo | grep "MemTotal" | awk '{print $2/1024/1024}'
-
- (12)查看cpu和磁盘i/o统计
- iostat
- iostat -d -x -k 1 10
-
- (13) 查看进程状态
- ps -aux | grep rocketmq
-
- (14)通过进程号pid,询进程端口port
- netstat -anp | grep [pid]
-
- (15) 通过port端口查进程信息
- netstat -tulnp | grep [port]
-
- (16) 修改系统时间
- date -s "2023-09-22 10:01:10"
- hwclock --systohc
-
-
-
-
- 匹配行和其后面的n行
- cat log.txt | grep -A 10 OutOfMemory
-
- 匹配行和其前面的n行
- cat log.txt | grep -B 10 OutOfMemory
-
- 匹配行和其前后的n行
- cat log.txt | grep -C 10 OutOfMemory
-
- 过滤指定字符
- cat log.txt | grep -v 'OutOfMemory'
-
-
- 过滤指定字符出现次数
- grep -m 2 'OutOfMemory' log.txt
-
- grep -A 2 'OutOfMemory' log.txt | head -2
-
-
- 查看文件函数
- wc -l 文件目录
- 重启防火墙:
- firewall-cmd --reload
-
- 查看防火墙状态:
- firewall-cmd --state
- 关闭防火墙:
- systemctl stop firewalld.service
-
- 开启防火墙:
- systemctl start firewalld.service
-
- 禁止开机启动启动防火墙:
- systemctl disable firewalld.service
-
- 关闭防火墙:
- systemctl stop firewalld.service(临时关闭)
-
- 禁止开机启动启动防火墙:
- systemctl disable firewalld.service
-
- #防火墙开放端口
- firewall-cmd --list-ports
-
- 开放端口:
- firewall-cmd --zone=public --add-port={port}/tcp --permanent
- firewall-cmd --reload
-
- 防火墙移除端口
- firewall-cmd --zone=public --remove-port=8080/tcp --permanent
- firewall-cmd --reload
-
- 查看现有的规则
- iptables -nL
-
- 开放ip
- firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source
- address="192.168.100.115" accept"
-
- firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source
- address="192.168.100.115" port protocol="tcp" port="8080" accept"
-
- 删除ip
- firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source
- address="192.168.100.115" accept"
-
- 开放网段
- firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source
- address="192.168.0.0/16" accept"
-
- firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source
- address="192.168.1.0/24" port protocol="tcp" port="8080" accept"
-
- firewall-cmd --reload
-
- #设置docker 的桥接接口
- firewall-cmd --permanent --zone=docker --change-interface=docker0
-
-
- ip addr
-
- ls /etc/sysconfig/network-scripts/
git checkout -b fengchengwu
git push origin fengchengwu
- git branch --set-upstream-to=origin/fengchengwu
-
- 查看本地与远程分支映射关系
- git branch -vv ;
也可以直接创建分支时候关联
git checkout -b fengchengwu origin/fengchengwu
将master合并到fengchengwu分支
- a、将main本地合并至fengchengwu分支
-
- git merge main
-
- b、将本地fengchengwu推送至远程fengchengwu远程分支
-
- git pull
-
- git push origin fengchengwu
-
- SELECT count(1) from information_schema.COLUMNS WHERE table_schema='dbname' and table_name='tablename';
- # 查询所有表数据大小
- select concat(round(sum(DATA_LENGTH/1024/1024),2),'M') from tables;
-
- #查询某个数据库文件表数据+索引数据
- select concat(round((sum(DATA_LENGTH)+sum(INDEX_LENGTH))/1024/1024,2),'M') from information_schema.tables where table_schema='app_db';
-
- #查询某个表的数据大小
- select concat(round(sum(DATA_LENGTH/1024/1024),2),'M') from tables where table_schema='app_db' AND table_name='number_copy';
-
- #查询某个表数据+索引
- select concat(round((sum(DATA_LENGTH)+sum(INDEX_LENGTH))/1024/1024,2),'M') from tables where table_schema='app_db' AND table_name='number_copy';
OPTIMIZE TABLE numner_copy;
如果返回:table does not support optimize, doing recreate + analyze instead , 那么进一步执 行一下命令即可:
- ALTER TABLE number_copy ENGINE=InnoDB;
-
- ANALYZE TABLE number_copy;
.frm存储表名、表结构、索引等元数据(查看表结构:mysqlfrm --diagnostic xx.frm)
.ibd存储表记录数据、索引数据
mysqld_safe --defaults-file=/etc/my.cnf &
- #开启3000端口服务
- nc -l 3000
-
- nc -l ip 3000
-
- #客户端连接3000端口服务
- nc 127.0.0.1 3000
-
- #扫描3000端口
- nc -v 127.0.0.1 3000
查看硬盘逻辑分区: lsblk ,查看硬盘物理信息: fdisk (fdisk -l),查看文件大小(du -sh 目录)
有两块硬盘 vda(vda有两个分区:vda1 vda2) 、vdb(有一个分区vdb1)
- mkdir /wmy
-
- #将硬盘 vdb的vdb1分区挂载到/wmy的目录下
- mount /dev/vdb1 /wmy
cat /etc/fstab
umount /dev/vdb1
- #!/bin/bash
- #项目jar包名字
- APP_NAME=pay
- CONSOLE_LOG=run
- #远程下载1 本地0
- DOWNLOAD_FLAG=1
- JAVA_OPTS="${JAVA_OPTS} -Xmx2048m -Xms2048m"
- #文件存储地址
- DOWNLOAD_URL=http://ip:port/${APP_NAME}.jar
-
- # 检测脚是否传参
- if [ -n "$1" ]; then
- echo "输入参数$1"
- DOWNLOAD_FLAG=$1
- fi
-
- #pid=`jps| grep $APP_NAME | awk '{print $1}'`
- pid=$(ps -ef | grep $APP_NAME | grep -v "grep" | awk '{print $2}')
- if [[ -z $pid ]]; then
- echo "step1 ${APP_NAME}服务未运行直接启动"
- else
- echo "step1 ${APP_NAME}服务正在运行执行关闭"
- kill -9 $pid
- fi
-
-
- if [[ $DOWNLOAD_FLAG -eq 1 ]]; then
- rm -f ${APP_NAME}.jar
- wget ${DOWNLOAD_URL}
- if [[ $? -eq 0 ]]; then
- echo "step2 ${APP_NAME}.jar下载成功ok"
- else
- echo "step2 ${APP_NAME}.jar下载失败fail"
- exit 1
- fi
- else
- # 检测jar文件是否存在
- if [[ -f ${APP_NAME}.jar ]]; then
- echo "step2 ${APP_NAME}.jar本地存在"
- else
- echo "step2 ${APP_NAME}.jar本地不存在"
- exit 1
- fi
- fi
-
- nohup java -jar ${JAVA_OPTS} ${APP_NAME}.jar >> ${CONSOLE_LOG}.log 2>&1 &
-
- pid=$(ps -ef | grep $APP_NAME | grep -v "grep" | awk '{print $2}')
- if [[ -z $pid ]]; then
- echo "step3 ${APP_NAME}启动失败,请查看日志"
- else
- echo "step3 ${APP_NAME}启动成功"
- fi
-
- date +'%Y-%m-%d %H:%M:%S'
-
date '+%s'
- mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
-
- wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
- yum isntall -y logrotate
-
- cd logrotate.d