如何创建到托管 MongoDB(版本 3)的计算机(RedHat Enterprise Linux)的 SSH 隧道,然后从我的计算机(Windows)在数据库上运行 R 脚本?
我知道如何通过 puTTY 连接到计算机,然后从计算机上的 shell 运行上传的 FCP 传输的 R 脚本,但是我想从我的 PC 执行分析,以便我可以快速测试我的脚本并导出分析和轻松得出结果。
最佳答案
这是根据我的远程 MySQL SSH 连接的说明改编的。远程数据库服务器配置为在端口 27017 上监听其本地地址。 (127.0.0.1:27017)。您需要将 10.10.10.10 替换为 MongoDB 服务器的 IP 地址。
1. Install putty.exe
2. Start putty.
3. Sessions Tab:
3a. Set hostname like:
3b. <username@hostname>
3c. Eg: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8ee3e1e0e9e1d1fbfdebfccee3e1e0e9e1eaeca0fdebfcf8ebfca0ede1e3" rel="noreferrer noopener nofollow">[email protected]</a>
4. Connection : SSH : Tunnels tab.
4a. Source port: 27017
4b. Destination: 10.10.10.10:27017
5. Sessions Tab
5a. Saved Session: Type name such as “MongoDB Server”
5b. Select [Save] button
在 Windows 客户端上,您将使用连接字符串连接到 127.0.0.1:27017(您在上面的 putty 连接中配置的本地源端口)
编辑将 192.168.0.1 更改为 127.0.0.1(错误的本地/环回地址)
关于r - 在 R 中通过 SSH 连接到 MongoDB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30849876/