Mongodb 服务器在 MongoServer.Shutdown() 之后启动 [英] Mongodb server Start after MongoServer.Shutdown()

查看:50
本文介绍了Mongodb 服务器在 MongoServer.Shutdown() 之后启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MongoServer.Shutdown() 的反函数是什么?与断开连接不同,关机实际上是关闭服务器.我想在关闭服务器后以编程方式启动它.MongoServer.Create() 似乎只创建了一个连接到服务器的实例.如果服务器已关闭,它实际上不会启动服务器.

What is the opposite function to MongoServer.Shutdown()? Unlike Disconnect, Shutdown actually shuts down the server. I want to programmatically boot up the server after I shut it down. MongoServer.Create() seems to only create an instance of a connection to the server. It doesn't actually boot up the server if it's been shut down.

有什么想法吗?

推荐答案

shutdown 命令连接到服务器并告诉它关闭.如果没有正在运行的服务器,则无法连接到它来告诉它启动!

The shutdown command connects to the server and tells it to shutdown. If there is no running server, you can't connect to it to tell it to start!

要从 C# 程序启动服务器,您只需启动 mongod 进程,例如使用 System.Diagnostics.Process 类.

To start the server from your C# program, you could just start the mongod process, by using the System.Diagnostics.Process class for example.

这篇关于Mongodb 服务器在 MongoServer.Shutdown() 之后启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