鏇挎崲OSD鎿嶄綔鐨勪紭鍖栦笌鍒嗘瀽
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了鏇挎崲OSD鎿嶄綔鐨勪紭鍖栦笌鍒嗘瀽相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/%e6%b3%a8%e6%84%8f' title='娉ㄦ剰'>娉ㄦ剰 grep get roo 鍒ゆ柇 lin 鍓湰 orm add
http://www.zphj1987.com/2016/09/19/%E6%9B%BF%E6%8D%A2OSD%E6%93%8D%E4%BD%9C%E7%9A%84%E4%BC%98%E5%8C%96%E4%B8%8E%E5%88%86%E6%9E%90/
鍓嶈█
涔嬪墠鏈夊啓杩囦竴绡?a href="http://www.zphj1987.com/2016/01/12/%E5%88%A0%E9%99%A4osd%E7%9A%84%E6%AD%A3%E7%A1%AE%E6%96%B9%E5%BC%8F/" rel="external" target="_blank">鍒犻櫎OSD鐨勬纭柟寮?/a>锛岄噷闈㈠彧鏄畝鍗曠殑璁蹭簡涓嬪垹闄ょ殑鏂瑰紡鎬庢牱鑳藉噺灏戣縼绉婚噺锛屾湰绡囧睘浜庝竴涓墿灞曪紝璁茶堪浜?Ceph 杩愮淮褰撲腑缁忓父鍑虹幇鐨勫潖鐩樻彁鎹㈢洏鐨勬楠ょ殑浼樺寲
鍩虹鐜涓ゅ彴涓绘満姣忓彴涓绘満8涓?OSD锛屼竴鍏?16 涓?OSD锛屽壇鏈缃负2锛孭G 鏁拌缃负800锛岃绠椾笅鏉ュ钩鍧囨瘡涓?OSD 涓婄殑 P G鏁扮洰涓?00涓紝鏈瘒灏嗛€氳繃鏁版嵁鏉ュ垎鏋愪笉鍚岀殑澶勭悊鏂规硶鐨勫樊鍒?/p>
寮€濮嬫祴璇曞墠鍏堟妸鐜璁剧疆涓?nbsp;noout
锛岀劧鍚庨€氳繃鍋滄 OSD 鏉ユā鎷?OSD 鍑虹幇浜嗗紓甯革紝涔嬪悗杩涜涓嶅悓澶勭悊鏂规硶
娴嬭瘯涓夌鏂规硶
棣栧厛 out 涓€涓?OSD锛岀劧鍚庡墧闄?OSD锛岀劧鍚庡鍔?OSD
- 鍋滄鎸囧畾 OSD 杩涚▼
- out 鎸囧畾 OSD
- crush remove 鎸囧畾 OSD
- 澧炲姞涓€涓柊鐨?OSD
涓€鑸敓浜х幆澧冧細璁剧疆涓?nbsp;noout
锛屽綋鐒朵笉璁剧疆涔熷彲浠ワ紝閭e氨浜ょ粰绋嬪簭鍘绘帶鍒惰妭鐐圭殑 out锛岄粯璁ゆ槸鍦ㄨ繘绋嬪仠姝㈠悗鐨勪簲鍒嗛挓锛屾€讳箣杩欎釜鍦版柟濡傛灉鏈?out 瑙﹀彂锛屼笉绠℃槸浜轰负瑙﹀彂锛岃繕鏄嚜鍔ㄨЕ鍙戞暟鎹祦鏄竴瀹氱殑锛屾垜浠繖閲屼负浜嗕究浜庢祴璇曪紝浣跨敤鐨勬槸浜轰负瑙﹀彂锛屼笂闈㈡彁鍒扮殑棰勫埗鐜灏辨槸璁剧疆鐨?nbsp;noout
寮€濮嬫祴璇曞墠鑾峰彇鏈€鍘熷鐨勫垎甯?/p>
[root@lab8106 ~]# ceph pg dump pgs|awk 鈥榹print $1,$15鈥榺grep -v pg > pg1.txt
|
鑾峰彇褰撳墠鐨?PG 鍒嗗竷,淇濆瓨鍒版枃浠秔g1.txt锛岃繖涓?PG 鍒嗗竷璁板綍鏄?PG 鎵€鍦ㄧ殑 OSD锛岃褰曚笅鏉ワ紝鏂逛究鍚庨潰杩涜姣旇緝锛屼粠鑰屽緱鍑洪渶瑕佽縼绉荤殑鏁版嵁
鍋滄鎸囧畾鐨?OSD 杩涚▼
[root@lab8106 ~]# systemctl stop ceph-osd@15
|
鍋滄杩涚▼骞朵笉浼氳Е鍙戣縼绉伙紝鍙細寮曡捣 PG 鐘舵€佺殑鍙樺寲锛屾瘮濡傚師鏉ヤ富 PG 鍦ㄥ仠姝㈢殑 OSD 涓婏紝閭d箞鍋滄鎺?OSD 浠ュ悗锛屽師鏉ョ殑鍓湰鐨勯偅涓?PG 灏变細瑙掕壊鍗囩骇涓轰富 PG 浜?/p>
out 鎺変竴涓?OSD
[root@lab8106 ~]# ceph osd out 15
|
鍦ㄨЕ鍙?out 浠ュ墠锛屽綋鍓嶇殑 PG 鐘舵€佸簲璇ユ湁 active+undersized+degraded
,瑙﹀彂 out 浠ュ悗锛屾墍鏈夌殑 PG 鐨勭姸鎬佸簲璇ヤ細鎱㈡參鍙樻垚 active+clean
,绛夊緟闆嗙兢姝e父鍚庯紝鍐嶆鏌ヨ褰撳墠鐨?PG 鍒嗗竷鐘舵€?/p>
[root@lab8106 ~]# ceph pg dump pgs|awk 鈥榹print $1,$15鈥榺grep -v pg > pg2.txt
|
淇濆瓨褰撳墠鐨?PG 鍒嗗竷涓簆g2.txt
姣旇緝 out 鍓嶅悗鐨?PG 鐨勫彉鍖栨儏鍐碉紝涓嬮潰鏄瘮杈冨叿浣撶殑鍙樺寲鎯呭喌锛屽彧鍒楀嚭鍙樺寲鐨勯儴鍒?/p>
[root@lab8106 ~]# diff -y -W 100 pg1.txt pg2.txt --suppress-common-lines
|
杩欓噷鎴戜滑鍏冲績鐨勬槸鍙樺姩鐨勬暟鐩紝鍙粺璁″彉鍔ㄧ殑 PG 鐨勬暟鐩?/p>
[root@lab8106 ~]# diff -y -W 100 pg1.txt pg2.txt --suppress-common-lines|wc -l
|
绗竴娆?out 浠ュ悗鏈?02涓?PG 鐨勫彉鍔?杩欎釜鏁板瓧璁颁綇锛屽悗闈㈢殑缁熻浼氱敤鍒?/p>
浠?crush 閲岄潰鍒犻櫎 OSD
[root@lab8106 ~]# ceph osd crush remove osd.15
|
crush 鍒犻櫎浠ュ悗鍚屾牱浼氳Е鍙戣縼绉伙紝绛夊緟 PG 鐨勫潎琛★紝涔熷氨鏄叏閮ㄥ彉鎴?nbsp;active+clean
鐘舵€?/p>
[root@lab8106 ~]# ceph pg dump pgs|awk 鈥榹print $1,$15鈥榺grep -v pg > pg3.txt
|
鑾峰彇褰撳墠鐨?PG 鍒嗗竷鐨勭姸鎬?br />鐜板湪鏉ユ瘮杈?crush remove 鍓嶅悗鐨?PG 鍙樺姩
[root@lab8106 ~]# diff -y -W 100 pg2.txt pg3.txt --suppress-common-lines|wc -l
|
鎴戜滑閲嶆柊鍔犱笂鏂扮殑 OSD
[root@lab8106 ~]# ceph-deploy osd prepare lab8107:/dev/sdi
|
鍔犲畬浠ュ悗缁熻褰撳墠鐨勬柊鐨?PG 鐘舵€?/p>
[root@lab8106 ~]# ceph pg dump pgs|awk 鈥榹print $1,$15鈥榺grep -v pg > pg4.txt
|
姣旇緝鍓嶅悗鐨勫彉鍖?/p>
[root@lab8106 ~]# diff -y -W 100 pg3.txt pg4.txt --suppress-common-lines|wc -l
|
鏁翠釜鏇挎崲娴佺▼瀹屾瘯锛岀粺璁′笂闈㈢殑 PG 鎬荤殑鍙樺姩
102 +137 +167 = 406
涔熷氨鏄寜杩欎釜鏂规硶鐨勫彉鍔ㄤ负406涓?PG锛屽洜涓烘槸鍙湁鍙屼富鏈猴紝閲岄潰鍙兘瀛樺湪鏌愪簺鏀惧ぇ闂锛岃繖閲屼笉鍋氭繁鍏ョ殑璁ㄨ锛屽洜涓烘垜鐨勪笁缁勬祴璇曠幆澧冮兘鏄竴鏍风殑鎯呭喌锛屽彧鍋氭í鍚戞瘮杈冿紝鍘熺悊鐩搁€氾紝杩欓噷鏄敤鏁版嵁鏉ュ垎鏋愬嚭宸埆
鍏坈rush reweight 0 锛岀劧鍚巓ut锛岀劧鍚庡啀澧炲姞osd
棣栧厛鎭㈠鐜涓烘祴璇曞墠鐨勭幆澧?/p>
[root@lab8106 ~]# ceph pg dump pgs|awk 鈥榹print $1,$15鈥榺grep -v pg > 2pg1.txt
|
璁板綍鏈€鍘熷鐨?PG 鍒嗗竷鎯呭喌
crush reweight 鎸囧畾OSD
[root@lab8106 ~]# ceph osd crush reweight osd.16 0
|
绛夊緟骞宠 浜嗕互鍚庤褰曞綋鍓嶇殑 PG 鍒嗗竷鐘舵€?/p>
[root@lab8106 ~]# ceph pg dump pgs|awk 鈥榹print $1,$15鈥榺grep -v pg > 2pg2.txt
|
姣旇緝鍓嶅悗鐨勫彉鍔?/p>
[root@lab8106 ~]# diff -y -W 100 2pg1.txt 2pg2.txt --suppress-common-lines|wc -l
|
crush remove 鎸囧畾 OSD
[root@lab8106 ~]# ceph osd crush remove osd.16
|
杩欎釜鍦版柟鍥犱负涓婇潰 crush 宸茬粡鏄?浜嗘墍浠ュ垹闄や篃涓嶄細寮曡捣 PG 鍙樺姩
鐒跺悗鐩存帴 ceph osd rm osd.16
鍚屾牱娌℃湁 PG 鍙樺姩
澧炲姞鏂扮殑 OSD
[root@lab8106 ~]#ceph-deploy osd prepare lab8107:/dev/sdi
|
绛夊緟骞宠 浠ュ悗鑾峰彇褰撳墠鐨?PG 鍒嗗竷
[root@lab8106 ceph]# ceph pg dump pgs|awk 鈥榹print $1,$15鈥榺grep -v pg > 2pg3.txt
|
鏉ユ瘮杈冨墠鍚庣殑鍙樺寲
[root@lab8106 ~]# diff -y -W 100 2pg2.txt 2pg3.txt --suppress-common-lines|wc -l
|
鎬荤殑 PG 鍙樺姩涓?/p>
166+159=325
寮€濮嬪仛norebalance锛岀劧鍚庡仛crush remove锛岀劧鍚庡仛add
鎭㈠鐜涓哄垵濮嬬幆澧冿紝鐒跺悗鑾峰彇褰撳墠鐨?PG 鍒嗗竷
[root@lab8106 ~]# ceph pg dump pgs|awk 鈥榹print $1,$15鈥榺grep -v pg > 3pg1.txt
|
[root@lab8106 ~]# ceph osd set norebalance
set norebalance
[root@lab8106 ~]# ceph osd set nobackfill
set nobackfill
[root@lab8106 ~]# ceph osd set norecover
set norecover
set norebalance
[root@lab8106 ~]# ceph osd set nobackfill
set nobackfill
[root@lab8106 ~]# ceph osd set norecover
set norecover
crush reweight 鎸囧畾 OSD
[root@lab8106 ~]# ceph osd crush reweight osd.15 0
|
杩欎釜鍦版柟鍥犱负宸茬粡鍋氫簡涓婇潰鐨勬爣璁帮紝鎵€浠ュ彧浼氬嚭鐜扮姸鎬佸彉鍖栵紝鑰屾病鏈夌湡姝g殑杩佺Щ锛屾垜浠篃鍏堢粺璁′竴涓?/p>
[root@lab8106 ~]# ceph pg dump pgs|awk 鈥榹print $1,$15鈥榺grep -v pg > 3pg2.txt
|
娉ㄦ剰杩欓噷鍙槸璁$畻浜嗭紝骞舵病鏈夌湡姝g殑鏁版嵁鍙樺姩锛屽彲浠ラ€氳繃鐩戞帶涓ゅ彴鐨勪富鏈虹殑缃戠粶娴侀噺鏉ュ垽鏂?鎵€浠ヨ繖閲岀殑鍙樺姩骞朵笉鐢ㄨ绠楀埌闇€瑕佽縼绉荤殑 PG 鏁扮洰褰撲腑
crush remove 鎸囧畾 OSD
[root@lab8106 ~]#ceph osd crush remove osd.15
|
鍒犻櫎鎸囧畾鐨?OSD
鍒犻櫎浠ュ悗鍚屾牱鏄病鏈?PG 鐨勫彉鍔ㄧ殑
ceph osd rm osd.15
|
杩欎釜鍦版柟鏈変釜灏忓湴鏂归渶瑕佹敞鎰忎竴涓嬶紝涓嶅仛 ceph auth del osd.15 鎶?5鐨勭紪鍙风暀鐫€锛岃繖鏍峰ソ鍒ゆ柇鍓嶅悗鐨?PG 鐨勫彉鍖栵紝涓嶇劧鐩稿悓鐨勭紪鍙凤紝灏辨棤娉曞垽鏂槸涓嶆槸鍋氫簡杩佺Щ浜?/p>
澧炲姞鏂扮殑 OSD
[root@lab8106 ~]#ceph-deploy osd prepare lab8107:/dev/sdi
|
鎴戠殑鐜涓嬶紝鏂板鐨?OSD 鐨勭紪鍙蜂负16浜?/p>
瑙i櫎鍚勭鏍囪
鎴戜滑鏀惧紑涓婇潰鐨勮缃紝鐪嬩笅鏁版嵁鐨勫彉鍔ㄦ儏鍐?/p>
[root@lab8106 ceph]# ceph osd unset norebalance
|
璁剧疆瀹屼簡鍚庢暟鎹墠鐪熸寮€濮嬪彉鍔ㄤ簡锛屽彲浠ラ€氳繃瑙傚療缃戝崱娴侀噺鐪嬪埌锛屾潵鐪嬩笅鏈€缁坧g鍙樺寲
[root@lab8106 ceph]# ceph pg dump pgs|awk 鈥榹print $1,$15鈥榺grep -v pg > 3pg3.txt
|
杩欓噷鎴戜滑鍙渶瑕佽窡鏈€寮€濮嬬殑 PG 鍒嗗竷鐘跺喌杩涜姣旇緝灏卞彲浠ヤ簡锛屽洜涓轰腑闂寸殑鐘舵€佸疄闄呬笂閮芥病鏈夊仛鏁版嵁鐨勮縼绉伙紝鎵€浠ヤ笉闇€瑕佺粺璁¤繘鍘伙紝鍙互鐪嬪埌杩欎釜鍦版柟鍔ㄤ簡195涓?PG
鎬诲叡鐨?PG 杩佺Щ閲忎负
195
鎬荤粨
浠庢垜鑷繁鐨勬搷浣滅粡楠屾潵鐪嬶紝鏈€寮€濮嬫槸鐢ㄧ殑绗竴绉嶆柟娉曪紝鍚庨潰灏辩敤绗簩绉嶆柟娉曞噺灏戜簡涓€閮ㄥ垎杩佺Щ閲忥紝鏈€杩戠湅鍒拌祫鏂欏啓鍋氬墧闄SD鐨勬椂鍊欏彲浠ュ叧闂縼绉婚槻姝㈡棤鏁堢殑杩囧鐨勮縼绉伙紝鐒跺悗灏辨祴璇曚簡涓€涓嬶紝纭疄鑳藉鍑忓皯涓嶅皯鐨勮縼绉婚噺锛岃繖涓噺灏戝湪鏌愪簺鍦烘櫙涓嬭繕鏄緢濂界殑锛屽綋鐒跺鏋滀笉澶啛鎮夛紝鐢ㄥ摢涓€绉嶉兘鍙互锛屾渶缁堣兘杈惧埌鐨勭洰鐨勬槸涓€鏍风殑
闄勫姞
鏈変汉闂埌涓€涓棶棰橈紝涓轰粈涔堟寜鐓ц繖涓祦绋嬫搷浣滅殑鏃跺€欙紝浼氬嚭鐜皊low request锛熷湪杩涜浜嗕竴娆¢獙璇佸悗锛屽彂鐜板湪杩佺Щ杩囩▼涓殑璇锋眰璺緞杩樻槸寰堥暱鐨勶紝鎵€浠ュ嚭鐜皊low request杩樻槸寰堝鏄撶殑
鍋囧鎴戜滑鏈変笁涓猳sd锛屽垎鍒负0,1,2锛岄噷闈㈡湁鍚勭鐨勫垎甯冿紝鎴戜滑鍦ㄨ涪鎺変竴涓猳sd.2鍚庯紝鍙兘鍑虹幇鐨勪竴涓儏鍐垫槸
鏌愪釜PG(0.3b)鐨刐2,0]鍒嗗竷鍙樻垚浜哰1,0]
鑰屾鏃跺悗鍙扮殑osd.1鐨凱G锛?.3b锛夎繖涓洰褰曢噷闈㈢殑鍐呭瀹為檯鏄┖鐨勶紝濡傛灉杩欎釜鏃跺€欙紝鍓嶇鐨勮姹備竴涓璞℃濂芥槸鍒嗗竷鍦?.3b杩欎釜PG涓婄殑鏃跺€欙紝鍚庡彴闇€瑕佸厛灏唎sd.0涓婇潰鐨勮繖涓?.3b鐨勫璞″啓鍏ュ埌osd.1鐨?.3b鐨刾g閲岄潰鍘伙紝鐒跺悗鍐嶅幓鍝嶅簲瀹㈡埛绔殑璇锋眰锛岃嚜鐒惰矾寰勫氨闀夸簡锛屽鏋滆繖鏍风殑璇锋眰涓€澶氾紝鍝嶅簲鍓嶅彴鐨勬€ц兘灏辨湁闂浜嗭紝澧炲姞鑺傜偣鐨勬椂鍊欏悓鐞?/p>
璇锋眰鍒拌繖绉嶇┖PG鐨勫璞★紝PG鐨勭姸鎬佷細杩欐牱鍙樺寲锛?/p>
浠巃ctive+degraded 鍙樻垚active+recovery_wait+degraded
杩佺Щ鐨勬暟鎹噺鏄竴瀹氱殑锛岃繖涓湅鏄姹傜殑鏃跺€欏疄鏃惰縼绉荤劧鍚庡搷搴旇繕鏄彁鍓嶈縼绉伙紝鐒跺悗鍝嶅簲锛屾墍浠ヨ繖涓腑闂存搷浣滆繃绋嬪敖閲忕殑蹇殑瀹屾垚锛岀劧鍚庡ソ杩佺Щ瀹屽搷搴斿墠绔殑璇锋眰
以上是关于鏇挎崲OSD鎿嶄綔鐨勪紭鍖栦笌鍒嗘瀽的主要内容,如果未能解决你的问题,请参考以下文章
娣卞叆婧愮爜鍒嗘瀽锛岀紦瀛樹箣鐜?Caffeine 涓轰綍杩欎箞鐚?
妗嗘灦鍋ュ.鎬т紭鍖栵紝鐜鍙橀噺绫伙紝姝e垯鏇挎崲excel
AtomicReference銆丄tomicStampedReference 鍜?AtomicMarkableReference