gpt4 book ai didi

mongodb - 尝试将现有 mongodb 实例转换为副本集时如何修复 'Sessions collection is not set up' 错误

转载 作者:行者123 更新时间:2023-12-03 02:50:41 29 4
gpt4 key购买 nike

我已经使用以下链接安装了最新版本的 mongodb (v4.0.5) https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/接下来,我现在尝试使用以下教程中提供的说明来设置复制但是,一旦我在“2.通过发出以下命令在自己的 shell 窗口中启动 mongod 实例”处尝试该命令,它给了我以下错误“ session 集合未设置;等待下一个 session 刷新间隔:复制尚未配置”

我使用的命令: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

我尝试遵循其他教程,其中命令没有 --ip_bind 选项,但我仍然遇到相同的错误。我尝试在网上搜索此特定错误,但没有找到针对我的错误的任何解决方案。

最佳答案

您需要使用 rs.initiate() 启动它.

一旦您像以前那样启动,您就可以从其他终端运行它

mongo --eval 'rs.initiate();'
<小时/>

如果您熟悉 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"

我使用了--fork作为守护进程运行 mongod,以便稍后能够调用 rs.initiate()

关于mongodb - 尝试将现有 mongodb 实例转换为副本集时如何修复 'Sessions collection is not set up' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53986606/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com