RHEL/CentOS 系统安装
您可以在 Red Hat Enterprise Linux (RHEL)/ CentOS服务器上安装Relational Migrator 。这种安装方法允许Relational Migrator在无人值守的服务器上运行。在无人值守的服务器上运行时, Relational Migrator会绑定到服务器上的任何IP和端口,并将其公开为 Web应用程序。
关于此任务
Relational Migrator在 RHEL/ CentOS上使用以下文件位置:
配置文件
~/Migrator/user.properties
下载的 JDBC 驱动程序
/opt/mongodb-relational-migrator/lib/app/lib
日志文件
~/Migrator/Logs/migrator.log
步骤
安装 Relational Migrator
从 发布页面下载最新的
.rpm
二进制文件。安装 Relational Migrator。
sudo yum install mongodb-relational-migrator-<version_number>-1.x86_64.rpm (可选)要连接到 Oracle 或 MySQL 驱动程序,请下载驱动程序并将其放入 Relational Migrator 目录中。
要下载并安装 MySQL 或 Oracle 驱动程序,请参阅以下内容:
将驱动程序文件复制到
/opt/mongodb-relational-migrator/lib/app/lib
。要复制驱动程序,请使用以下示例:
curl https://download.oracle.com/otn-pub/otn_software/jdbc/216/ojdbc11.jar -O -L -b -o
有关更多信息,请参阅在本地计算机上安装。
将目录更改为 Relational Migrator
/bin
位置并启动应用程序。cd /opt/mongodb-relational-migrator/bin ./mongodb-relational-migrator 允许 Relational Migrator 作为无人值守的独立运行的实例运行。
在
user.properties
文件中,取消注释spring.profiles.active: unattended
。(可选)更新 TLS/SSL 配置属性。
在
user.properties
文件中,取消注释并更新 TLS/SSL 配置属性。建议在无人值守的服务器上为Relational Migrator配置 TLS/SSL。您可以将Relational Migrator绑定到服务器上的任何IP和端口。有关其他信息,请参阅 SSL 配置属性。
(可选)更新 Relational Migrator 运行的端口。
默认下, Relational Migrator配置为在端口
8278
上运行。要更改Relational Migrator运行的端口,更新user.properties
文件中的server.port
行以指定首选端口。使用二进制文件运行 Relational Migrator。
bin
目录的路径是/opt/mongodb-relational-migrator/bin
。要使用二进制文件运行 Relational Migrator,请运行以下命令:
cd /opt/mongodb-relational-migrator/bin ./mongodb-relational-migrator (可选)检查日志中是否有错误或其他信息。
日志位于
~/Migrator/Logs/migrator.log
中。将 Relational Migrator 作为系统服务运行时,该路径位于服务用户的主目录下。
作为系统服务运行
在 RHEL/ CentOS服务器上安装Relational Migrator时,还可以将Relational Migrator设立为系统服务运行。将Relational Migrator作为系统服务运行时, Relational Migrator会在服务器启动时自动启动。
创建
/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 允许 Relational Migrator 服务在初创企业运行并为当前会话启动。
您可以使用
systemctl
命令托管该服务。要在初创企业运行并启动当前会话,请运行以下命令:systemctl enable migrator.service systemctl start migrator.service