Назад | Перейти на главную страницу

Не удается запустить монго - Монго убит

Я попытался перенести свою установку Mongo с 14.04 на 16.04, используя новый контейнер LXD.

Я использовал предыдущий файл конфигурации, который можно найти ниже.

mongod.cnf

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
storage:
  dbPath: /home/manager/mongo/data

#  engine:
#  mmapv1:
#    smallFiles: true

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /home/manager/mongo/log/mongod.log

# network interfaces
net:
  port: 27031
  bindIp: 127.0.0.1

processManagement:
  fork: true

setParameter:
   enableLocalhostAuthBypass: false

security:
  keyFile: /home/manager/mongo/mongodb-keyfile

#operationProfiling:

#replication:
#  replSetName: rs1

#sharding:

## Enterprise-Only Options:

#auditLog:

#snmp:

Вот моя стартовая служба:

[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target

[Service]
User=manager
ExecStart=/usr/bin/mongod --quiet --config /home/manager/mongo/mongod.conf

[Install]
WantedBy=multi-user.target

И вот ошибка, которую я получаю в файле журнала:

2016-06-03T10:39:30.657+0000 I CONTROL  [initandlisten] MongoDB starting : pid=807 port=27031 dbpath=/home/manager/mongo/data 64-bit host=mongo-rep-01
2016-06-03T10:39:30.657+0000 I CONTROL  [initandlisten] db version v3.2.6
2016-06-03T10:39:30.657+0000 I CONTROL  [initandlisten] git version: 05552b562c7a0b3143a729aaa0838e558dc49b25
2016-06-03T10:39:30.657+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g-fips  1 Mar 2016
2016-06-03T10:39:30.657+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2016-06-03T10:39:30.657+0000 I CONTROL  [initandlisten] modules: none
2016-06-03T10:39:30.657+0000 I CONTROL  [initandlisten] build environment:
2016-06-03T10:39:30.657+0000 I CONTROL  [initandlisten]     distmod: ubuntu1404
2016-06-03T10:39:30.657+0000 I CONTROL  [initandlisten]     distarch: x86_64
2016-06-03T10:39:30.657+0000 I CONTROL  [initandlisten]     target_arch: x86_64
2016-06-03T10:39:30.657+0000 I CONTROL  [initandlisten] options: { config: "/home/manager/mongo/mongod.conf", net: { bindIp: "127.0.0.1", port: 27031 }, processManagement: { fork: true }, security: { keyFile: "/home/manager/mongo/mongodb-keyfile" }, setParameter: { e$
2016-06-03T10:39:30.688+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=18G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idl$
2016-06-03T10:39:31.174+0000 I CONTROL  [initandlisten]
2016-06-03T10:39:31.175+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-06-03T10:39:31.175+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2016-06-03T10:39:31.175+0000 I CONTROL  [initandlisten]
2016-06-03T10:39:31.175+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-06-03T10:39:31.175+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2016-06-03T10:39:31.175+0000 I CONTROL  [initandlisten]
2016-06-03T10:39:31.177+0000 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/home/manager/mongo/data/diagnostic.data'
2016-06-03T10:39:31.177+0000 I NETWORK  [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-06-03T10:39:31.178+0000 I CONTROL  [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
2016-06-03T10:39:31.178+0000 I FTDC     [signalProcessingThread] Shutting down full-time diagnostic data capture
2016-06-03T10:39:31.185+0000 I NETWORK  [initandlisten] waiting for connections on port 27031
2016-06-03T10:39:31.185+0000 I CONTROL  [signalProcessingThread] now exiting
2016-06-03T10:39:31.185+0000 I NETWORK  [signalProcessingThread] shutdown: going to close listening sockets...
2016-06-03T10:39:31.185+0000 I NETWORK  [signalProcessingThread] closing listening socket: 6
2016-06-03T10:39:31.185+0000 I NETWORK  [signalProcessingThread] closing listening socket: 7
2016-06-03T10:39:31.186+0000 I NETWORK  [signalProcessingThread] removing socket file: /tmp/mongodb-27031.sock
2016-06-03T10:39:31.186+0000 I NETWORK  [signalProcessingThread] shutdown: going to flush diaglog...
2016-06-03T10:39:31.186+0000 I NETWORK  [signalProcessingThread] shutdown: going to close sockets...
2016-06-03T10:39:31.186+0000 I STORAGE  [signalProcessingThread] WiredTigerKVEngine shutting down
2016-06-03T10:39:32.336+0000 I STORAGE  [signalProcessingThread] shutdown: removing fs lock...
2016-06-03T10:39:32.336+0000 I CONTROL  [signalProcessingThread] dbexit:  rc: 0

И статус услуги:

root@mongo-rep-01:/home/manager/mongo# sudo systemctl status mongodb
● mongodb.service - High-performance, schema-free document-oriented database
   Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

Jun 03 10:17:17 mongo-rep-01 systemd[1]: Started High-performance, schema-free document-oriented database.
Jun 03 10:17:17 mongo-rep-01 mongod[643]: 2016-06-03T10:17:17.858+0000 W CONTROL  [main] Option: storage.smallFiles is deprecated. Please use storage.mmapv1.smallFiles instead.
Jun 03 10:17:17 mongo-rep-01 mongod[643]: about to fork child process, waiting until server is ready for connections.
Jun 03 10:17:17 mongo-rep-01 mongod[643]: forked process: 645
Jun 03 10:18:26 mongo-rep-01 systemd[1]: Started High-performance, schema-free document-oriented database.
Jun 03 10:18:26 mongo-rep-01 mongod[672]: about to fork child process, waiting until server is ready for connections.
Jun 03 10:18:26 mongo-rep-01 mongod[672]: forked process: 674
Jun 03 10:39:30 mongo-rep-01 systemd[1]: Started High-performance, schema-free document-oriented database.
Jun 03 10:39:30 mongo-rep-01 mongod[805]: about to fork child process, waiting until server is ready for connections.
Jun 03 10:39:30 mongo-rep-01 mongod[805]: forked process: 807

Основываясь на информации, которую я нашел здесь:

https://askubuntu.com/questions/787136/debugging-systemd-for-mongodb-3-2-on-ubuntu-16-04-sig-15-killing

Похоже, что systemd был источником прекращения "sig 15", указанного в файле журнала.

Это можно исправить в определении службы, указав, что процесс является типом разветвления:

[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target

[Service]
Type=forking
User=manager
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

[Install]
WantedBy=multi-user.target

В качестве альтернативы попробуйте изменить значение processManagement в файле mongo.conf:

processManagement:
  fork: false