我使用 mongodb 服务,持久化到测试环境上,一切正常,我把相关持久化数据放到其它机器上,mongodb 居然不加载文件,每次都是初始化一次.
docker-compose:
mongodb:
restart: on-failure
image: mongo:3.4
volumes:
- /home/mongod:/data/db:rw
ports:
- "28017:27017"
command: --maxConns 4096
sysctls:
net.core.somaxconn: 16240
1
momocraft 2017-06-26 11:45:59 +08:00
检查文件权限和错误信息
|
2
SlipStupig OP @momocraft 目录给了 755,没有报错,只是数据没加载进去
path: drwxr-xr-x 5 root root 4096 Jun 26 03:52 db/ mongodb: mongodb_1 | 2017-06-26T03:57:08.579+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=912e28a9d550 mongodb_1 | 2017-06-26T03:57:08.579+0000 I CONTROL [initandlisten] db version v3.4.5 mongodb_1 | 2017-06-26T03:57:08.579+0000 I CONTROL [initandlisten] git version: 520b8f3092c48d934f0cd78ab5f40fe594f96863 mongodb_1 | 2017-06-26T03:57:08.579+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1t 3 May 2016 mongodb_1 | 2017-06-26T03:57:08.579+0000 I CONTROL [initandlisten] allocator: tcmalloc mongodb_1 | 2017-06-26T03:57:08.579+0000 I CONTROL [initandlisten] modules: none mongodb_1 | 2017-06-26T03:57:08.579+0000 I CONTROL [initandlisten] build environment: mongodb_1 | 2017-06-26T03:57:08.580+0000 I CONTROL [initandlisten] distmod: debian81 mongodb_1 | 2017-06-26T03:57:08.580+0000 I CONTROL [initandlisten] distarch: x86_64 mongodb_1 | 2017-06-26T03:57:08.580+0000 I CONTROL [initandlisten] target_arch: x86_64 mongodb_1 | 2017-06-26T03:57:08.580+0000 I CONTROL [initandlisten] options: { net: { maxIncomingConnections: 4096 } } mongodb_1 | 2017-06-26T03:57:08.580+0000 W - [initandlisten] Detected unclean shutdown - /data/db/mongod.lock is not empty. mongodb_1 | 2017-06-26T03:57:08.581+0000 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'. mongodb_1 | 2017-06-26T03:57:08.581+0000 W STORAGE [initandlisten] Recovering data from the last clean checkpoint. mongodb_1 | 2017-06-26T03:57:08.581+0000 I STORAGE [initandlisten] mongodb_1 | 2017-06-26T03:57:08.581+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine mongodb_1 | 2017-06-26T03:57:08.581+0000 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem mongodb_1 | 2017-06-26T03:57:08.581+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=1463M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0), mongodb_1 | 2017-06-26T03:57:08.918+0000 I CONTROL [initandlisten] mongodb_1 | 2017-06-26T03:57:08.918+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database. mongodb_1 | 2017-06-26T03:57:08.918+0000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted. mongodb_1 | 2017-06-26T03:57:08.918+0000 I CONTROL [initandlisten] mongodb_1 | 2017-06-26T03:57:08.918+0000 I CONTROL [initandlisten] mongodb_1 | 2017-06-26T03:57:08.918+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. mongodb_1 | 2017-06-26T03:57:08.918+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never' mongodb_1 | 2017-06-26T03:57:08.918+0000 I CONTROL [initandlisten] mongodb_1 | 2017-06-26T03:57:08.918+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'. mongodb_1 | 2017-06-26T03:57:08.918+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never' mongodb_1 | 2017-06-26T03:57:08.918+0000 I CONTROL [initandlisten] mongodb_1 | 2017-06-26T03:57:08.922+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data' mongodb_1 | 2017-06-26T03:57:08.923+0000 I NETWORK [thread1] waiting for connections on port 27017 mongodb_1 | 2017-06-26T03:57:09.015+0000 I FTDC [ftdc] Unclean full-time diagnostic data capture shutdown detected, found interim file, some metrics may have been lost. OK |
3
oyyd 2017-06-26 12:54:09 +08:00 via iPhone
每次都持久化一次具体指的是?
|
4
SlipStupig OP @oyyd 并没有读取到之前的数据,而是重新初始化新的集合出来
|
5
HuangLibo 2017-06-26 23:09:35 +08:00
之前用 docker 部署 gitlab 遇到过这个问题, 每次重启服务 gitlab 里面的数据就全没了, 最后就没用 docker, 直接在操作系统里安装了 gitlab
|
6
SlipStupig OP @HuangLibo 你这种一般都是 volume 配置问题, 我的情况是加载了卷却没有数据
|