ceph中pg中对象数量大小超过集群平均值时会有报警,问题:
- 为什么要设置该报警?
- ceph中pg中对象数量多少算多?
- 如何在线修改pg数量?
DevOps
ceph中pg中对象数量大小超过集群平均值时会有报警,问题:
1 2 3 4 |
# ceph daemon osd.2 config set mon_pg_warn_max_object_skew 20 { "success": "mon_pg_warn_max_object_skew = '20.000000' (not observed, change may require restart) rocksdb_separate_wal_dir = 'false' (not observed, change may require restart) " } |
思考:
1 |
# ceph osd df |
mon_max_pg_per_osd
option on the monitors. The older mon_pg_warn_max_per_osd
option has been removed.
参考:
使用dd读取一个大文件时,速度可达 100MB+/s, 但是cat读取大文件时,速度才达到 30MB/s,为何?
由于ceph块儿设备是从网络上读取数据,读取数据的效率和网络的性能由于直接关系,同时也和每次读取的块儿的大小有直接关系:
1 2 3 4 5 |
# dd if=/data2/bigfile bs=100M count=20 iflag=direct |pv >/dev/null 记录了20+0 的读入 136MiB/s] [ <=> ] 记录了20+0 的写出 2097152000字节(2.1 GB)已复制,16.5394 秒,127 MB/秒 1.95GiB 0:00:16 [ 120MiB/s] |
在块儿大小为100MB的情况下,读取速度可达到 120MB/s
1 2 3 4 5 |
# dd if=/data2/bigfile bs=1M count=3000 iflag=direct |pv >/dev/null 记录了3000+0 的读入.2MiB/s] [ <=> ] 记录了3000+0 的写出 3145728000字节(3.1 GB)已复制,42.9703 秒,73.2 MB/秒 2.93GiB 0:00:42 [69.8MiB/s] |
在块儿大小为1MB的情况下,读取速度可达到 70MB/s
1 2 3 4 5 |
# dd if=/data2/bigfile bs=64K count=3000 iflag=direct |pv >/dev/null 记录了3000+0 的读入.8MiB/s] [ <=> ] 记录了3000+0 的写出 196608000字节(197 MB)已复制,6.63725 秒,29.6 MB/秒 187MiB 0:00:06 [28.2MiB/s] |
在块儿大小为64KB的情况下,读取速度可达到 30MB/s; ,然而cat命令每次read的大小正好是64KB
针对这种情况,如果本机有较大内存的话,不妨先通过dd大块儿的方法使得文件被cache起来,然后再做其它类似cat的操作;
另外: 增加IO大小,到达底层之后,会变成多个IO请求,相当于底层同时又多个IO请求,实际上是相当于增加了队列深度。
1 2 |
# ceph osd erasure-code-profile ls default |
1 2 3 4 5 |
# ceph osd erasure-code-profile get default k=2 m=1 plugin=jerasure technique=reed_sol_van |
1 |
# ceph osd erasure-code-profile set hdd-3-2 k=3 m=2 crush-device-class=hdd |
default
].host
].lrc
plugin, l): these determine the number of erasure code shards, affecting the resulting CRUSH rule.
1 2 |
# ceph osd crush rule create-erasure erasure_hdd hdd-3-2 created rule erasure_hdd at 5 |
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 28 29 30 31 32 |
# ceph osd crush rule dump erasure_hdd { "rule_id": 5, "rule_name": "erasure_hdd", "ruleset": 5, "type": 3, "min_size": 3, "max_size": 5, "steps": [ { "op": "set_chooseleaf_tries", "num": 5 }, { "op": "set_choose_tries", "num": 100 }, { "op": "take", "item": -2, "item_name": "default~hdd" }, { "op": "chooseleaf_indep", "num": 0, "type": "host" }, { "op": "emit" } ] } |
1 2 |
# ceph osd pool create test-bigdata 256 256 erasure hdd-3-2 erasure_hdd pool 'test-bigdata' created |
1 2 |
# ceph osd pool set test-bigdata fast_read 1 set pool 24 fast_read to 1 |
1 2 |
# ceph osd pool set test-bigdata allow_ec_overwrites true set pool 24 allow_ec_overwrites to true |
1 2 3 4 5 6 7 8 9 10 11 |
# ceph osd pool create test-bigdata-cache-tier 128 pool 'test-bigdata-cache-tier' created # ceph osd tier add test-bigdata test-bigdata-cache-tier pool 'test-bigdata-cache-tier' is now (or already was) a tier of 'test-bigdata' # ceph osd tier cache-modetest-bigdata-cache-tier writeback set cache-mode for pool 'test-bigdata-cache-tier' to writeback # ceph osd tier set-overlay test-bigdata test-bigdata-cache-tier overlay for 'test-bigdata' is now (or already was) 'test-bigdata-cache-tier' |
1 2 3 4 5 |
# ceph osd pool set test-bigdata-cache-tier hit_set_count 1 set pool 29 hit_set_count to 1 # ceph osd pool set test-bigdata-cache-tier hit_set_type bloom set pool 29 hit_set_type to bloom |
参考:
实战中的问题:
1 |
ceph osd pool ls detail|grep cache_mode |
当vsftpd在容器里面,而且容器IP又是host内部的私有IP的情况,client采用passive模式来下载数据能行得通吗? 可以的
每个kvm虚拟机进程,如果挂载N个rbd设备,则会有N个 fn-radosclient 线程,每个fn-radosclient 线程针对特定的osd只有一个connection; 如此,一个rbd设备上的某块儿数据如果落在了相同的osd上,(猜测rados协议不会再同一个连接上同时做多个事务),则意味着不可能并行写入,于是乎,特别是对于随机读写,网络延迟对存储效率有着直接的影响,即使虚拟机内部多线程也无济于事,因为kvm进程中的fn-radosclient 只有一个
1 2 |
# top -p 2795 -b -n 1 -H|grep rados 2816 qemu 20 0 5259308 3.403g 7356 S 0.0 3.6 15:01.80 fn-radosclient |
<($cmd) 可以模拟类似协程的效果,如下:
1 2 3 4 5 6 7 8 |
# cat <(while :; do echo 1; sleep 1; done ) 1 1 1 1 1 1 ^C |
当然,效果上虽然和走管道类似,但是如果程序不支持读标准输入的话,这也不失为一种不错的替代; 当然,这个也可以用于标准输入的重定向:
1 |
# cat < <(while :; do echo 1; sleep 1; done ) |
这两种写法只差一个 < ,后者是shell直接帮做了标准输入的重定向,前者没有做标准输入的重定向,只是向打开普通文件一样的方式打开了bash帮忙生成的一个临时文件。
这种语法 叫做Process Substitution
分析指定目录下一级子目录的使用情况:
脚本:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#!/bin/bash # 分析目标下的所有子目录 target=$1 time_start=$(date +%s) entry=$(ossutil64 ls -d $target | grep "^oss://") printf "%-32s%16s%16s%16s%16s%16s%10s%9s%20s\n" "DIR" "<100KB" "<300KB" "<1MB" "<5MB" ">5MB" "All" "Capcity" "lastmodify" for e in $entry; do ossutil64 ls $e |awk -v e=$e -f fenxi.awk done time_end=$(date +%s) time_use=$((time_end - time_start)) echo echo elapsed time: $(( time_use / 3600 )) hours $(( time_use % 3600 / 60)) mins $(( time_use % 60)) s |
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 28 29 30 31 |
function format_capcity(num) { KB=1024; MB=KB*1024; GB=MB*1024; TB=GB*1024; if(num > TB) return sprintf("%6.2fTB", num/TB); if(num > GB) return sprintf("%6.2fGB", num/GB); if(num > MB) return sprintf("%6.2fMB", num/MB); if(num > KB) return sprintf("%6.2fKB", num/KB); return sprintf("%6d", num); } BEGIN{ k100=0;k300=0;m1=0;m5=0;marge=0;all=0;lastmodify=0;capcity_all=0; } NR>1 && $8 ~ /^oss:/ { all++; capcity_all+=$5; if($5 < 102400) k100++; else if($5 < 1024*300) k300++; else if($5 < 1024*1000) {m1++;} else if ($5 < 1024 * 1024 * 5) {m5++;} else large++; if (lastmodify < $1"T"$2) lastmodify=$1"T"$2; } END{ gsub("oss://[^/]+", "", e) printf("%-32s%9s(%4.1f%%)%9s(%4.1f%%)%9s(%4.1f%%)%9s(%4.1f%%)%9s(%4.1f%%)%10s%9s%20s\n", e, k100, k100*100/all,k300, k300*100/all,m1, m1*100/all,m5, m5*100/all,large, large*100/all, all, format_capcity(capcity_all), lastmodify); } |
命令:
1 2 3 4 5 6 7 |
DIR <100KB <300KB <1MB <5MB >5MB All Capcity lastmodify /dir1/ 2602(16.8%) 7584(49.0%) 3752(24.2%) 1548(10.0%) 2( 0.0%) 15488 11.34GB 2016-06-07T16:15:10 /dir2/ 26( 1.2%) 0( 0.0%) 1( 0.0%) 61( 2.9%) 2034(95.9%) 2122 26.09TB 2018-01-26T18:08:38 /dir3/ 1(10.0%) 1(10.0%) 2(20.0%) 2(20.0%) 4(40.0%) 10 235.13MB 2016-02-22T15:03:58 /dir4/ 0( 0.0%) 0( 0.0%) 0( 0.0%) 0( 0.0%) 2(100.0%) 2 396.21MB 2017-03-09T10:17:27 elapsed time: 0 hours 0 mins 3 s |
注意:
1 |
sed s/\(\ /\(/g |
awk 知识点:
一般来讲:
1 |
cat a.txt |wc -l |
我们都知道这是什么意思,或者:
1 |
cat a.txt >/dev/null |
但是:
1 |
<a.txt >/dev/null cat |
这又是什么鬼?
其实,仅仅是把重定向写到命令前面而已, 等效于:
1 |
cat <a.txt >/dev/null |
而且都是之影响一条可执行命令而已:
1 2 |
>/tmp/c echo a && echo b b |
这个只影响echo a 的输出重定向,没有影响到echo b 的输出重定向
缘起:
我从赛门铁克买的证书是Verisign签发的,后来说是证书有问题,需要重签,拿到的证书就成了DigiCert签发的了;而且邮件里面给出的证书的安装配置和使用方案,请参考:
https://www.itrus.cn/service_13.html 这个地址是天威诚信的网站。
那么, Verisign / Symantec / DigiCert / 天威诚信 都是啥关系?
天威诚信是Symantes中国大陆地区的首要合作伙伴。
2010年8月,赛门铁克收购VeriSign,VeriSign认证服务现均由赛门铁克提供。赛门铁克重点在2012年4月对VeriSign的产品名称和品牌标识进行变更;
2017年8月份, 赛门铁克把web安全业务卖给了DigiCert , 并占有DigiCert 30% 的普通股: http://www.cnbeta.com/articles/tech/637909.htm
更多: GeoTrust 似乎也是重要的SSL证书提供商,那么和上述的机构是否也有关系呢?
参考: https://baike.baidu.com/item/verisign/8794893
VeriSign 是全球最大的数字证书颁发机构,于 2006 年 9 月以 1.25 亿美元完成收购 GeoTrust ,当时 GeoTrust 约占全球 25% 市场分额。VeriSign通过与中国内地数字认证服务商天威诚信合作共同推进数字证书业务在国内的发展
中国也有根CA了:
中国金融认证中心(CFCA)证书,由中国数字证书认证机构自主研发,纯国产证书。*注: CFCA服务器证书目前不支持苹果iOS 10.1及10.1以前的版本,不支持安卓6.0以前的版本
阿里云购买证书似乎便宜些:(方便比价)
https://common-buy.aliyun.com/?spm=5176.7968328.1120760.1.67f91232806dKi&commodityCode=cas#/buy
https://www.aliyun.com/product/cas?utm_content=se_1550552
参考:
http://www.ert7.com/symantecs.html
https://marketrealist.com/2017/08/why-symantec-sold-its-web-security-business-to-digicert
http://www.cnbeta.com/articles/soft/636841.htm
http://tech.sina.com.cn/roll/2017-03-28/doc-ifycspxp0209037.shtml
https://www.digicert.com/blog/digicert-to-acquire-symantec-website-security-business/
https://www.symantec.com/about/newsroom/press-releases/2017/symantec_0802_01