我有3台运行MongoDB副本集的服务器。我目前在重启服务器后像这样启动节点:
mongod --replSet "name_of_replicaset" --bind_ip localhost,this_server_hostname_in_host_file --fork --syslog --auth --keyFile "path_to_file"问题是,每次重新启动服务器时,我都必须这样做。我已经检查了MongoDB的在线文档和官方文档,但我找不到让服务器自己启动节点的方法。
有没有办法让服务器在节点重新启动后重新启动它?
发布于 2020-08-22 23:28:09
您可以使用systemctl来完成此操作。
为此创建一个服务,并通过systemctl enable命令启用该服务。一旦您重新启动服务器,它将自动启动。
https://stackoverflow.com/questions/63535097
复制相似问题