Jac*_*ack 9 mongodb mongodb-replica-set
我已经使用以下链接安装了最新版本的 mongodb (v4.0.5) https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/ 现在我正在尝试设置使用以下教程中提供的说明进行复制 但是,一旦我在“2.通过发出以下命令在自己的 shell 窗口中启动您的 mongod 实例”处尝试该命令,它就会给我以下错误“未设置会话集合向上;等待下一次会话刷新间隔:尚未配置复制”
我使用的命令:mongod --replSet rs0 --port 27019 --bind_ip localhost,[MY_IP] --dbpath /srv/mongodb/rs0-2 --smallfiles --oplogSize 128
该命令的更详细输出如下:
2018-12-31T15:37:03.618+0530 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2018-12-31T15:37:03.623+0530 I CONTROL [initandlisten] MongoDB starting : pid=xxx port=27017 dbpath=/srv/mongodb/rs0-0 64-bit host=xxx
2018-12-31T15:37:03.623+0530 I CONTROL [initandlisten] db version v4.0.5
2018-12-31T15:37:03.623+0530 I CONTROL [initandlisten] git version: xxx
2018-12-31T15:37:03.623+0530 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
2018-12-31T15:37:03.623+0530 I CONTROL [initandlisten] allocator: tcmalloc
2018-12-31T15:37:03.623+0530 I CONTROL [initandlisten] modules: none
2018-12-31T15:37:03.623+0530 I CONTROL [initandlisten] build environment:
2018-12-31T15:37:03.623+0530 I CONTROL [initandlisten] distmod: rhel70
2018-12-31T15:37:03.623+0530 I CONTROL [initandlisten] distarch: x86_64
2018-12-31T15:37:03.623+0530 I CONTROL [initandlisten] target_arch: x86_64
2018-12-31T15:37:03.623+0530 I CONTROL [initandlisten] options: { net: { bindIp: "localhost,xxx", port: 27017 }, replication: { replSet: "rs0" }, storage: { dbPath: "/srv/mongodb/rs0-0" } }
2018-12-31T15:37:03.624+0530 I STORAGE [initandlisten] Detected data files in /srv/mongodb/rs0-0 created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-12-31T15:37:03.625+0530 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=3399M,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),statistics_log=(wait=0),verbose=(recovery_progress),
2018-12-31T15:37:04.683+0530 I STORAGE [initandlisten] WiredTiger message [1546250824:683476][30064:0x7f4cb133db40], txn-recover: Main recovery loop: starting at 5/6144 to 6/256
2018-12-31T15:37:04.796+0530 I STORAGE [initandlisten] WiredTiger message [1546250824:796244][30064:0x7f4cb133db40], txn-recover: Recovering log 5 through 6
2018-12-31T15:37:04.871+0530 I STORAGE [initandlisten] WiredTiger message [1546250824:871037][30064:0x7f4cb133db40], txn-recover: Recovering log 6 through 6
2018-12-31T15:37:04.945+0530 I STORAGE [initandlisten] WiredTiger message [1546250824:945584][30064:0x7f4cb133db40], txn-recover: Set global recovery timestamp: 0
2018-12-31T15:37:04.964+0530 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2018-12-31T15:37:04.975+0530 I CONTROL [initandlisten]
2018-12-31T15:37:04.975+0530 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-12-31T15:37:04.975+0530 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2018-12-31T15:37:04.975+0530 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2018-12-31T15:37:04.975+0530 I CONTROL [initandlisten]
2018-12-31T15:37:04.975+0530 I CONTROL [initandlisten]
2018-12-31T15:37:04.976+0530 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2018-12-31T15:37:04.976+0530 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2018-12-31T15:37:04.976+0530 I CONTROL [initandlisten]
2018-12-31T15:37:04.976+0530 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2018-12-31T15:37:04.976+0530 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2018-12-31T15:37:04.976+0530 I CONTROL [initandlisten]
2018-12-31T15:37:04.995+0530 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/srv/mongodb/rs0-0/diagnostic.data'
2018-12-31T15:37:04.996+0530 I REPL [initandlisten] Did not find local voted for document at startup.
2018-12-31T15:37:04.997+0530 I REPL [initandlisten] Rollback ID is 1
2018-12-31T15:37:04.997+0530 I REPL [initandlisten] Did not find local replica set configuration document at startup; NoMatchingDocument: Did not find replica set configuration document in local.system.replset
2018-12-31T15:37:04.997+0530 I CONTROL [LogicalSessionCacheRefresh] Sessions collection is not set up; waiting until next sessions refresh interval: Replication has not yet been configured
2018-12-31T15:37:04.997+0530 I NETWORK [initandlisten] waiting for connections on port 27017
2018-12-31T15:37:04.998+0530 I CONTROL [LogicalSessionCacheReap] Sessions collection is not set up; waiting until next sessions reap interval: config.system.sessions does not exist
Run Code Online (Sandbox Code Playgroud)
我尝试遵循其他教程,其中命令没有 --ip_bind 选项,但我仍然面临同样的错误。我尝试在网上搜索此特定错误,但没有遇到任何解决我的错误的方法。
Bor*_*ris 10
您需要使用rs.initiate()启动它。
一旦你像你一样启动,你可以从另一个终端运行它
mongo --eval 'rs.initiate();'
Run Code Online (Sandbox Code Playgroud)
如果您熟悉 docker,则可以重现错误和初始化:
docker run --rm -it mongo:4.0 /bin/bash -c "\
mongod --replSet rs0 --fork --logpath /var/log/mongodb/mongod.log &&\
sleep 5 &&\
mongo --eval 'rs.initiate();' &&\
tail -n +0 -f /var/log/mongodb/mongod.log"
Run Code Online (Sandbox Code Playgroud)
我使用--fork作为守护进程运行 mongod,以便稍后能够调用 rs.initiate()
| 归档时间: |
|
| 查看次数: |
9653 次 |
| 最近记录: |