mongodb local数据库的空间初始化好大啊!

新建立了一个replicat set,登录到primary里,show dbs一看吓一跳
local数据库竟然占用了80多G的空间
[root@wxlab31 bin]# ./mongo --host 10.1.1.31 --port 27017
MongoDB shell version: 2.4.6
connecting to: 10.1.1.31:27017/test
Server has startup warnings: 
Mon Jan 20 15:12:35.071 [initandlisten] 
Mon Jan 20 15:12:35.071 [initandlisten] ** WARNING: You are running on a NUMA machine.
Mon Jan 20 15:12:35.071 [initandlisten] **          We suggest launching mongod like this to avoid performance problems:
Mon Jan 20 15:12:35.071 [initandlisten] **              numactl --interleave=all mongod [other options]
Mon Jan 20 15:12:35.071 [initandlisten] 
wxh:PRIMARY> show dbs
local   82.0380859375GB

[root@wxlab31 db1]# ls -ltr
total 86023348
-rwxr-xr-x. 1 root root          6 Jan 20 15:12 mongod.lock
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.40
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.39
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.38
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.37
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.36
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.35
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.34
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.33
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.32
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.31
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.30
drwxr-xr-x. 2 root root       4096 Jan 20 15:13 journal
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.9
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.8
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.7
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.6
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.5
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.4
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.3
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.29
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.28
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.27
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.26
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.25
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.24
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.23
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.22
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.21
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.20
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.2
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.19
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.18
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.17
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.16
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.15
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.14
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.13
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.12
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.11
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.10
-rw-------. 1 root root 2146435072 Jan 20 15:13 local.1
-rw-------. 1 root root   67108864 Jan 20 15:13 local.0
drwxr-xr-x. 2 root root       4096 Jan 20 15:14 _tmp
-rw-------. 1 root root   16777216 Jan 20 15:26 local.ns
-rw-------. 1 root root 2146435072 Jan 20 15:26 local.41



[root@wxlab31 db1]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_sys-lv_root
                       79G  3.4G   72G   5% /
tmpfs                  64G   76K   64G   1% /dev/shm
/dev/sda1             485M   39M  422M   9% /boot
/dev/mapper/vg_sys-lv_lsmp
                      148G  274M  140G   1% /lsmp
/dev/mapper/vg_sys-lv_opt
                       99G   13G   82G  14% /opt
/dev/mapper/vg_sys-lv_var
                      118G   11G  101G  10% /var
/dev/mapper/vg_mondb-lv_mondb
                      1.8T  369G  1.4T  22% /mongodata
数据目录挂载在/mongodata下,由于mongodata挂载点有1.4T的容量,因此oplog默认的大小是5%挂载点的大小,就导致了local数据库过大的问题

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22034023/viewspace-1073134/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/22034023/viewspace-1073134/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要搭建MongoDB主从数据库的步骤如下: 1. 首先,在主从数据库服务器上执行启动MongoDB数据库的命令。可以同时在主从数据库上执行以下命令: ``` mongod --replSet pzz ``` 2. 等待MongoDB数据库启动后,登录到主库上,并执行以下命令来检查复制集的状态: ``` rs.status() ``` 这将显示复制集的状态信息,包括主库和从库的状态,连接状态等。 3. 创建MongoDB的配置文件,该文件将用于在MongoDB启动时按照配置文件的设置来启动。在主库上创建名为`mongod.conf`的配置文件,并将以下内容写入该文件中: ``` bind_ip=0.0.0.0 replSet=pzz ``` 其中,`bind_ip`设置为`0.0.0.0`表示允许来自任意IP地址的连接,`replSet`设置为`pzz`表示复制集的名称为`pzz`。 4. 在主库和从库上分别启动MongoDB数据库,并指定配置文件的路径: ``` mongod --config /usr/local/mongodb/mongod.conf ``` 这将根据配置文件的设置启动MongoDB数据库,并将其加入到复制集中。 5. 在主库上初始化复制集。登录到主库上,执行以下命令: ``` rs.initiate() ``` 这将初始化复制集,并将主库的配置信息与其他从库分享。 6. 将从库添加到复制集中。登录到从库上,执行以下命令: ``` rs.add("192.168.0.7:27017") ``` 这将将从库添加到复制集中,其IP地址为`192.168.0.7`,端口为`27017`。 7. 现在,你已经成功搭建了MongoDB主从数据库。可以使用`rs.status()`命令来检查复制集的状态,并确保主从同步正常工作。 请注意,以上步骤中的IP地址和端口号应根据你的实际情况进行调整。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [MongoDB详解(六)——MongoDB主从同步配置](https://blog.csdn.net/weixin_40228200/article/details/125242592)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [详解mongoDB主从复制搭建详细过程](https://download.csdn.net/download/weixin_38674223/13703043)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值