在 Debian 上将关系迁移器作为系统服务运行
当您在 Debian 服务器上安装关系迁移器时,您还可以设置关系迁移器以作为系统服务运行。通过将关系迁移器作为系统服务运行,关系迁移器会在服务器启动时自动启动。
步骤
创建一个
/etc/systemd/system/migrator.service
文件。将以下文本复制到
/etc/systemd/system/migrator.service
文件中。根据需要替换二进制路径。[Unit] Description=MongoDB Relational Migrator [Service] ExecStart="/opt/mongodb-relational-migrator/bin/MongoDB Relational Migrator [Install] WantedBy=multi-user.target 重新加载
systemd
以读取新创建的服务。systemctl daemon-reload 启用关系迁移器服务,以便在服务器启动时自动启动。
您可以使用以下
systemctl
命令来管理服务systemctl enable migrator.service systemctl start migrator.service