
Ceph版本:16.2.13(pacific)(我知道pacific已被棄用,但整個環境是遺留的(如centos 7.3)。我也無權升級。)叢集有6台伺服器(22個osd,97個pg ) 。有一個透過NFS導出的CephFS。客戶端透過 NFSv4.1 (NFS-Ganesha) 存取叢集。在客戶端使用以下命令進行掛載:
# mount -t nfs -o nfsvers=4.1,noauto,soft,sync,proto=tcp 172.20.0.31:/exports /cephmnt
我將一個資料夾(大約 5.2GB)複製到 /cephmnt。
# cp sysdir /cephmnt
因此空間按預期擴展(在檢查df -Th
和的輸出之後ceph df detail
)。
# df -Th | grep -i ceph
172.20.0.31:/exports nfs4 26T 5.2G 26T 1% /cephmnt
# ceph df | grep -i cephfs
cephfs.new_storage.meta 8 32 26 MiB 28 79 MiB 0 25 TiB
cephfs.new_storage.data 9 32 5.2 GiB 1.42k 15 GiB 0.02 25 TiB
但是,當我刪除該資料夾時,空間並沒有縮小。
# rm -rf sysdir
# df -Th | grep -i ceph
172.20.0.31:/exports nfs4 26T 5.2G 26T 1% /cephmnt
# ceph df | grep -i cephfs
cephfs.new_storage.meta 8 32 26 MiB 28 79 MiB 0 25 TiB
cephfs.new_storage.data 9 32 5.2 GiB 1.42k 15 GiB 0.02 25 TiB
我可以透過以下方式查看資料池中的物件清單:
# rados -p cephfs.new_storage.data ls
我對 ceph 很陌生,所以我不知道這是否是 ceph 中的正常行為,儘管我懷疑後者,所以我確實嘗試了一些挖掘。
快照已停用,且兩個池都沒有現有快照:
# ceph fs set new_storage allow_new_snaps false
# rados -p cephfs.new_storage.meta lssnap
0 snaps
# rados -p cephfs.new_storage.data lssnap
0 snaps
我在某處讀到,如果bdev_async_discard
和bdev_enable_discard
設定為 true,OSD 中的 bluestore 會自動刪除不可用的數據,所以我設定了它們
# ceph config get osd bdev_async_discard
true
# ceph config get osd bdev_enable_discard
true
但這沒有效果。我已經多次卸載和安裝 nfs 共享(有一次甚至將其卸載過夜),但每當我重新安裝時df -Th
,ceph df
仍然顯示相同的空間被佔用。我cd
進入 /cephmnt 目錄並發出同步命令。還是沒有效果。
如何釋放已刪除檔案的空間?
我確實讀過這裡cephfs 具有延遲刪除功能,但我不知道這是否是我的情況,或者還有其他問題。如果是延遲刪除,那麼我該如何確認這一點以及如何觸發實際刪除?如果不是懶惰刪除那麼實際問題是什麼?
請詢問故障排除是否需要任何其他數據。我已經為此工作了近 3 天,完全沒有想法,因此我非常感謝您的幫助。
編輯1:添加更多細節
[root@cephserver1 ~]# ceph osd df
ID CLASS WEIGHT REWEIGHT SIZE RAW USE DATA OMAP META AVAIL %USE VAR PGS STATUS
0 hdd 3.63869 1.00000 3.6 TiB 1.6 GiB 593 MiB 2 KiB 1.0 GiB 3.6 TiB 0.04 1.07 10 up
1 hdd 3.63869 1.00000 3.6 TiB 1.1 GiB 544 MiB 19 KiB 559 MiB 3.6 TiB 0.03 0.71 9 up
2 hdd 3.63869 1.00000 3.6 TiB 1.7 GiB 669 MiB 6 KiB 1.0 GiB 3.6 TiB 0.05 1.12 13 up
4 hdd 3.63869 1.00000 3.6 TiB 1.6 GiB 742 MiB 26 KiB 918 MiB 3.6 TiB 0.04 1.07 13 up
13 hdd 3.63869 1.00000 3.6 TiB 1.7 GiB 596 MiB 4 KiB 1.2 GiB 3.6 TiB 0.05 1.15 8 up
5 hdd 3.63869 1.00000 3.6 TiB 1.9 GiB 1.2 GiB 56 MiB 713 MiB 3.6 TiB 0.05 1.26 16 up
6 hdd 3.63869 1.00000 3.6 TiB 1.6 GiB 407 MiB 124 MiB 1.1 GiB 3.6 TiB 0.04 1.04 9 up
7 hdd 3.63869 1.00000 3.6 TiB 1.3 GiB 418 MiB 67 MiB 887 MiB 3.6 TiB 0.04 0.89 12 up
8 hdd 3.63869 1.00000 3.6 TiB 1.1 GiB 667 MiB 73 MiB 372 MiB 3.6 TiB 0.03 0.72 15 up
9 hdd 3.63869 1.00000 3.6 TiB 1.7 GiB 1.2 GiB 7 KiB 526 MiB 3.6 TiB 0.05 1.13 18 up
10 hdd 3.63869 1.00000 3.6 TiB 1.5 GiB 906 MiB 8 KiB 579 MiB 3.6 TiB 0.04 0.96 11 up
11 hdd 3.63869 1.00000 3.6 TiB 1.7 GiB 1.1 GiB 6 KiB 628 MiB 3.6 TiB 0.05 1.15 11 up
12 hdd 3.63869 1.00000 3.6 TiB 1.8 GiB 600 MiB 16 MiB 1.2 GiB 3.6 TiB 0.05 1.17 15 up
3 hdd 3.63869 1.00000 3.6 TiB 2.8 GiB 1.6 GiB 37 MiB 1.2 GiB 3.6 TiB 0.08 1.86 17 up
14 hdd 3.63869 1.00000 3.6 TiB 1.6 GiB 857 MiB 37 KiB 781 MiB 3.6 TiB 0.04 1.06 12 up
15 hdd 3.63869 1.00000 3.6 TiB 1.9 GiB 1.4 GiB 2 KiB 499 MiB 3.6 TiB 0.05 1.26 12 up
16 hdd 3.63869 1.00000 3.6 TiB 2.2 GiB 972 MiB 1 KiB 1.2 GiB 3.6 TiB 0.06 1.44 15 up
17 hdd 3.63869 1.00000 3.6 TiB 1002 MiB 981 MiB 8 KiB 20 MiB 3.6 TiB 0.03 0.65 17 up
18 hdd 3.63869 1.00000 3.6 TiB 935 MiB 915 MiB 3 KiB 20 MiB 3.6 TiB 0.02 0.60 17 up
19 hdd 3.63869 1.00000 3.6 TiB 1.0 GiB 1006 MiB 0 B 28 MiB 3.6 TiB 0.03 0.67 10 up
20 hdd 3.63869 1.00000 3.6 TiB 866 MiB 835 MiB 0 B 31 MiB 3.6 TiB 0.02 0.56 20 up
21 hdd 3.63869 1.00000 3.6 TiB 731 MiB 709 MiB 0 B 22 MiB 3.6 TiB 0.02 0.47 11 up
TOTAL 80 TiB 33 GiB 19 GiB 374 MiB 14 GiB 80 TiB 0.04
MIN/MAX VAR: 0.47/1.86 STDDEV: 0.01
[root@cephserver1 ~]# ceph fs status
new_storage - 4 clients
======================
RANK STATE MDS ACTIVITY DNS INOS DIRS CAPS
0 active new_storage.cephserver2.gvflgv Reqs: 0 /s 161 163 52 154
POOL TYPE USED AVAIL
cephfs.new_storage.meta metadata 79.4M 25.3T
cephfs.new_storage.data data 18.2G 25.3T
STANDBY MDS
new_storage.cephserver3.wxrhxm
new_storage.cephserver4.xwpidi
new_storage.cephserver1.fwjpoi
MDS version: ceph version 16.2.13 (5378749ba6be3a0868b51803968ee9cde4833a3e) pacific (stable)
[root@cephserver1 ~]# ceph -s
cluster:
id: dcad37bc-1185-11ee-88c0-7cc2556f5050
health: HEALTH_WARN
1 failed cephadm daemon(s)
services:
mon: 5 daemons, quorum cephserver1,cephserver2,cephserver3,cephserver4,cephserver5 (age 8d)
mgr: cephserver2.sztiyq(active, since 2w), standbys: cephserver1.emjcaa
mds: 1/1 daemons up, 3 standby
osd: 22 osds: 22 up (since 3h), 22 in (since 8d)
data:
volumes: 1/1 healthy
pools: 4 pools, 97 pgs
objects: 1.81k objects, 6.2 GiB
usage: 33 GiB used, 80 TiB / 80 TiB avail
pgs: 97 active+clean
io:
client: 462 B/s rd, 0 op/s rd, 0 op/s wr
[root@cephserver1 ~]# ceph health detail
HEALTH_WARN 1 failed cephadm daemon(s)
[WRN] CEPHADM_FAILED_DAEMON: 1 failed cephadm daemon(s)
daemon grafana.cephserver1 on cephserver1 is in error state
編輯2:我忘了提到一個重要的點。整個儲存叢集處於氣隙環境。
編輯3:我嘗試按照 eblock 評論中的建議在線壓縮 OSD,並且部分成功。這是ceph df
壓縮之前顯示的內容:
[root@cephserver1 ~]# ceph df
--- RAW STORAGE ---
CLASS SIZE AVAIL USED RAW USED %RAW USED
hdd 80 TiB 80 TiB **33 GiB** **33 GiB** 0.04
TOTAL 80 TiB 80 TiB **33 GiB** **33 GiB** 0.04
--- POOLS ---
POOL ID PGS STORED OBJECTS USED %USED MAX AVAIL
device_health_metrics 1 1 17 MiB 29 50 MiB 0 25 TiB
cephfs.new_storage.meta 8 32 26 MiB 28 79 MiB 0 25 TiB
cephfs.new_storage.data 9 32 5.2GiB 1.42k 15 GiB 0.02 25 TiB
.nfs 10 32 1.7 KiB 7 40 KiB 0 25 TiB
壓縮後,33GiB 減少到 23GiB,如下所示
[root@cephserver1 ~]# ceph df
--- RAW STORAGE ---
CLASS SIZE AVAIL USED RAW USED %RAW USED
hdd 80 TiB 80 TiB **23 GiB** **23 GiB** 0.03
TOTAL 80 TiB 80 TiB **23 GiB** **23 GiB** 0.03
--- POOLS ---
POOL ID PGS STORED OBJECTS USED %USED MAX AVAIL
device_health_metrics 1 1 18 MiB 29 54 MiB 0 25 TiB
cephfs.new_storage.meta 8 32 26 MiB 28 79 MiB 0 25 TiB
cephfs.new_storage.data 9 32 5.2GiB 1.42k 15 GiB 0.02 25 TiB
.nfs 10 32 32 KiB 7 131 KiB 0 25 TiB
然而,池中的數據並沒有下降。因此,我們衷心感謝更多建議。
編輯4:我使用以下命令本地安裝了 CephFS(即在內核命令之間沒有 NFS):
# mount -t ceph 172.30.0.31:6789,172.30.0.32:6789,172.30.0.33:6789:/ /cephmnt -o name=user1
安裝後我這樣做了ls -a /cephmnt
,但看不到舊數據。但是,當我df -Th
在安裝了 CephFS 的用戶端上執行此操作時,我仍然看到舊資料佔用的空間(5.2GB)。所以我懷疑問題不在於 NFS。