Closed opskumu closed 5 years ago
tps
「iops
」# iostat 1
# sar -b 1
deadline
电梯算法,可实现一定的性能增加cat /sys/block/vda/queue/scheduler
CFQ
(the default scheduler nowadays) aggregates all ideas from above and adds cgroup support that allows to reserve some amount of IO to a specific cgroup. It is useful on shared (and cloud) hosting - users who paid for 20 IO/s want to get their share if needed.The characteristics of a SSD are different. It does not have moving parts. Random access is as fast as sequential one. An SSD can handle multiple requests at the same time. Modern devices' throughput ~10K IO/s, which is higher than workload on most systems. Essentially a user cannot generate enough requests to saturate a SDD, the requests queue is effectively always empty. In this case IO scheduler does not provide any improvements. Thus, it is recommended to use the
noop
scheduler for anSSD
.
tcpdump -vv -i eth0 -n arp
tcpdump -vv -i eth0 -nn icmp and host 172.16.0.1
-e
输出链路层报头-w file
将原始数据写入文件中 smartctl
磁盘健康信息检测「只针对单块磁盘,RAID 组磁盘需要借助 MegaCli
」sed -i 's/first/FIRST/g; s/second/SECOND/g; s/third/THIRD/g;' test.txt
对应网卡配置文件添加 MAC 地址解决问题
# /etc/sysconfig/network-scripts/ifcfg-eth0
... ...
HWADDR=00:xx:xx:xx:xx:xx
... ...
http/https
代理设置export http_proxy=x.x.x.x:xx https_proxy=x.x.x.x:xx
Here document
可以不顶格写,通过 <<-
实现,另外必须使用 tab
分隔而不是空格键
#! /bin/bash
cat <<-EOF
indented
EOF
Note that you must use tabs, not spaces to indent the here-doc. Can't indent heredoc to match nesting's indent
On RHEL 6 to respawn a script, go to /etc/init and create a file
cd /etc/init
vi scriptFileName.conf
And add this content
start on stopped rc RUNLEVEL=[12345]
stop on runlevel [!12345]
respawn
exec /you/respawned/script.sh -your -parameters
Save file and then launch this command (without .conf of file)
start scriptFileName
pwmake
pwmake
用于生成随机密码,可由四种字符组成:大写字母
、小写字母
、数字
和特殊符号
。熵值产生于 /dev/urandom
,指定最小熵值为 56
位。创建一个 128 位的密码,则要运行下列命令:
pwmake 128
➜ ~ cloc ./
1389 text files.
1250 unique files.
195 files ignored.
github.com/AlDanial/cloc v 1.72 T=14.26 s (83.8 files/s, 56992.9 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Go 1094 43245 51420 703157
Markdown 39 1127 0 3525
Protocol Buffers 23 1412 3120 2474
JSON 4 2 0 1965
Bourne Shell 7 42 53 253
C 3 39 11 245
YAML 15 50 31 232
Python 1 14 13 99
make 5 36 68 99
C/C++ Header 2 14 8 55
Dockerfile 2 14 9 46
-------------------------------------------------------------------------------
SUM: 1195 45995 54733 712150
man 7 signal
、kill -l
# kill -l
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP
6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1
11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM
16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP
21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ
26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGPWR
31) SIGSYS 34) SIGRTMIN 35) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+3
38) SIGRTMIN+4 39) SIGRTMIN+5 40) SIGRTMIN+6 41) SIGRTMIN+7 42) SIGRTMIN+8
43) SIGRTMIN+9 44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13
48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12
53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7
58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2
63) SIGRTMAX-1 64) SIGRTMAX
CTRL+C
:发送 SIGINT
信号,该信号默认行为是终止进程CTRL+\
:发送 SIGQUIT
信号,该信好默认行为是终止进程并核心转储CTRL+Z
:发送 SIGSTOP
信号,该信号默认行为是挂起进程> use test
> db.createUser({user:'test',pwd:'test',roles:['readWrite','dbAdmin']})
Successfully added user: { "user" : "test", "roles" : [ "readWrite", "dbAdmin" ] }
>
unmount
针对 device busy 的目录fusermount -uz /path/to/
cron
: http://docs.ansible.com/ansible/latest/cron_module.html
ansible <host> -m cron -a 'name=docker-gc minute=0 hour=2 job="docker run -e GRACE_PERIOD_SECONDS=86400 --rm -v /var/run/docker.sock:/var/run/docker.sock -v /etc:/etc:ro spotify/docker-gc" state=present'
#!/bin/bash
while read line
do
echo $line
done < filename
#!/bin/bash
cat filename | while read line
do
echo $line
done
ln