2013-04-12 27 views
5

Tôi là người mới bắt đầu trong MongoDB và tôi có một vấn đề với việc thực hiện điều này trong máy chủ.Quá trình MongoDB sẽ ngừng hoạt động mỗi ngày. làm thế nào chạy mongod mãi mãi trong máy chủ?

Dự án của tôi được lưu trữ trên máy chủ của hostmonster.com nhưng chúng không hỗ trợ cho các cơ sở dữ liệu MongoDB, mặc dù họ nói rằng tôi có thể cài đặt nó theo trách nhiệm của riêng tôi. Sau đó, tôi đã cài đặt MongoDB 2.4.1 mà không gặp sự cố vào Linux 64, sau, trong thư mục bin MongoDB (với: mongo, mongod, mongodump ...) Tôi đã tạo một thư mục có tên 'data' và 'data/db 'để thực hiện một số thử nghiệm.

từ giao diện điều khiển, tôi kết nối với server qua giao thức SSH và tôi chạy

./mongod --dbpath 'data/db' 

và nó hoạt động.

Nhưng, tôi cần nó tự động chạy mãi mãi.

Tôi làm theo các bước của Mongodb can't start và chạy các dòng tiếp theo:

./mongod --fork --dbpath 'data/db' --smallfiles --logpath 'data/mongodb.log' --logappend 

Nó cũng làm việc, Nó bắt đầu quá trình này và tôi đóng giao diện điều khiển, quá trình này tiếp tục chạy và tôi có thể xem dữ liệu của tôi trên tên miền của tôi .

Vấn đề là quá trình mất một ngày để đóng, tức là, tôi không thể nhìn thấy dữ liệu của mình trên miền, sau đó, tôi cần chạy mongod một lần nữa. với:

./mongod --fork --dbpath 'data/db' --smallfiles --logpath 'data/mongodb.log' --logappend 

tôi không muốn làm điều đó mỗi ngày, câu hỏi của tôi là:

gì có thể là vấn đề ?, tại sao quá trình mongod chết mỗi ngày?

làm cách nào để tôi có thể chạy quá trình này mãi mãi?

Xin lỗi vì tiếng Anh của tôi.

Chỉnh sửa: Thêm nhật ký lỗi cuối cùng. Tôi không hiểu.

Fri Apr 12 03:19:34.577 [TTLMonitor] query local.system.indexes query: { expireAfterSeconds: { $exists: true } } ntoreturn:0 ntoskip:0 nscanned:0 keyUpdates:0 locks(micros) r:141663 nreturned:0 reslen:20 141ms 
Fri Apr 12 03:19:34.789 [TTLMonitor] query users.system.indexes query: { expireAfterSeconds: { $exists: true } } ntoreturn:0 ntoskip:0 nscanned:3 keyUpdates:0 locks(micros) r:211595 nreturned:0 reslen:20 211ms 
Fri Apr 12 03:20:57.869 [PeriodicTask::Runner] task: DBConnectionPool-cleaner took: 18215ms 
Fri Apr 12 03:20:57.931 [PeriodicTask::Runner] task: WriteBackManager::cleaner took: 8ms 
Fri Apr 12 03:22:14.155 [PeriodicTask::Runner] task: DBConnectionPool-cleaner took: 32ms 
Fri Apr 12 03:22:14.215 [PeriodicTask::Runner] task: WriteBackManager::cleaner took: 14ms 
Fri Apr 12 03:22:30.670 [TTLMonitor] query actarium.system.indexes query: { expireAfterSeconds: { $exists: true } } ntoreturn:0 ntoskip:0 nscanned:2 keyUpdates:0 locks(micros) r:430204 nreturned:0 reslen:20 430ms 
Fri Apr 12 03:23:14.825 [PeriodicTask::Runner] task: DBConnectionPool-cleaner took: 7ms 
Fri Apr 12 03:23:31.133 [TTLMonitor] query actarium.system.indexes query: { expireAfterSeconds: { $exists: true } } ntoreturn:0 ntoskip:0 nscanned:2 keyUpdates:0 locks(micros) r:179175 nreturned:0 reslen:20 168ms 
Fri Apr 12 03:25:19.201 [PeriodicTask::Runner] task: WriteBackManager::cleaner took: 505ms 
Fri Apr 12 03:25:23.370 [TTLMonitor] query local.system.indexes query: { expireAfterSeconds: { $exists: true } } ntoreturn:0 ntoskip:0 nscanned:0 keyUpdates:0 locks(micros) r:3604735 nreturned:0 reslen:20 3604ms 
Fri Apr 12 03:25:25.294 [TTLMonitor] query users.system.indexes query: { expireAfterSeconds: { $exists: true } } ntoreturn:0 ntoskip:0 nscanned:3 keyUpdates:0 numYields: 1 locks(micros) r:3479328 nreturned:0 reslen:20 1882ms 
Fri Apr 12 03:26:26.647 [TTLMonitor] query actarium.system.indexes query: { expireAfterSeconds: { $exists: true } } ntoreturn:0 ntoskip:0 nscanned:2 keyUpdates:0 numYields: 1 locks(micros) r:1764712 nreturned:0 reslen:20 1044ms 
Fri Apr 12 04:09:27.804 [TTLMonitor] query actarium.system.indexes query: { expireAfterSeconds: { $exists: true } } ntoreturn:0 ntoskip:0 nscanned:2 keyUpdates:0 locks(micros) r:200919 nreturned:0 reslen:20 200ms 
Fri Apr 12 04:43:54.002 got signal 15 (Terminated), will terminate after current cmd ends 
Fri Apr 12 04:43:54.151 [interruptThread] now exiting 
Fri Apr 12 04:43:54.151 dbexit: 
Fri Apr 12 04:43:54.157 [interruptThread] shutdown: going to close listening sockets... 
Fri Apr 12 04:43:54.160 [interruptThread] closing listening socket: 9 
Fri Apr 12 04:43:54.160 [interruptThread] closing listening socket: 10 
Fri Apr 12 04:43:54.160 [interruptThread] closing listening socket: 11 
Fri Apr 12 04:43:54.160 [interruptThread] removing socket file: /tmp/mongodb-27017.sock 
Fri Apr 12 04:43:54.160 [interruptThread] shutdown: going to flush diaglog... 
Fri Apr 12 04:43:54.160 [interruptThread] shutdown: going to close sockets... 
Fri Apr 12 04:43:54.176 [interruptThread] shutdown: waiting for fs preallocator... 
Fri Apr 12 04:43:54.176 [interruptThread] shutdown: lock for final commit... 
Fri Apr 12 04:43:54.176 [interruptThread] shutdown: final commit... 
Fri Apr 12 04:43:54.176 [interruptThread] shutdown: closing all files... 
Fri Apr 12 04:43:54.212 [interruptThread] closeAllFiles() finished 
Fri Apr 12 04:43:54.220 [interruptThread] journalCleanup... 
Fri Apr 12 04:43:54.246 [interruptThread] removeJournalFiles 
Fri Apr 12 04:43:54.280 [interruptThread] error removing journal files 
boost::filesystem::directory_iterator::construct: No such file or directory: "/home2/anuncio3/bin/mongodb-linux-x86_64-2.4.1/bin/data/db/journal" 
Fri Apr 12 04:43:54.280 [interruptThread] error couldn't remove journal file during shutdown boost::filesystem::directory_iterator::construct: No such file or directory: "/home2/anuncio3/bin/mongodb-linux-x86_64-2.4.1/bin/data/db/journal" 
Fri Apr 12 04:43:54.285 shutdown failed with exception 
Fri Apr 12 04:43:54.285 dbexit: really exiting now 
+0

