MongoDB 4.2 не запускается на Ubuntu 18.04 после переустановки - процесс немедленно останавливается - PullRequest
0 голосов
/ 26 сентября 2019

У меня проблема с mongoDB - я иду пошагово с официальным руководством: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

Также я установил с помощью этого ответа (конечно, я изменил некоторые команды для загрузки 4.2, а не 4.0, как это в этомответ): https://askubuntu.com/questions/842592/apt-get-fails-on-16-04-or-18-04-installing-mongodb/842599#842599

Но, в конце концов, он все еще не работает:

adrian@ubuntu:~$ sudo service mongod start
adrian@ubuntu:~$ sudo service mongod status
● mongod.service - MongoDB Database Server
   Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2019-09-26 09:37:53 CEST; 2s ago
     Docs: https://docs.mongodb.org/manual
  Process: 5220 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=62)
 Main PID: 5220 (code=exited, status=62)

Sep 26 09:37:51 ubuntu systemd[1]: Started MongoDB Database Server.
Sep 26 09:37:53 ubuntu systemd[1]: mongod.service: Main process exited, code=exited, status=62/n/a
Sep 26 09:37:53 ubuntu systemd[1]: mongod.service: Failed with result 'exit-code'.

Даже когда я пытаюсь исследовать журналы Монго, он все еще не говорит мне много:

