簡體   English   中英

嘗試將現有的mongodb實例轉換為副本集時如何解決“未設置會話集合”錯誤

[英]How to fix 'Sessions collection is not set up' error when trying to convert existing mongodb instance to replica set

我已經使用以下鏈接https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/安裝了最新版本的mongodb(v4.0.5) /在此之后,我嘗試設置使用以下教程中提供的說明進行復制,但是一旦我嘗試在“ 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

我嘗試遵循其他教程,其中的命令沒有--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()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM