个人常用命令集锦 持续更新
Posted 衣舞晨风
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了个人常用命令集锦 持续更新相关的知识,希望对你有一定的参考价值。
OS
1、 立刻关机
halt
2、 centos安装yum
apt-get install yum
3、 查找文件夹
find / - name 需要查找文件名称
4、 vi里面 查找字符串
“/”,后面跟要查找的字符串,再按回车。vi将光标定位在该串下一次出现的地方上。键入n跳到该串的下一个出现处,键入N跳到该串的上一个出现处。
要查找一个以search为行首的行,则键入/^search ,要查找一个以search为行尾的行,则键入/search$。
5、 解压
tar -zxvf archive_name.tar.gz
unzip elasticsearch-head-master.zip
unzip -oq elastic-job-lite-console.war -d elastic-job-lite-console
//unzip 命令详解
http://www.2cto.com/os/201308/239355.html
6、 压缩
tar czvf robot4.tar robot4
7、 查看文件修改时间
stat 555.txt
8、 查看当前目录下所有文件夹及文件
tree
如果想把内容输出到文本
tree > file.txt
9、 读取标准输入的数据,并将其内容输出成文件
tee
例如:
bin/logstash -f config/logstash-hdy.conf --debug | tee debug.log
将调试日志输入到文本中
10、 显示当前所有Java进程pid的命令
jps
11、 查看文件大小(后缀是m)
du -sh alarm.log | sort -rn
12、 linux 端口占用
netstat -anp | grep 80
lsof -i:17428
13、 Ubuntu内存cpu监控
sudo apt-get install htop
安装完成后执行命令:htop即可
14、远程拷贝文件
scp monitor-kafka-consumer-0.0.1-SNAPSHOT.jar root@10.119.37.115:/usr/local
15、放开所有端口
iptables -I IN_public_allow 1 -j ACCEPT
16、java后台启动jar包 后台启动,并且不记录日志输出
nohup java -jar jarfilename.jar >/dev/null &
nohup java -jar jarfilename.jar >log.txt &
17、Centos版本查看
cat /etc/redhat-release
18、移除当前目录下非war结尾的文件
find . ! -name "*.war" -exec rm -rf \\;
19、war 解压
//解压 到activiti-app文件夹中(没有会自动创建)
unzip activiti-app.war -d activiti-app
20、linux java安装路径查看
http://www.cnblogs.com/kerrycode/p/4762921.html
21、查看文件的第5行到第10行
sed -n '5,10p' /etc/passwd
22、查找过滤文本文件内容
//查看cockpit-schedule-task.log日志中包含CustomDayCounterThread关键字
//忽略大小写,可以用-i参数
grep -i CustomDayCounterThread cockpit-schedule-task.log
23、根据进程号 查找程序所在文件夹
ll /proc/PID 比如“ll /proc/12132
24、更改用户的密码过期时间
比如:给jiankunking延期3000天
sudo chage -M 3000 jiankunking
查看jiankunking过期时间信息
chage -l jiankunking
25、查询当前文件夹下文件数量
ls -l | grep "^-" | wc -l
查询某个文件夹下所有文件(包含文件夹中的文件)
find ./monitor-cockpit -type f | wc -l
wc是(Word Count)的缩写,即统计单词数。 -l 统计行数
xargs用作替换工具,读取输入数据重新格式化后输出
26、查找某个文件夹下 包含error的内容
find ./monitor-cockpit -type f | xargs cat | grep -i error
27、ssh登陆
ssh jiankunking@10.138.40.221
28、回到你操作过的上一个目录去
只需敲入 cd – 就会返回到你操作过的上一个目录中去。
29、kill -HUP pid
pid 是进程标识。如果想要更改配置而不需停止并重新启动服务,请使用该命令。在对配置文件作必要的更改后,发出该命令以动态更新服务配置。
30、tcpdump
tcpdump -i ens160 host 10.119.37.147 and port 17428
//-X表示解码
tcpdump -i ens160 host 10.119.37.147 -X
31、判断当前主机是物理机还是虚拟机
dmidecode -s system-product-name
32、通过命令监听端口
nc -l 1211
33、Linux快速查询到历史输入命令
ctrl+r
按下这个快捷键后,进入了反向搜索状态,这时你输入一个字符,系统会找到最近一个包含这个字符的命令,如果不是你想要的命令,你可以继续输入,系统继续查找最近一个包含你所输入的字符串的命令,直到找到你要的命令。
找到你想要的命令后,你可以按回车执行这条命令,还可以按上下键查找该命令前后的命令,按左右键移动光标并修改这条命令。
为了提高查找效率,你应该输入该条命令中最特别的字符(别的命令不包含的字符)
34、ssh 调试模式
ssh -v jiankunking@10.119.37.199
35、linux查询某个关键字附近几行
grep -C 40 AlarmThread_run_error cockpit-schedule-task-2017-11-17.3.log
36、杀掉所有含有关键字"ansible"的进程
ps -ef|grep ansible|grep -v grep|cut -c 9-15|xargs kill -9
https://www.cnblogs.com/lichkingct/archive/2010/08/27/1810463.html
37、linux时间排序
//按照时间升序
ls -lrt
//按照时间降序(最新修改的排在前面)
ls -lt
38、临时配置java环境
export JAVA_HOME=/usr/local/java/jdk1.7.0_79
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
39、将当前时间以Unix时间戳表示
date +%s
40、Ubuntu /etc/hosts 生效
sudo /etc/init.d/networking restart
41、~
当前用户的根目录
比如:jiankunking用户 ~代表:/home/jiankunking
比如:root用户 ~代表:/root
42、查找当前目录下所有包含sshd_config字符串的文件
find .|xargs grep -ri "sshd_config"
43、使用env命令显示所有的环境变量
env
44、linux命令查看开放哪些端口
netstat -nupl (UDP类型的端口)
netstat -ntpl (TCP类型的端口)
45、su sudo
su - root(或者其他用户名)这里加了"-"后表示也切换的当前的环境变量到新用户的环境变量,
su root(或者其他用户名)表示不切换环境变量到当前用户下。
46、查看IP连接数状况
netstat -nat|grep ":80"|awk 'print $5' |awk -F: 'print $1' | sort| uniq -c|sort -n
47、查看连接的各种状态
netstat -n | awk '/^tcp/ ++S[$NF] END for(a in S) print a, S[a]'
48、Linux 快速清空文件内容
> test.txt(文件大小被截为0字节)
//文件内容清空
echo > filebeat.yml
https://my.oschina.net/open1900/blog/99061
49、文件赋予执行权限
u:表示文件所有者
g:表示同组用户
o:表示其它用户
a:表示所有用户
opt则是代表操作,可以为:
+:添加某个权限
-:取消某个权限
=:赋予给定的权限,并取消原有的权限
50、将/data/hlht/data/elasticsearch赋给elsearch用户组中的elsearch用户
chown -R elsearch:elsearch /data/hlht/data/elasticsearch
chmod 777 /data/hlht/data/elasticsearch
查看当前用户所属组:groups
51、查看进程启动及运行时间
# ps -eo lstart 启动时间
# ps -eo etime 运行多长时间
ps -eo pid,lstart,etime | grep 5176
52、查看某个目录下文件资源占用大小
du -sh /var/log/*
53、查看文件夹下文件排序并显示
du -sh ./*| sort -k1 -n
54、某个进程内存占用
top -p 进程号
显示内存单位是K
55、CentOS7使用firewalld打开关闭防火墙与端口
https://www.cnblogs.com/moxiaoan/p/5683743.html
56、添加具有root权限用户
useradd es
vi /etc/sudoers
es ALL=(ALL) NOPASSWD:ALL
测试
su es -
sudo su -
56、查看磁盘空间大小命令(linux系统以磁盘分区为单位查看文件系统)
df -hl
57、查看已经挂载的分区和文件系统类型
df -T
58、0.0.0.0
一个非常特殊的IP:0.0.0.0
这个IP相当于java中的this,代表当前设备的IP。
59、服务重新加载
systemctl daemon-reload
60、Linux下 查看哪些进程占用的CPU内存资源最多
linux下获取占用内存资源最多的10个进程,可以使用如下命令组合:
ps aux|head -1;ps aux|grep -v PID|sort -rn -k +4|head
linux下获取占用CPU资源最多的10个进程,可以使用如下命令组合:
ps aux|head -1;ps aux|grep -v PID|sort -rn -k +3|head
或者
在命令行提示符执行top命令
输入大写P,则结果按CPU占用降序排序。输入大写M,结果按内存占用降序排序。(注:大写P可以在capslock状态输入p,或者按Shift+p)
61、磁盘io利用率
iostat -xdm 1
%util 代表磁盘繁忙程度。100% 表示磁盘繁忙, 0%表示磁盘空闲。但是注意,磁盘繁忙不代表磁盘(带宽)利用率高
https://www.cnblogs.com/quixotic/p/3258730.html
进程级IO监控 iotop
iotop 顾名思义, io版的top
62、多U多核CPU监控
在top基本视图中,按键盘数字“1”,可监控每个逻辑CPU的状况
第三行:cpu状态
6.7% us — 用户空间占用CPU的百分比。
0.4% sy — 内核空间占用CPU的百分比。
0.0% ni — 改变过优先级的进程占用CPU的百分比
92.9% id — 空闲CPU百分比
0.0% wa — IO等待占用CPU的百分比
0.0% hi — 硬中断(Hardware IRQ)占用CPU的百分比
0.0% si — 软中断(Software Interrupts)占用CPU的百分比
63、centos查看安装了某个包
yum方法安装的,可以用yum list installed查找,如果是查找指定包,命令后加 | grep “软件名或者包名”;
64、swap
关闭
swapoff -a
在关闭的时候,可以通过free -mh查看swap内存占用,swapoff -a会逐渐将swap内存转移到内存中
打开
swapon -a
echo "vm.swappiness = 1">> /etc/sysctl.conf
sysctl -p (执行这个使其生效,不用重启)
65、软连接
将/data/blog/wordpress/nginx_conf/2_jiankunking.com.key(真实存在) 软连接到/etc/nginx/目录下
ln -s /data/blog/wordpress/nginx_conf/2_jiankunking.com.key /etc/nginx/
66、移动到文件末尾
可以按 shift+g 即可跳到文件底部
要返回文件顶部的时候 按 gg即可
shift+$是移动到行尾,0是移动到行首
67、字符替换
86替换成 214
sed -i "s/10.133.0.86/10.138.25.214/g" lishan.txt
68、 粗暴安装openjdk
yum install java-1.8.0-openjdk* -y
sudo apt-get install default-jdk -y
69、 CentOS7 查看开机启动项和程序服务
systemctl list-unit-files (查看开机启动项)
systemctl list-unit-files | grep 程序名称 (查看某些服务开机启动状态)
systemctl list-unit-files | grep enable (查看哪些为开机启动服务)
70、ldd
ldd命令 用于打印程序或者库文件所依赖的共享库列表。
可以用来查看golang编译的二进制程序的依赖。
Golang 在编译的时候,可以关闭CGO(CGO_ENABLED=0),从而移除依赖。
71、iptables 放开某个端口
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
72、pmap
pmap命令用于显示一个或多个进程的内存状态。其报告进程的地址空间和内存状态信息。
语法或用法:
pmap PID
pmap [options] PID
在输出中它显示全部的地址,kbytes,mode还有mapping。
选项
- -x extended显示扩展格式
- -d device显示设备格式
- -q quiet不显示header/footer行
- -V 显示版本信息
扩展进程内存
[root@info ~]# pmap -x 1013
1013: /usr/sbin/sshd
Address Kbytes RSS Dirty Mode Mapping
00110000 1480 92 0 r-x- libcrypto.so.1.0.0
00282000 80 80 80 rw-- libcrypto.so.1.0.0
00296000 12 8 4 rw-- [ anon ]
00299000 36 0 0 r-x- libkrb5support.so.0.1
002a2000 4 4 4 rw-- libkrb5support.so.0.1
002a3000 16 0 0 r-x- libplc4.so
002a7000 4 4 4 rw-- libplc4.so
002ab000 88 4 0 r-x- libaudit.so.1.0.0
002c1000 4 4 4 r--- libaudit.so.1.0.0
002c2000 4 4 4 rw-- libaudit.so.1.0.0
002c3000 216 4 0 r-x- libgssapi_krb5.so.2.2
002f9000 4 4 4 rw-- libgssapi_krb5.so.2.2
002fa000 808 4 0 r-x- libkrb5.so.3.3
003c4000 24 24 24 rw-- libkrb5.so.3.3
003ca000 152 4 0 r-x- libk5crypto.so.3.1
003f0000 4 4 4 rw-- libk5crypto.so.3.1
003f1000 92 0 0 r-x- libnssutil3.so
00408000 12 12 12 rw-- libnssutil3.so
0040b000 12 0 0 r-x- libplds4.so
0040e000 4 4 4 rw-- libplds4.so
--- --- --- --- ---
total kB 8232 - - -
这里的Address,Kbyte,Dirty,RSS,mode还有mapping的说明如下
扩展和设备格式区域
- Address: 内存开始地址
- Kbytes: 占用内存的字节数(KB)
- RSS: 保留内存的字节数(KB)
- Dirty: 脏页的字节数(包括共享和私有的)(KB)
- Mode: 内存的权限:read、write、execute、shared、private (写时复制)
- Mapping: 占用内存的文件、或[anon](分配的内存)、或[stack](堆栈)
- Offset: 文件偏移
- Device: 设备名 (major:minor)
73、lsof
lsof(list open files)是一个列出当前系统打开文件的工具。在linux环境下,任何事物都以文件的形式存在,通过文件不仅仅可以访问常规数据,还可以访问网络连接和硬件。所以如传输控制协议 (TCP) 和用户数据报协议 (UDP) 套接字等,系统在后台都为该应用程序分配了一个文件描述符,无论这个文件的本质如何,该文件描述符为应用程序与基础操作系统之间的交互提供了通用接口。
在终端下输入lsof即可显示系统打开的文件,因为 lsof 需要访问核心内存和各种文件,所以必须以 root 用户的身份运行它才能够充分地发挥其功能。
直接输入lsof部分输出为:
每行显示一个打开的文件,若不指定条件默认将显示所有进程打开的所有文件。
lsof输出各列信息的意义如下:
- COMMAND:进程的名称 PID:进程标识符
- USER:进程所有者
- FD:文件描述符,应用程序通过文件描述符识别该文件。如cwd、txt等 TYPE:文件类型,如DIR、REG等
- DEVICE:指定磁盘的名称
- SIZE:文件的大小
- NODE:索引节点(文件在磁盘上的标识)
- NAME:打开文件的确切名称
FD 列中的文件描述符cwd 值表示应用程序的当前工作目录,这是该应用程序启动的目录,除非它本身对这个目录进行更改,txt 类型的文件是程序代码,如应用程序二进制文件本身或共享库,如上列表中显示的 /sbin/init 程序。
其次数值表示应用程序的文件描述符,这是打开该文件时返回的一个整数。如上的最后一行文件/dev/initctl,其文件描述符为 10。u 表示该文件被打开并处于读取/写入模式,而不是只读 ® 或只写 (w) 模式。同时还有大写 的W 表示该应用程序具有对整个文件的写锁。该文件描述符用于确保每次只能打开一个应用程序实例。初始打开每个应用程序时,都具有三个文件描述符,从 0 到 2,分别表示标准输入、输出和错误流。所以大多数应用程序所打开的文件的 FD 都是从 3 开始。
与 FD 列相比,Type 列则比较直观。文件和目录分别称为 REG 和 DIR。而CHR 和 BLK,分别表示字符和块设备;或者 UNIX、FIFO 和 IPv4,分别表示 UNIX 域套接字、先进先出 (FIFO) 队列和网际协议 (IP) 套接字。
74、根据进程号查看某个进程文件的启动位置
ls -al /proc/进程id
输出
注意:
- cwd符号链接的是进程运行目录;
- exe符号连接就是执行程序的绝对路径;
- cmdline就是程序运行时输入的命令行命令;
- environ记录了进程运行时的环境变量;
- fd目录下是进程打开或使用的文件的符号连接。
75、linux 查看进程启动命令
先通过ps找到进程pid,再在/proc/进程pid/cmdline查看启动命令
cat /proc/进程pid/cmdline
可使用 tr 或者 strings命令将命令分割成可读方式(推荐第二种)
cat /proc/进程pid/cmdline | tr "\\0" " "
或者
cat /proc/进程pid/cmdline | strings -1
76、查看系统进程中的线程
ps -xH
77、在宿主机上根据进程PID查找归属容器ID
for i in `docker ps |grep Up|awk 'print $1'`;do echo \\ &&docker top $i &&echo ID=$i; done |grep -A 10 27888
78、查看网络状态
netstat -s
结果如下:
[jiankunking@7b76fa ~]# netstat -s
Ip:
274142020723 total packets received
7 with invalid headers
78827273118 forwarded
36 with unknown protocol
0 incoming packets discarded
195314721724 incoming packets delivered
263133635745 requests sent out
8 dropped because of missing route
14 reassemblies required
7 packets reassembled ok
Icmp:
31269654 ICMP messages received
163 input ICMP message failed.
ICMP input histogram:
destination unreachable: 12385
timeout in transit: 7
echo requests: 31256550
echo replies: 519
timestamp request: 38
timestamp reply: 4
address mask request: 87
31274363 ICMP messages sent
0 ICMP messages failed
ICMP output histogram:
destination unreachable: 17235
time exceeded: 6
echo request: 584
echo replies: 31256496
timestamp requests: 4
timestamp replies: 38
IcmpMsg:
InType0: 519
InType3: 12385
InType8: 31256550
InType11: 7
InType13: 38
InType14: 4
InType15: 18
InType17: 87
InType37: 23
InType165: 23
OutType0: 31256496
OutType3: 17235
OutType8: 584
OutType11: 6
OutType13: 4
OutType14: 38
Tcp:
83061084 active connections openings
228457168 passive connection openings
10120176 failed connection attempts
66634474 connection resets received
1032 connections established
194719468285 segments received
303802796563 segments send out
393689996 segments retransmited
126107 bad segments received.
2611637745 resets sent
InCsumErrors: 60267
Udp:
524696654 packets received
6207 packets to unknown port received.
0 packet receive errors
532508922 packets sent
0 receive buffer errors
0 send buffer errors
UdpLite:
TcpExt:
53308 invalid SYN cookies received
9941962 resets received for embryonic SYN_RECV sockets
51 packets pruned from receive queue because of socket buffer overrun
8514 ICMP packets dropped because they were out-of-window
3486343 TCP sockets finished time wait in fast timer
39519279 TCP sockets finished time wait in slow timer
10913 passive connections rejected because of time stamp
1765 packets rejects in established connections because of timestamp
3469035831 delayed acks sent
1166770 delayed acks further delayed because of locked socket
Quick ack mode was activated 20460837 times
21159 times the listen queue of a socket overflowed
32135 SYNs to LISTEN sockets dropped
264888 packets directly queued to recvmsg prequeue.
45574288 bytes directly in process context from backlog
444237272 bytes directly received in process context from prequeue
106173559010 packet headers predicted
118340 packets header predicted and directly queued to user
8022602149 acknowledgments not containing data payload received
88651458774 predicted acknowledgments
24287671 times recovered from packet loss by selective acknowledgements
1 bad SACK blocks received
Detected reordering 7554 times using FACK
Detected reordering 4775 times using SACK
Detected reordering 3228 times using time stamp
5436 congestion windows fully recovered without slow start
6007 congestion windows partially recovered using Hoe heuristic
2656395 congestion windows recovered without slow start by DSACK
730936 congestion windows recovered without slow start after partial ack
TCPLostRetransmit: 11413154
972076 timeouts after SACK recovery
11391 timeouts in loss state
245558666 fast retransmits
8591359 forward retransmits
21274413 retransmits in slow start
4923871 other TCP timeouts
TCPLossProbes: 112468779
TCPLossProbeRecovery: 94647282
2301617 SACK retransmits failed
1 times receiver scheduled too late for direct processing
1596 packets collapsed in receive queue due to low socket buffer
20477405 DSACKs sent for old packets
37717 DSACKs sent for out of order packets
93676458 DSACKs received
10583 DSACKs for out of order packets received
64236162 connections reset due to unexpected data
65947 connections reset due to early user close
6268 connections aborted due to timeout
TCPSACKDiscard: 1
TCPDSACKIgnoredOld: 12821
TCPDSACKIgnoredNoUndo: 62129283
TCPSpuriousRTOs: 612581
TCPSackShifted: 308947475
TCPSackMerged: 410173050
TCPSackShiftFallback: 191165233
TCPDeferAcceptDrop: 34467
IPReversePathFilter: 25380
TCPRetransFail: 30045
TCPRcvCoalesce: 6992560873
TCPOFOQueue: 654814955
TCPOFOMerge: 38603
TCPChallengeACK: 660379
TCPSYNChallenge: 66622
TCPSpuriousRtxHostQueues: 72550
TCPAutoCorking: 31101563246
TCPFromZeroWindowAdv: 879
TCPToZeroWindowAdv: 884
TCPWantZeroWindowAdv: 10290
TCPSynRetrans: 17888328
TCPOrigDataSent: 230944418777
TCPHystartTrainDetect: 5900185
TCPHystartTrainCwnd: 171155215
TCPHystartDelayDetect: 21081
TCPHystartDelayCwnd: 3272500
TCPACKSkippedSynRecv: 12
TCPACKSkippedPAWS: 85
TCPACKSkippedSeq: 21918
TCPACKSkippedTimeWait: 35
TCPACKSkippedChallenge: 156
IpExt:
InMcastPkts: 198449
OutMcastPkts: 201
InBcastPkts: 39281084
InOctets: 337132214927778
OutOctets: 445692198946724
InMcastOctets: 61908851
OutMcastOctets: 31553
InBcastOctets: 3190817867
InNoECTPkts: 418945982547
InECT0Pkts: 517992
如果想看被拒绝的
[jiankunking@7b76fa ~]# netstat -s |grep reject
10913 passive connections rejected because of time stamp
1765 packets rejects in established connections because of timestamp
这个错误信息就是服务器tcp_tw_recycle参数引起的
https://blog.csdn.net/zhuyiquan/article/details/68925707?spm=1001.2014.3001.5506
79、
Vi/Vim
1、 粘贴时行首出现很多缩进和空格
在拷贝前输入:set paste (这样的话,vim就不会启动自动缩进,而只是纯拷贝粘贴)
vi 打开文件后,直接输入:set paste,然后再按i
2、 通过vi删除空行
//dd 删除当前行。
先按esc退出编辑模式,再dd即可
3、 vi 换行
进入非编辑模式,字母o
4、Vim用快捷键快速移动光标至行尾
1)按end键
2)按住shift + 4
Docker
1、 获取完整id
docker inspect -f '.Id' d8e703d7e303
2、 退出并不关闭容器
ctrl + p 再 ctrl+q
3、 推送镜像到私服
sudo docker push hub.docker.jiankunking.io:5000/jetty:jetty8
//冒号前后不要有空格
4、 docker build
docker build -t runoob/ubuntu:v1 .
docker build -t jiankunking/kafka:0.8.2.2 -f kafka.Dockerfile .
5、docker add
ADD还支持自动解压tar文件,比如ADD trusty-core-amd64.tar.gz /会线自动解压内容再COPY到在容器的/目录下。
6、删除名称或标签为none的镜像
docker rmi -f `docker images | grep '<none>' | awk 'print $3'`
7、容器删除删除所有未运行的容器(已经运行的删除不了,未运行的就一起被删除了)
sudo docker rm $(sudo docker ps -a -q)
删除没有被使用的镜像
docker rmi $(docker images -q)
8、docker var目录占用高问题
如果是/var/lib/docker/devicemapper/mnt占用率高
那就找出占用最高的文件
du -sh /var/lib/docker/devicemapper/mnt/*
此时的文件名称是DeviceName
然后
docker ps | awk 'print "docker inspect "$1'|grep -v CONTAINER|sh > ./inspect.log
docker ps | awk 'print "docker inspect "$1'|grep -v CONTAINER|sh > ./inspect.log
进入inspect查看docker信息 找到对应的正在运行的docker id
9、更新docker 重启策略
docker update --restart=always 11756183ff8a
https://docs.docker.com/engine/reference/commandline/update/
10、更新容器的内存限制
# --memory-swap -1 表示不限制
# -memory-swap 内存+交换分区大小总限制。格式同上。必须比-m设置的大
docker update -m 1024m --memory-swap -1 fea22ac3fdd7
11、容器内CPU、内存限制在/sys/fs/cgroup下
12、docker 查看容器的网络连接
#! /bin/bash
echo $1
PID=$(docker inspect -f '.State.Pid' $1)
nsenter -t $PID -n netstat |grep ESTABLISHED
sudo sh docker-netstat.sh demo
第一步可以用docker top 找到pid
13、当 OOM 发生时,系统会把相关的 OOM 信息,记录到日志中。所以,我们可以在终端中执行 dmesg 命令,查看系统日志,并定位 OOM 相关的日志。(即使docker容器OOM后,也可以查看)
14、docker的/var/lib/docker目录迁移
1 停止docker服务
systemctl stop docker
2 创建新的docker目录
mkdir -p /data/docker/lib
3 迁移/var/lib/docker
rsync -avzH /var/lib/docker /data/docker/lib/
4 修改配置路径
ln -s /data/docker/lib /var/lib/docker
5 重新加载 docker
systemctl daemon-reload
systemctl restart docker
systemctl enable docker
6 删除 /var/lib/docker
rm -rf /var/lib/docker
containerd
1、从宿主机拷贝文件到containerd
// 1、通过找到进程id
// 2、在宿主机从进入containerd所在目录
// 3、该目录就是containerd中的根目录/
cd /proc/<PID>/root
Idea
1、 idea 类中函数全部折叠
ctrl + shift + 减号
2、 idea 类中函数全部展开
ctrl + shift + 加号
3、 idea 回到调用方法
ctrl + alt + f7
4、查找接口的实现类
ctrl + alt +B
5、查看类或接口的继承关系
ctrl + h
6、查看一个方法的调用
Ctrl + Alt + H
7、重复代码快速重构(抽取重复代码)
Alt+Shift+M
Kafka
1、 查看kafka主题数据
bin/kafka-topics.sh --zookeeper 10.138.22.194:2181 --describe --topic count_test_one
2、 手动调用消费端
./kafka-console-consumer.sh --zookeeper localhost:2181 --topic count_test_one --from-beginning
./kafka-console-consumer.sh --zookeeper localhost:2181 --topic count_test_one
./kafka-console-consumer.sh --bootstrap-server 10.119.37.115:9092,10.119.37.147:9092,10.119.37.148:9092 --topic dubbo |grep xiaoneng
// 2.0
bin/kafka-console-consumer.sh --bootstrap-server 10.163.111.195:9092 --topic qd-aliyun --from-beginning
3、kafka启动
bin/kafka-server-start.sh -daemon config/server.properties
4、kafka 消费端启动
java -jar monitor-kafka-consumer-0.0.1-SNAPSHOT.jar -Dtopic=custom
5、查看kafka所有topic
bin/kafka-topics.sh --list --zookeeper localhost:2181
6、kafka消费端 消费指定主题
./kafka-console-consumer.sh --zookeeper localhost:2181 --topic xiaonengdubbo2
// 2.x
./kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic mysql-prod.console.org --partition 1
7、获取kafka中所有组
./kafka-consumer-groups.sh --bootstrap-server 127.0.0.1:9092 --list
8、查看kafka消费端堆积量
./kafka-consumer-groups.sh --bootstrap-server 127.0.0.1:9092 --group interconn --describe
9、查看kafka版本
find ./libs/ -name 'kafka_*.jar.asc' |head -n1 | cut -d'/' -f3
10、查看kafka某个topic下partition信息
./kafka-topics.sh --zookeeper 10.138.1.1:2181 --topic dubbo --describe
11、修改partition数量
./kafka-topics.sh --alter --zookeeper 10.230.204.83:2181,10.230.204.84:2181,10.230.204.85:2181 --topic cdc --partitions 6
12、修改副本数
配置文件:
83 84 85是kafka broker id
"version": 1,
"partitions": [
"topic": "cdc",
"partition": 0,
"replicas": [
83,
84
]
,
"topic": "cdc",
"partition": 1,
"replicas": [
84,
85
]
,
"topic": "cdc",
"partition": 2,
"replicas": [
83,
85
]
,
"topic": "cdc",
"partition": 3,
"replicas": [
84,
85
]
,
"topic": "cdc",
"partition": 4,
"replicas": [
83,
84
]
,
"topic": "cdc",
"partition": 5,
"replicas": [
83,
85
]
]
执行脚本:
./kafka-reassign-partitions.sh --zookeeper 10.230.204.83:2181,10.230.204.84:2181,10.230.204.85:2181 --reassignment-json-file reassignment.json --execute
Git
1、 git忽略文件命令
git update-index --assume-unchanged FILE 在FILE处输入要忽略的文件。
2、git rebase
# 引起冲突的commits会被丢弃,因此,在使用skip时请慎重。
git rebase --skip
# 可以运行git rebase –continue继续直到完成
git rebase --continue
3、git reflog
显示整个本地仓储的commit, 包括所有branch的commit, 甚至包括已经撤销的commit, 只要HEAD发生了变化, 就会在reflog里面看得到. git log只包括当前分支的commit.
4、git log --graph
–graph 参数会根据分枝提交历史绘出图像。这个命令通常和–oneline,–decorate一起使用
git log --graph --oneline --decorate
5、git log
可以使用–pretty=format:""来自定义输出的格式。输出格式有点像printf中的占位符。
举个例子,下面的命令中,%cn,%h和%cd会被提交者姓名,commit的hash缩写,提交的日期占据
git log --pretty=format:"%cn committed %h on %cd"
格式化参考
https://www.kernel.org/pub/software/scm/git/docs/git-log.html#_pretty_formats
6、git fetch
git fetch命令用于从另一个存储库下载对象和引用。
7、丢弃工作区的修改
命令git checkout – readme.txt意思就是,把readme.txt文件在工作区的修改全部撤销,这里有两种情况:
一种是readme.txt自修改后还没有被放到暂存区,现在,撤销修改就回到和版本库一模一样的状态;
一种是readme.txt已经添加到暂存区后,又作了修改,现在,撤销修改就回到添加到暂存区后的状态。
总之,就是让这个文件回到最近一次git commit或git add时的状态。
8、采用主分支上的/response.go文件
git checkout c4a651ba96d25a15adbecb21025f0d1d60901b6a pkg/models/response.go
9、终止git log 命令
按 q ,然后回车, 即可退出
Maven
1、打包时跳过测试
mvn clean package -Dmaven.test.skip=true
Zookeeper
1、zookeeper 节点 命令查看
./zkCli.sh -timeout 5000 -r -server localhost:2181
2、查看zk集群状态
echo mntr | nc localhost 2181
leader节点返回示例:
Zookeeper version: 3.5.7-f0fdd52973d373ffd9c86b81d99842dc2c7f660e, built on 02/10/2020 11:30 GMT
Clients:
/127.0.0.1:39436[1](queued=0,recved=493,sent=493)
/127.0.0.1:39526[1](queued=0,recved=479,sent=479)
/127.0.0.1:39510[1](queued=0,recved=507,sent=507)
/127.0.0.1:39410[1](queued=0,recved=459,sent=459)
/127.0.0.1:39424[1](queued=0,recved=517,sent=517)
/0:0:0:0:0:0:0:1:41446[0](queued=0,recved=1,sent=0)
/127.0.0.1:39416[1](queued=0,recved=494,sent=494)
/127.0.0.1:39404[1](queued=0,recved=491,sent=491)
/127.0.0.1:39514[1](queued=0,recved=486,sent=486)
/127.0.0.1:39496[1](queued=0,recved=490,sent=490)
Latency min/avg/max: 0/0/12
Received: 4770
Sent: 4453
Connections: 10
Outstanding: 0
Zxid: 0x5000000f4
Mode: leader
Node count: 313
Proposal sizes last/min/max: 36/32/36
You have mail in /var/spool/mail/root
follower节点返回:
zk_version 3.5.7-f0fdd52973d373ffd9c86b81d99842dc2c7f660e, built on 02/10/2020 11:30 GMT
zk_avg_latency 0
zk_max_latency 12
zk_min_latency 0
zk_packets_received 190
zk_packets_sent 189
zk_num_alive_connections 7
zk_outstanding_requests 0
zk_server_state follower
zk_znode_count 313
zk_watch_count 2
zk_ephemerals_count 4
zk_approximate_data_size 25605
zk_open_file_descriptor_count 106
zk_max_file_descriptor_count 65536
如果提示:mntr is not executed because it is not in the whitelist.
解决办法,修改 conf/zoo.cfg 添加以下属性
#开启四字命令
4lw.commands.whitelist=*
Nginx
1、nginx启动(nginx安装目录地址 -c nginx配置文件地址)
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
2、查看nginx配置文件
nginx -t
3、nginx 重启
查找当前nginx进程号,然后输入命令:kill -HUP 进程号 实现重启nginx服务
MySQL
1、查看mysql表分区
SELECT
partition_name part,
partition_expression expr,
partition_description descr,
table_rows
FROM
information_schema. PARTITIONS
WHERE
table_schema = SCHEMA ()
AND table_name = 'application_hour_count';
2、mysql 外键
禁用外键约束:
SET FOREIGN_KEY_CHECKS=0;
启动外键约束:
SET FOREIGN_KEY_CHECKS=1;
3、Mysql统计所有表数据量
SELECT
TABLE_NAME,
TABLE_ROWS
FROM
`information_schema`.`tables`
WHERE
`table_schema` = 'YOUR_DB_NAME'
ORDER BY
TABLE_ROWS DESC;
4、MySQL查询表中重复字段和重复的次数
SELECT
user_name,
count(*) AS count
FROM
USER
GROUP BY
user_name
HAVING
count > 1
ORDER BY
count DESC;
5、查看mysql的配置变量
show VARIABLES
具体结果
auto_increment_increment 1
auto_increment_offset 1
autocommit ON
automatic_sp_privileges OFF
avoid_temporal_upgrade OFF
back_log 512
basedir /usr/local/mysql/
big_tables OFF
bind_address *
binlog_cache_size 32768
binlog_checksum CRC32
binlog_direct_non_transactional_updates OFF
binlog_error_action ABORT_SERVER
binlog_format ROW
binlog_group_commit_sync_delay 0
binlog_group_commit_sync_no_delay_count 0
binlog_gtid_simple_recovery ON
binlog_max_flush_queue_time 0
binlog_order_commits ON
binlog_row_image FULL
binlog_rows_query_log_events ON
binlog_stmt_cache_size 32768
binlog_transaction_dependency_history_size 25000
binlog_transaction_dependency_tracking COMMIT_ORDER
block_encryption_mode aes-128-ecb
bulk_insert_buffer_size 8388608
character_set_client utf8mb4
character_set_connection utf8mb4
character_set_database utf8
character_set_filesystem binary
character_set_results utf8mb4
character_set_server utf8
character_set_system utf8
character_sets_dir /usr/local/mysql/share/charsets/
check_proxy_users OFF
collation_connection utf8mb4_general_ci
collation_database utf8_general_ci
collation_server utf8_general_ci
completion_type NO_CHAIN
concurrent_insert AUTO
connect_timeout 10
core_file OFF
datadir /data/mysql/
date_format %Y-%m-%d
datetime_format %Y-%m-%d %H:%i:%s
default_authentication_plugin mysql_native_password
default_password_lifetime 0
default_storage_engine InnoDB
default_tmp_storage_engine InnoDB
default_week_format 0
delay_key_write ON
delayed_insert_limit 100
delayed_insert_timeout 300
delayed_queue_size 1000
disabled_storage_engines
disconnect_on_expired_password ON
div_precision_increment 4
end_markers_in_json OFF
enforce_gtid_consistency OFF
eq_range_index_dive_limit 200
error_count 0
event_scheduler OFF
expire_logs_days 7
explicit_defaults_for_timestamp ON
external_user
flush OFF
flush_time 0
foreign_key_checks ON
ft_boolean_syntax + -><()~*:""&|
ft_max_word_len 84
ft_min_word_len 4
ft_query_expansion_limit 20
ft_stopword_file (built-in)
general_log OFF
general_log_file /data/mysql/cmp24.log
group_concat_max_len 10240
gtid_executed_compression_period 1000
gtid_mode OFF
gtid_next AUTOMATIC
gtid_owned
gtid_purged
have_compress YES
have_crypt YES
have_dynamic_loading YES
have_geometry YES
have_openssl DISABLED
have_profiling YES
have_query_cache YES
have_rtree_keys YES
have_ssl DISABLED
have_statement_timeout YES
have_symlink YES
host_cache_size 753
hostname cmp24
identity 0
ignore_builtin_innodb OFF
ignore_db_dirs
init_connect
init_file
init_slave
innodb_adaptive_flushing ON
innodb_adaptive_flushing_lwm 10
innodb_adaptive_hash_index ON
innodb_adaptive_hash_index_parts 8
innodb_adaptive_max_sleep_delay 150000
innodb_api_bk_commit_interval 5
innodb_api_disable_rowlock OFF
innodb_api_enable_binlog OFF
innodb_api_enable_mdl OFF
innodb_api_trx_level 0
innodb_autoextend_increment 64
innodb_autoinc_lock_mode 1
innodb_buffer_pool_chunk_size 134217728
innodb_buffer_pool_dump_at_shutdown ON
innodb_buffer_pool_dump_now OFF
innodb_buffer_pool_dump_pct 25
innodb_buffer_pool_filename ib_buffer_pool
innodb_buffer_pool_instances 8
innodb_buffer_pool_load_abort OFF
innodb_buffer_pool_load_at_startup ON
innodb_buffer_pool_load_now OFF
innodb_buffer_pool_size 10737418240
innodb_change_buffer_max_size 25
innodb_change_buffering all
innodb_checksum_algorithm crc32
innodb_checksums ON
innodb_cmp_per_index_enabled OFF
innodb_commit_concurrency 0
innodb_compression_failure_threshold_pct 5
innodb_compression_level 6
innodb_compression_pad_pct_max 50
innodb_concurrency_tickets 5000
innodb_data_file_path ibdata1:12M:autoextend
innodb_data_home_dir /data/mysql
innodb_deadlock_detect ON
innodb_default_row_format dynamic
innodb_disable_sort_file_cache OFF
innodb_doublewrite ON
innodb_fast_shutdown 1
innodb_file_format Barracuda
innodb_file_format_check ON
innodb_file_format_max Barracuda
innodb_file_per_table ON
innodb_fill_factor 100
innodb_flush_log_at_timeout 1
innodb_flush_log_at_trx_commit 1
innodb_flush_method
innodb_flush_neighbors 1
innodb_flush_sync ON
innodb_flushing_avg_loops 30
innodb_force_load_corrupted OFF
innodb_force_recovery 0
innodb_ft_aux_table
innodb_ft_cache_size 8000000
innodb_ft_enable_diag_print OFF
innodb_ft_enable_stopword ON
innodb_ft_max_token_size 84
innodb_ft_min_token_size 3
innodb_ft_num_word_optimize 2000
innodb_ft_result_cache_limit 2000000000
innodb_ft_server_stopword_table
innodb_ft_sort_pll_degree 2
innodb_ft_total_cache_size 640000000
innodb_ft_user_stopword_table
innodb_io_capacity 200
innodb_io_capacity_max 2000
innodb_large_prefix ON
innodb_lock_wait_timeout 3600
innodb_locks_unsafe_for_binlog OFF
innodb_log_buffer_size 16777216
innodb_log_checksums ON
innodb_log_compressed_pages ON
innodb_log_file_size 1073741824
innodb_log_files_in_group 2
innodb_log_group_home_dir ./
innodb_log_write_ahead_size 8192
innodb_lru_scan_depth 1024
innodb_max_dirty_pages_pct 75.000000
innodb_max_dirty_pages_pct_lwm 0.000000
innodb_max_purge_lag 0
innodb_max_purge_lag_delay 0
innodb_max_undo_log_size 1073741824
innodb_monitor_disable
innodb_monitor_enable
innodb_monitor_reset
innodb_monitor_reset_all
innodb_numa_interleave OFF
innodb_old_blocks_pct 37
innodb_old_blocks_time 1000
innodb_online_alter_log_max_size 134217728
innodb_open_files 1024
innodb_optimize_fulltext_only OFF
innodb_page_cleaners 4
innodb_page_size 16384
innodb_print_all_deadlocks OFF
innodb_purge_batch_size 300
innodb_purge_rseg_truncate_frequency 128
innodb_purge_threads 4
innodb_random_read_ahead OFF
innodb_read_ahead_threshold 56
innodb_read_io_threads 4
innodb_read_only OFF
innodb_replication_delay 0
innodb_rollback_on_timeout OFF
innodb_rollback_segments 128
innodb_sort_buffer_size 1048576
innodb_spin_wait_delay 6
innodb_stats_auto_recalc ON
innodb_stats_include_delete_marked OFF
innodb_stats_method nulls_equal
innodb_stats_on_metadata OFF
innodb_stats_persistent ON
innodb_stats_persistent_sample_pages 20
innodb_stats_sample_pages 8
innodb_stats_transient_sample_pages 8
innodb_status_output OFF
innodb_status_output_locks OFF
innodb_strict_mode ON
innodb_support_xa ON
innodb_sync_array_size 1
innodb_sync_spin_loops 30
innodb_table_locks ON
innodb_temp_data_file_path ibtmp1:12M:autoextend
innodb_thread_concurrency 0
innodb_thread_sleep_delay 10000
innodb_tmpdir
innodb_undo_directory ./
innodb_undo_log_truncate OFF
innodb_undo_logs 128
innodb_undo_tablespaces 0
innodb_use_native_aio ON
innodb_version 5.7.23
innodb_write_io_threads 4
insert_id 0
interactive_timeout 600
internal_tmp_disk_storage_engine InnoDB
join_buffer_size 4194304
keep_files_on_create OFF
key_buffer_size 8388608
key_cache_age_threshold 300
key_cache_block_size 1024
key_cache_division_limit 100
keyring_operations ON
large_files_support ON
large_page_size 0
large_pages OFF
last_insert_id 0
lc_messages en_US
lc_messages_dir /usr/local/mysql/share/
lc_time_names en_US
license GPL
local_infile ON
lock_wait_timeout 31536000
locked_in_memory OFF
log_bin ON
log_bin_basename /data/mysql/mysql-binlog
log_bin_index /data/mysql/mysql-binlog.index
log_bin_trust_function_creators ON
log_bin_use_v1_row_events OFF
log_builtin_as_identified_by_password OFF
log_error /data/mysql/error.log
log_error_verbosity 3
log_output FILE
log_queries_not_using_indexes OFF
log_slave_updates ON
log_slow_admin_statements OFF
log_slow_slave_statements OFF
log_statements_unsafe_for_binlog ON
log_syslog OFF
log_syslog_facility daemon
log_syslog_include_pid ON
log_syslog_tag
log_throttle_queries_not_using_indexes 0
log_timestamps SYSTEM
log_warnings 2
long_query_time 1.000000
low_priority_updates OFF
lower_case_file_system OFF
lower_case_table_names 1
master_info_repository FILE
master_verify_checksum OFF
max_allowed_packet 67108864
max_binlog_cache_size 18446744073709547520
max_binlog_size 1073741824
max_binlog_stmt_cache_size 18446744073709547520
max_connect_errors 200000
max_connections 3000
max_delayed_threads 20
max_digest_length 1024
max_error_count 64
max_execution_time 0
max_heap_table_size 33554432
max_insert_delayed_threads 20
max_join_size 18446744073709551615
max_length_for_sort_data 1024
max_points_in_geometry 65536
max_prepared_stmt_count 16382
max_relay_log_size 0
max_seeks_for_key 18446744073709551615
max_sort_length 1024
max_sp_recursion_depth 0
max_tmp_tables 32
max_user_connections 0
max_write_lock_count 18446744073709551615
metadata_locks_cache_size 1024
metadata_locks_hash_instances 8
min_examined_row_limit 0
multi_range_count 256
myisam_data_pointer_size 6
myisam_max_sort_file_size 9223372036853727232
myisam_mmap_size 18446744073709551615
myisam_recover_options OFF
myisam_repair_threads 1
myisam_sort_buffer_size 8388608
myisam_stats_method nulls_unequal
myisam_use_mmap OFF
mysql_native_password_proxy_users OFF
net_buffer_length 16384
net_read_timeout 30
net_retry_count 10
net_write_timeout 60
new OFF
ngram_token_size 2
offline_mode OFF
old OFF
old_alter_table OFF
old_passwords 0
open_files_limit 65535
optimizer_prune_level 1
optimizer_search_depth 62
optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,duplicateweedout=on,subquery_materialization_cost_based=on,use_index_extensions=on,condition_fanout_filter=on,derived_merge=on
optimizer_trace enabled=off,one_line=off
optimizer_trace_features greedy_search=on,range_optimizer=on,dynamic_range=on,repeated_subselect=on
optimizer_trace_limit 1
optimizer_trace_max_mem_size 16384
optimizer_trace_offset -1
parser_max_mem_size 18446744073709551615
performance_schema ON
performance_schema_accounts_size -1
performance_schema_digests_size 10000
performance_schema_events_stages_history_long_size 10000
performance_schema_events_stages_history_size 10
performance_schema_events_statements_history_long_size 10000
performance_schema_events_statements_history_size 10
performance_schema_events_transactions_history_long_size 10000
performance_schema_events_transactions_history_size 10
performance_schema_events_waits_history_long_size 10000
performance_schema_events_waits_history_size 10
performance_schema_hosts_size -1
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances -1
performance_schema_max_digest_length 1024
performance_schema_max_file_classes 80
performance_schema_max_file_handles 32768
performance_schema_max_file_instances -1
performance_schema_max_index_stat -1
performance_schema_max_memory_classes 320
performance_schema_max_metadata_locks -1
performance_schema_max_mutex_classes 210
performance_schema_max_mutex_instances -1
performance_schema_max_prepared_statements_instances -1
performance_schema_max_program_instances -1
performance_schema_max_rwlock_classes 40
performance_schema_max_rwlock_instances -1
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances -1
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 150
performance_schema_max_statement_classes 193
performance_schema_max_statement_stack 10
performance_schema_max_table_handles -1
performance_schema_max_table_instances -1
performance_schema_max_table_lock_stat -1
performance_schema_max_thread_classes 50
performance_schema_max_thread_instances -1
performance_schema_session_connect_attrs_size 512
performance_schema_setup_actors_size -1
performance_schema_setup_objects_size -1
performance_schema_users_size -1
pid_file /data/mysql/mysql.pid
plugin_dir /usr/local/mysql/lib/plugin/
port 3306
preload_buffer_size 32768
profiling ON
profiling_history_size 15
protocol_version 10
proxy_user
pseudo_slave_mode OFF
pseudo_thread_id 42389158
query_alloc_block_size 8192
query_cache_limit 1048576
query_cache_min_res_unit 4096
query_cache_size 0
query_cache_type OFF
query_cache_wlock_invalidate OFF
query_prealloc_size 8192
rand_seed1 0
rand_seed2 0
range_alloc_block_size 4096
range_optimizer_max_mem_size 8388608
rbr_exec_mode STRICT
read_buffer_size 131072
read_only OFF
read_rnd_buffer_size 262144
relay_log
relay_log_basename /data/mysql/cmp24-relay-bin
relay_log_index /data/mysql/cmp24-relay-bin.index
relay_log_info_file relay-log.info
relay_log_info_repository FILE
relay_log_purge ON
relay_log_recovery OFF
relay_log_space_limit 0
report_host
report_password
report_port 3306
report_user
require_secure_transport OFF
rpl_stop_slave_timeout 31536000
secure_auth ON
secure_file_priv NULL
server_id 3306100
server_id_bits 32
server_uuid 7b607ec8-2525-11e9-86f1-52f6795368e8
session_track_gtids OFF
session_track_schema ON
session_track_state_change OFF
session_track_system_variables time_zone,autocommit,character_set_client,character_set_results,character_set_connection
session_track_transaction_info OFF
sha256_password_proxy_users OFF
show_compatibility_56 OFF
show_create_table_verbosity OFF
show_old_temporals OFF
skip_external_locking ON
skip_name_resolve OFF
skip_networking OFF
skip_show_database OFF
slave_allow_batching OFF
slave_checkpoint_group 512
slave_checkpoint_period 300
slave_compressed_protocol OFF
slave_exec_mode STRICT
slave_load_tmpdir /tmp
slave_max_allowed_packet 1073741824
slave_net_timeout 60
slave_parallel_type DATABASE
slave_parallel_workers 0
slave_pending_jobs_size_max 16777216
slave_preserve_commit_order OFF
slave_rows_search_algorithms TABLE_SCAN,INDEX_SCAN
slave_skip_errors OFF
slave_sql_verify_checksum ON
slave_transaction_retries 10
slave_type_conversions
slow_launch_time 2
slow_query_log ON
slow_query_log_file /data/mysql/slow_query.log
socket /data/mysql/mysql.sock
sort_buffer_size 4194304
sql_auto_is_null OFF
sql_big_selects ON
sql_buffer_result OFF
sql_log_bin ON
sql_log_off OFF
sql_mode STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
sql_notes ON
sql_quote_show_create ON
sql_safe_updates OFF
sql_select_limit 18446744073709551615
sql_slave_skip_counter 0
sql_warnings OFF
ssl_ca
ssl_capath
ssl_cert
ssl_cipher
ssl_crl
ssl_crlpath
ssl_key
stored_program_cache 256
super_read_only OFF
sync_binlog 0
sync_frm ON
sync_master_info 10000
sync_relay_log 10000
sync_relay_log_info 10000
system_time_zone CST
table_definition_cache 912
table_open_cache 1024
table_open_cache_instances 16
thread_cache_size 512
thread_handling one-thread-per-connection
thread_stack 262144
time_format %H:%i:%s
time_zone SYSTEM
timestamp 1647388592.535236
tls_version TLSv1,TLSv1.1
tmp_table_size 33554432
tmpdir /tmp
transaction_alloc_block_size 8192
transaction_allow_batching OFF
transaction_isolation READ-COMMITTED
transaction_prealloc_size 4096
transaction_read_only OFF
transaction_write_set_extraction OFF
tx_isolation READ-COMMITTED
tx_read_only OFF
unique_checks ON
updatable_views_with_limit YES
version 5.7.23-log
version_comment MySQL Community Server (GPL)
version_compile_machine x86_64
version_compile_os el7
wait_timeout 600
warning_count 0
MongoDB
1、登陆MongoDB
sudo ssh jianku以上是关于个人常用命令集锦 持续更新的主要内容,如果未能解决你的问题,请参考以下文章