https://item.jd.com/1179011.html
读速度: 60MB/s
写速度: 88MB/s
测试方法:
1 |
dd if=/dev/zero of=bigfile bs=10m count=1200 -oflag=direct |
1 |
dd if=bigfile of=/dev/null bs=10m count=1200 -iflag=direct |
DevOps
https://item.jd.com/1179011.html
读速度: 60MB/s
写速度: 88MB/s
测试方法:
1 |
dd if=/dev/zero of=bigfile bs=10m count=1200 -oflag=direct |
1 |
dd if=bigfile of=/dev/null bs=10m count=1200 -iflag=direct |
有一种文件下载方式为: 把知道的下载源都组织到一个文件中(metalink,扩展名 meta4),这些下载源可以是不同的协议(http、ftp、bt等),然后就有一种工具(linux上为aria,mac上为speed download,windows上有getright 等)会参考该文件,同时从多个下载源下载该文件,这样的话,只要下载源够多,基本不会受下载源带宽限制,就看自己有多大带宽了;下载opensuse(4.1GB)使用metalink文件 紧花费了不到10分钟时间
一般来讲,多线程并行下载是不错的办法,但是同时从不同的下载源(而且是不同的下载协议)来下载,就更加疯狂了
参考资料 :
脚本:
1 2 3 4 5 6 7 8 9 10 |
#!/bin/bash #name mssh.sh #usage: ./mssh.sh host-1 host-2 host-3 'cmd' cmd="${@: -1}" #取最后一个参数,这里冒号后面的空格不能省略 hosts=("$@") for ((i=0; i < $# - 1; i++)) ;do host=${hosts[$i]} echo "#@$host" echo ssh $host "$cmd" done |
用法:
1 |
./mssh.sh host-1 host-2 host-3 'ls' |
截屏: (这里仅仅输出了要执行的命令,使用时把echo ssh中的echo去掉就好)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# nsenter -h 用法: nsenter [options] <program> [<argument>...] Run a program with namespaces of other processes. 选项: -t, --target <pid> 要获取名字空间的目标进程 -m, --mount[=<file>] enter mount namespace -u, --uts[=<file>] enter UTS namespace (hostname etc) -i, --ipc[=<file>] enter System V IPC namespace -n, --net[=<file>] enter network namespace -p, --pid[=<file>] enter pid namespace -U, --user[=<file>] enter user namespace -S, --setuid <uid> set uid in entered namespace -G, --setgid <gid> set gid in entered namespace --preserve-credentials do not touch uids or gids -r, --root[=<dir>] set the root directory -w, --wd[=<dir>] set the working directory -F, --no-fork 执行 <程序> 前不 fork -Z, --follow-context set SELinux context according to --target PID -h, --help 显示此帮助并退出 -V, --version 输出版本信息并退出 更多信息请参阅 nsenter(1)。 |
从 help 来看,只要使用了 -p 选项,就可以进入目标进程的pid名字空间,换言之,就可以只看到目标进程所在的名字空间的进程,用法如下:
1 |
nsenter -p -t $pid $cmd |
事实上,
1 |
nsenter -p -t 6806 top -n 1 |
看到的却是nsenter当前所在名字空间(严格来讲,这样描述也不太准确)的所有进程,为什么呢?
因为top参考的是 /proc 文件系统,所以,进入相应的mount空间也很重要,所以,正确的写法为:
1 |
nsenter -m -p -t 6806 top -n 1 |
syslog协议的第一部分是尖括号引用的一个数字,如: <182>
该数字大小范围为: 0 ~ 255, 为1个字节表达的数字,包含两部分内容:
低三位: (0 ~ 7)称作: Severity
1 2 3 4 5 6 7 8 9 10 11 |
Numerical Severity Code 0 Emergency: system is unusable 1 Alert: action must be taken immediately 2 Critical: critical conditions 3 Error: error conditions 4 Warning: warning conditions 5 Notice: normal but significant condition 6 Informational: informational messages 7 Debug: debug-level messages |
高5位(右移3位后): (0 ~ 31)称作:Facility
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
Numerical Facility Code 0 kernel messages 1 user-level messages 2 mail system 3 system daemons 4 security/authorization messages (note 1) 5 messages generated internally by syslogd 6 line printer subsystem 7 network news subsystem 8 UUCP subsystem 9 clock daemon (note 2) 10 security/authorization messages (note 1) 11 FTP daemon 12 NTP subsystem 13 log audit (note 1) 14 log alert (note 1) 15 clock daemon (note 2) 16 local use 0 (local0) 17 local use 1 (local1) 18 local use 2 (local2) 19 local use 3 (local3) 20 local use 4 (local4) 21 local use 5 (local5) 22 local use 6 (local6) 23 local use 7 (local7) |
根据尖括号中的数字还原上面两个部分的方法,以 182 为例:
1 2 3 4 |
lijunjiedeMacBook-Pro:~ phpor$ php -r 'echo 182 & 0x07;' 6 lijunjiedeMacBook-Pro:~ phpor$ php -r 'echo (182 >> 3) & 0x1f;' 22 |
即: local6的information
1 |
# diff <(cd /data1/weedfs/volume4.2; find . -type f -printf "%p %s\n" ) <(cd /mnt/weedfs/volume4.2; find . -type f -printf "%p %s\n" ) |
diff 可以比较两个文件,那么能否比较两个字符串呢(主要是懒得创建文件),其实是可以的,如:
不仅仅diff可以这么玩, vimdiff也能这么玩,如:
1 |
#vimdiff <(echo 0) <(echo 1) |
那么,比较的两部分算是什么呢?
其实也是两个文件,如下:
这是两个什么文件呢?其实是两个pipe,如下:
这里vimdiff还为这两个pipe创建了两个交换文件.
知识点:
bash中 “<(list)” 是一种语法结构,叫做Process Substitution :
Process substitution allows a process’s input or output to be referred to using a filename. It takes the form of
1 |
<(list) |
or
1 |
>(list) |
The process list is run asynchronously, and its input or output appears as a filename. This filename is passed as an argument to the current command as the result of the expansion. If the >(list)
form is used, writing to the file will provide input for list. If the <(list)
form is used, the file passed as an argument should be read to obtain the output of list. Note that no space may appear between the <
or >
and the left parenthesis, otherwise the construct would be interpreted as a redirection. Process substitution is supported on systems that support named pipes (FIFOs) or the /dev/fd method of naming open files.
When available, process substitution is performed simultaneously with parameter and variable expansion, command substitution, and arithmetic expansion.
该语法结构在zsh中记作: =(list)
注意1:
这里产生的文件是管道,是管道,是管道,只能读一次,不能到做普通文件使用,如:
这里cat了两次,只输出一次hello
为什么写个简单的测试还要放在function里面?拿出来不好使
脚本:
1 2 3 4 5 6 7 |
#!/bin/bash function hello() { f=<(echo hello) cat $f cat $f } hello |
注意2:
进程替换只对于bash生效,对于sh不生效; sh 不理解进程替换,至少对于4.2.46版本的bash来讲,如果把bash mv成为 sh,就不再理解进程替换了; 更有甚者,如果 sh 软连接到bash,然后使用sh执行上面脚本就得出现错误
参考:
https://unix.stackexchange.com/questions/62140/filesize-difference-of-same-name-folders
http://tiswww.case.edu/php/chet/bash/bashref.html#Process-Substitution
ceph osd down $id: 将osd $id 标记为down(mark down),达到不再访问的效果,并不真正停止进程,(仍然参与hash?),ceph osd tree 查看的时候,依然可能是up的状态
ceph osd out $id: 将weight 设置为0(零), 达到不再访问的效果,(不参与hash?)
ceph osd lost $id: 删除该osd上的所有数据,该操作比较危险,需要明确指定 –yes-i-really-mean-it, 如:
ceph osd rm $id: 从集群中彻底删除该osd;如果要删除某osd,必须先停止进程,仅仅标记为down(ceph osd down $id) 是不够的,如:
1 2 |
# /bin/ceph osd rm 3 Error EBUSY: osd.3 is still up; must be down before removal. |
停止指定osd进程:
仅仅rm掉osd还是可以在ceph osd tree中看到,如下:
需要从crush中移除:
然而,依然删除的不够干净,如 auth中还有相关信息:
删除:
查看所有osd: