linux – Mongodb副本集:为什么我的主服务器比我的奴隶占用更多的磁盘空间?

我的副本集上有两台服务器.为了讨论的目的,我们称之为主人和奴隶.

主人是原来的,奴隶是从那个主人那里复制出来的.在复制的那一刻,他们占用了大约相同的磁盘空间.

一个月后,这是当前状态.

主:

user@ines:/var/lib/mongodb$ls -al
total 44265576
drwxr-xr-x  4 mongodb mongodb       4096 Apr 22 14:40 .
drwxr-xr-x 38 root    root          4096 Jan 28 12:08 ..
-rw-------  1 mongodb mongodb   67108864 Mar 31 15:23 admin.0
-rw-------  1 mongodb mongodb  134217728 Nov 29 12:33 admin.1
-rw-------  1 mongodb mongodb   16777216 Mar 31 15:23 admin.ns
drwxr-xr-x  2 mongodb mongodb       4096 Apr 24 08:35 journal
-rw-------  1 mongodb mongodb   67108864 Apr 17 10:33 local.0
-rw-------  1 mongodb mongodb 2146435072 Mar 31 11:21 local.1
-rw-------  1 mongodb mongodb 2146435072 Apr 24 11:02 local.2
-rw-------  1 mongodb mongodb   16777216 Apr 24 11:02 local.ns
-rwxr-xr-x  1 mongodb mongodb          5 Apr 17 10:32 mongod.lock
drwxr-xr-x  2 mongodb nogroup       4096 Apr 22 14:40 _tmp
-rw-------  1 mongodb mongodb   67108864 Apr 24 10:39 tracking.0
-rw-------  1 mongodb mongodb  134217728 Apr 16 14:50 tracking.1
-rw-------  1 mongodb mongodb 2146435072 Apr 24 02:26 tracking.10
-rw-------  1 mongodb mongodb 2146435072 Apr 21 04:38 tracking.11
-rw-------  1 mongodb mongodb 2146435072 Apr 11 05:30 tracking.12
-rw-------  1 mongodb mongodb 2146435072 Apr  8 13:25 tracking.13
-rw-------  1 mongodb mongodb 2146435072 Apr 17 15:17 tracking.14
-rw-------  1 mongodb mongodb 2146435072 Apr 24 11:02 tracking.15
-rw-------  1 mongodb mongodb 2146435072 Apr 24 11:02 tracking.16
-rw-------  1 mongodb mongodb 2146435072 Apr 14 19:00 tracking.17
-rw-------  1 mongodb mongodb 2146435072 Apr 24 02:26 tracking.18
-rw-------  1 mongodb mongodb 2146435072 Apr 22 12:33 tracking.19
-rw-------  1 mongodb mongodb  268435456 Apr 16 14:50 tracking.2
-rw-------  1 mongodb nogroup 2146435072 Apr 24 11:00 tracking.20
-rw-------  1 mongodb nogroup 2146435072 Apr 24 11:01 tracking.21
-rw-------  1 mongodb nogroup 2146435072 Apr 22 14:40 tracking.22
-rw-------  1 mongodb mongodb  536870912 Apr 16 14:50 tracking.3
-rw-------  1 mongodb mongodb 1073741824 Apr 24 11:02 tracking.4
-rw-------  1 mongodb mongodb 2146435072 Apr 24 10:50 tracking.5
-rw-------  1 mongodb mongodb 2146435072 Apr 21 20:26 tracking.6
-rw-------  1 mongodb mongodb 2146435072 Apr 24 11:02 tracking.7
-rw-------  1 mongodb mongodb 2146435072 Apr 16 16:17 tracking.8
-rw-------  1 mongodb mongodb 2146435072 Apr 24 11:02 tracking.9
-rw-------  1 mongodb mongodb   16777216 Apr 24 11:02 tracking.ns

和奴隶:

user@juliana:/var/lib/mongodb$ls -al
total 31688800
drwxr-xr-x  4 mongodb mongodb       4096 Apr 23 17:40 .
drwxr-xr-x 37 root    root          4096 Mar 31 16:04 ..
-rw-------  1 mongodb mongodb   67108864 Mar 31 15:28 admin.0
-rw-------  1 mongodb mongodb  134217728 Mar 31 15:28 admin.1
-rw-------  1 mongodb mongodb   16777216 Mar 31 15:28 admin.ns
drwxr-xr-x  2 mongodb mongodb       4096 Apr 24 10:04 journal
-rw-------  1 mongodb mongodb   67108864 Apr 17 14:19 local.0
-rw-------  1 mongodb mongodb 2146435072 Apr 24 11:02 local.1
-rw-------  1 mongodb mongodb 2146435072 Apr 24 11:02 local.2
-rw-------  1 mongodb mongodb   16777216 Apr 24 11:02 local.ns
-rwxr-xr-x  1 mongodb mongodb          5 Apr 17 14:19 mongod.lock
drwxr-xr-x  2 mongodb nogroup       4096 Apr 23 17:40 _tmp
-rw-------  1 mongodb mongodb   67108864 Apr 17 14:43 tracking.0
-rw-------  1 mongodb mongodb  134217728 Mar 31 15:30 tracking.1
-rw-------  1 mongodb mongodb 2146435072 Apr 24 11:02 tracking.10
-rw-------  1 mongodb mongodb 2146435072 Apr 24 11:02 tracking.11
-rw-------  1 mongodb mongodb 2146435072 Apr 24 02:26 tracking.12
-rw-------  1 mongodb nogroup 2146435072 Apr 24 11:02 tracking.13
-rw-------  1 mongodb nogroup 2146435072 Apr 24 05:40 tracking.14
-rw-------  1 mongodb nogroup 2146435072 Apr 24 11:02 tracking.15
-rw-------  1 mongodb nogroup 2146435072 Apr 23 17:40 tracking.16
-rw-------  1 mongodb mongodb  268435456 Mar 31 15:30 tracking.2
-rw-------  1 mongodb mongodb  536870912 Mar 31 15:30 tracking.3
-rw-------  1 mongodb mongodb 1073741824 Apr 24 10:39 tracking.4
-rw-------  1 mongodb mongodb 2146435072 Apr 15 17:18 tracking.5
-rw-------  1 mongodb mongodb 2146435072 Apr 21 03:56 tracking.6
-rw-------  1 mongodb mongodb 2146435072 Apr 24 10:55 tracking.7
-rw-------  1 mongodb mongodb 2146435072 Apr 21 20:26 tracking.8
-rw-------  1 mongodb mongodb 2146435072 Apr 24 11:02 tracking.9
-rw-------  1 mongodb mongodb   16777216 Apr 24 11:02 tracking.ns

这是正常的吗?我怎样才能收回“大师”浪费的空间?

谢谢.

解决方法:

你应该看看那个repairDatabase命令.它阻止了mongod没有流量,所以在主节点上发出它之前,发出stepDown,其他/辅助/从节点将接管流量.

上一篇:使用gtid与MySQL复制时的问题


下一篇:更新mysql 5.5服务器上的系统时间有任何风险吗?