kiểm tra nhật ký máy chủ/mongo để tìm thông báo lỗi? –

+0

đã sẵn sàng, tôi đã thêm thông tin nhật ký lỗi. – edwinfmesa

+0

Có vẻ như màn hình TTL có thể đã gặp lỗi – Sammaye

Trả lời

4

câu trả lời của bạn là ở đây:

Fri Apr 12 04:43:54.002 got signal 15 (Terminated), will terminate after current cmd ends 
Fri Apr 12 04:43:54.151 [interruptThread] now exiting 

quá trình bạn đang nhận được tín hiệu 15, đó là tín hiệu kill mặc định. Có thể hệ thống của họ sẽ tự động giết chết các quy trình chạy dài hoặc tương tự. Nếu đó thực sự là những gì đang xảy ra, thì chủ nhà của bạn sẽ phải giải quyết điều đó.

Bên cạnh đó, các lỗi này:

Fri Apr 12 04:43:54.280 [interruptThread] error removing journal files 
boost::filesystem::directory_iterator::construct: No such file or directory: "/home2/anuncio3/bin/mongodb-linux-x86_64-2.4.1/bin/data/db/journal" 
Fri Apr 12 04:43:54.280 [interruptThread] error couldn't remove journal file during shutdown boost::filesystem::directory_iterator::construct: No such file or directory: "/home2/anuncio3/bin/mongodb-linux-x86_64-2.4.1/bin/data/db/journal" 

chỉ ra rằng cái gì là sai với bạn thư mục cài đặt của dữ liệu. Các tập tin tạp chí hoặc không tồn tại, hoặc đang mất tích; nếu một số quá trình trên hệ thống đang cố gắng dọn dẹp mọi thứ, thì nó sẽ không làm tôi ngạc nhiên nếu có điều gì đó đang làm nản lòng các tập tin tạp chí của bạn.

0

Tôi biết đây là câu hỏi cũ nhưng trải nghiệm của tôi có thể hữu ích cho những người đánh giá khác. Dựa trên các bài kiểm tra của tôi, họ chỉ cho phép bạn chạy một chương trình trong 5 phút (đôi khi nhiều hơn thế này) trước khi giết nó, vì vậy khá vô dụng khi cài đặt MongoDB trừ khi bạn có một IP chuyên dụng.

Các vấn đề liên quan