adrian@ubuntu:~$ sudo tail -n 100 /var/log/mongodb/mongod.log
2019-09-26T09:37:51.893+0200 I  CONTROL  [main] ***** SERVER RESTARTED *****
2019-09-26T09:37:51.895+0200 I  CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-09-26T09:37:51.901+0200 I  CONTROL  [initandlisten] MongoDB starting : pid=5220 port=27017 dbpath=/var/lib/mongodb 64-bit host=ubuntu
2019-09-26T09:37:51.901+0200 I  CONTROL  [initandlisten] db version v4.2.0
2019-09-26T09:37:51.901+0200 I  CONTROL  [initandlisten] git version: a4b751dcf51dd249c5865812b390cfd1c0129c30
2019-09-26T09:37:51.901+0200 I  CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.1.1  11 Sep 2018
2019-09-26T09:37:51.901+0200 I  CONTROL  [initandlisten] allocator: tcmalloc
2019-09-26T09:37:51.901+0200 I  CONTROL  [initandlisten] modules: none
2019-09-26T09:37:51.901+0200 I  CONTROL  [initandlisten] build environment:
2019-09-26T09:37:51.901+0200 I  CONTROL  [initandlisten]     distmod: ubuntu1804
2019-09-26T09:37:51.901+0200 I  CONTROL  [initandlisten]     distarch: x86_64
2019-09-26T09:37:51.901+0200 I  CONTROL  [initandlisten]     target_arch: x86_64
2019-09-26T09:37:51.901+0200 I  CONTROL  [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { timeZoneInfo: "/usr/share/zoneinfo" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2019-09-26T09:37:51.901+0200 I  STORAGE  [initandlisten] Detected data files in /var/lib/mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2019-09-26T09:37:51.901+0200 I  STORAGE  [initandlisten] 
2019-09-26T09:37:51.901+0200 I  STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-09-26T09:37:51.901+0200 I  STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-09-26T09:37:51.901+0200 I  STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=11527M,cache_overflow=(file_max=0M),session_max=33000,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,checkpoint_progress],
2019-09-26T09:37:52.400+0200 I  STORAGE  [initandlisten] WiredTiger message [1569483472:400536][5220:0x7fc6c8d05b00], txn-recover: Recovering log 20 through 21
2019-09-26T09:37:52.460+0200 I  STORAGE  [initandlisten] WiredTiger message [1569483472:460670][5220:0x7fc6c8d05b00], txn-recover: Recovering log 21 through 21
2019-09-26T09:37:52.544+0200 I  STORAGE  [initandlisten] WiredTiger message [1569483472:544472][5220:0x7fc6c8d05b00], txn-recover: Main recovery loop: starting at 20/896 to 21/256
2019-09-26T09:37:52.607+0200 I  STORAGE  [initandlisten] WiredTiger message [1569483472:607556][5220:0x7fc6c8d05b00], txn-recover: Recovering log 20 through 21
2019-09-26T09:37:52.643+0200 I  STORAGE  [initandlisten] WiredTiger message [1569483472:643077][5220:0x7fc6c8d05b00], txn-recover: Recovering log 21 through 21
2019-09-26T09:37:52.669+0200 I  STORAGE  [initandlisten] WiredTiger message [1569483472:669301][5220:0x7fc6c8d05b00], txn-recover: Set global recovery timestamp: (0,0)
2019-09-26T09:37:52.677+0200 I  RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2019-09-26T09:37:52.682+0200 I  STORAGE  [initandlisten] Timestamp monitor starting
2019-09-26T09:37:52.683+0200 I  CONTROL  [initandlisten] 
2019-09-26T09:37:52.683+0200 I  CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-09-26T09:37:52.684+0200 I  CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2019-09-26T09:37:52.684+0200 I  CONTROL  [initandlisten] 
2019-09-26T09:37:52.698+0200 I  SHARDING [initandlisten] Marking collection local.system.replset as collection version: <unsharded>
2019-09-26T09:37:52.698+0200 F  CONTROL  [initandlisten] ** IMPORTANT: UPGRADE PROBLEM: Found an invalid featureCompatibilityVersion document (ERROR: BadValue: Invalid value for version, found 3.6, expected '4.2' or '4.0'. Contents of featureCompatibilityVersion document in admin.system.version: { _id: "featureCompatibilityVersion", version: "3.6" }. See http://dochub.mongodb.org/core/4.0-feature-compatibility.). If the current featureCompatibilityVersion is below 4.0, see the documentation on upgrading at http://dochub.mongodb.org/core/4.0-upgrade-fcv.
2019-09-26T09:37:52.698+0200 I  NETWORK  [initandlisten] shutdown: going to close listening sockets...
2019-09-26T09:37:52.698+0200 I  NETWORK  [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2019-09-26T09:37:52.698+0200 I  -        [initandlisten] Stopping further Flow Control ticket acquisitions.
2019-09-26T09:37:52.698+0200 I  STORAGE  [initandlisten] Deregistering all the collections
2019-09-26T09:37:52.698+0200 I  STORAGE  [initandlisten] Timestamp monitor shutting down
2019-09-26T09:37:52.698+0200 I  STORAGE  [initandlisten] WiredTigerKVEngine shutting down
2019-09-26T09:37:52.699+0200 I  STORAGE  [initandlisten] Shutting down session sweeper thread
2019-09-26T09:37:52.699+0200 I  STORAGE  [initandlisten] Finished shutting down session sweeper thread
2019-09-26T09:37:52.699+0200 I  STORAGE  [initandlisten] Shutting down journal flusher thread
2019-09-26T09:37:52.779+0200 I  STORAGE  [initandlisten] Finished shutting down journal flusher thread
2019-09-26T09:37:52.779+0200 I  STORAGE  [initandlisten] Shutting down checkpoint thread
2019-09-26T09:37:52.779+0200 I  STORAGE  [initandlisten] Finished shutting down checkpoint thread
2019-09-26T09:37:52.779+0200 I  STORAGE  [initandlisten] Downgrading WiredTiger datafiles.
2019-09-26T09:37:52.808+0200 I  STORAGE  [initandlisten] WiredTiger message [1569483472:808033][5220:0x7fc6c8d05b00], txn-recover: Recovering log 21 through 22
2019-09-26T09:37:52.848+0200 I  STORAGE  [initandlisten] WiredTiger message [1569483472:848763][5220:0x7fc6c8d05b00], txn-recover: Recovering log 22 through 22
2019-09-26T09:37:52.891+0200 I  STORAGE  [initandlisten] WiredTiger message [1569483472:891333][5220:0x7fc6c8d05b00], txn-recover: Main recovery loop: starting at 21/3328 to 22/256
2019-09-26T09:37:52.944+0200 I  STORAGE  [initandlisten] WiredTiger message [1569483472:944712][5220:0x7fc6c8d05b00], txn-recover: Recovering log 21 through 22
2019-09-26T09:37:52.977+0200 I  STORAGE  [initandlisten] WiredTiger message [1569483472:977288][5220:0x7fc6c8d05b00], txn-recover: Recovering log 22 through 22
2019-09-26T09:37:53.003+0200 I  STORAGE  [initandlisten] WiredTiger message [1569483473:3143][5220:0x7fc6c8d05b00], txn-recover: Set global recovery timestamp: (0,0)
2019-09-26T09:37:53.023+0200 I  STORAGE  [initandlisten] shutdown: removing fs lock...
2019-09-26T09:37:53.023+0200 I  CONTROL  [initandlisten] now exiting
2019-09-26T09:37:53.023+0200 I  CONTROL  [initandlisten] shutting down with code:62

Буду очень признателен за любые советы

Ответы [ 2 ]

1 голос
/ 26 сентября 2019

Удалите полную версию mongodb из вашей Ubuntu

sudo apt-get purge mongo* // or sudo apt remove mongo*
sudo apt-get purge mongodb-org*

Сделайте резервную копию вашей базы данных и удалите журнал и данные, используя папку

sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb

Теперь установите снова с этим

$ wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc \
  sudo apt-key add -

Добавьте источники

$ echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.2 multiverse" \
  sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list

Затем установите пакет mongodb заново

sudo apt-get install -y mongodb-org=4.2.0 \
                        mongodb-org-server=4.2.0 \
                        mongodb-org-shell=4.2.0 \
                        mongodb-org-mongos=4.2.0 \
                        mongodb-org-tools=4.2.0

Запустите службу, используя mongodb

$ systemctl enable mongod.service

$ sudo service mongod start

Или следуйте этому документу Процесс установки

1 голос
/ 26 сентября 2019

У меня также есть эта проблема, я решил эту проблему, изменив bindIp в конфигурации mongo

В Linux при использовании диспетчера пакетов дляустановите MongoDB.

sudo nano /etc/mongod.conf

, затем отредактируйте bindIP на

bindIp: [127.0.0.1, X.X.X.X]

Затем перезапустите mongodb.

sudo service mongod stop

sudo service mongod start
...