问题描述
我正在使用管道工 API 创建 Web 应用程序。我已成功开发 API 并在本地服务器上完美运行。现在我想让应用程序上线。所以,我们有自己的服务器,我正在尝试部署 API。自一周以来,我一直在尝试部署 API,但有一天我遇到了一些错误。我确实参考了这个链接来部署 API https://www.rplumber.io/articles/hosting.html。我用的是pm2
当我从 root 用户运行此脚本 pm2 start --interpreter="Rscript" /var/www/html/biomitra/start_API/callapi.R
时。我明白了
[PM2] Starting /var/www/html/biomitra/start_API/callapi.R in fork_mode (1 instance)
[PM2] Done.
┌─────┬────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├─────┼────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ callapi │ default │ N/A │ fork │ 150427 │ 0s │ 0 │ online │ 0% │ 8.3mb │ root │ disabled
看起来已经完成了,但是当我从 html 页面通过时出现错误!
pm2 日志
[TAILING] Tailing last 15 lines for [all] processes (change the value with --lines option)
/root/.pm2/pm2.log last 15 lines:
PM2 | 2021-03-22T10:45:43: PM2 log: PM2 version : 4.5.0
PM2 | 2021-03-22T10:45:43: PM2 log: Node.js version : 15.12.0
PM2 | 2021-03-22T10:45:43: PM2 log: Current arch : x64
PM2 | 2021-03-22T10:45:43: PM2 log: PM2 home : /root/.pm2
PM2 | 2021-03-22T10:45:43: PM2 log: PM2 PID file : /root/.pm2/pm2.pid
PM2 | 2021-03-22T10:45:43: PM2 log: RPC socket file : /root/.pm2/rpc.sock
PM2 | 2021-03-22T10:45:43: PM2 log: BUS socket file : /root/.pm2/pub.sock
PM2 | 2021-03-22T10:45:43: PM2 log: Application log path : /root/.pm2/logs
PM2 | 2021-03-22T10:45:43: PM2 log: Worker Interval : 30000
PM2 | 2021-03-22T10:45:43: PM2 log: Process dump file : /root/.pm2/dump.pm2
PM2 | 2021-03-22T10:45:43: PM2 log: Concurrent actions : 2
PM2 | 2021-03-22T10:45:43: PM2 log: SIGTERM timeout : 1600
PM2 | 2021-03-22T10:45:43: PM2 log: ===============================================================================
PM2 | 2021-03-22T10:46:54: PM2 log: App [callapi:0] starting in -fork mode-
PM2 | 2021-03-22T10:46:54: PM2 log: App [callapi:0] online
/root/.pm2/logs/callapi-out.log last 15 lines:
/root/.pm2/logs/callapi-error.log last 15 lines:
0|callapi | createTcpserver: address already in use
0|callapi | Error in initialize(...) : Failed to create server
0|callapi | Calls: %>% ... <Anonymous> -> startServer -> <Anonymous> -> initialize
0|callapi | Execution halted
0|callapi | Running plumber API at http://0.0.0.0:8000
0|callapi | Running swagger Docs at http://127.0.0.1:8000/__docs__/
0|callapi | createTcpserver: address already in use
0|callapi | Error in initialize(...) : Failed to create server
0|callapi | Calls: %>% ... <Anonymous> -> startServer -> <Anonymous> -> initialize
0|callapi | Execution halted
0|callapi |
0|callapi |
0|callapi | Execution halted
0|callapi | Running plumber API at http://0.0.0.0:8000
0|callapi | Running swagger Docs at http://127.0.0.1:8000/__docs__/
谁能告诉我我哪里错了。
提前致谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)