Digital Ocean上的流星(Mup)内存问题 [英] Memory issue with meteor up (mup) on Digital Ocean

查看:78
本文介绍了Digital Ocean上的流星(Mup)内存问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到与我的问题相关的现有帖子.在Digital Ocean Droplet上,mup设置很好,但是当我尝试进行部署时,出现以下错误.有任何想法吗?谢谢!

I couldn't find existing posts related to my issue. On a Digital Ocean Droplet, mup setup went fine, but when I try to deploy, I get the following error. Any ideas? Thanks!

root@ts:~/ts-deploy# mup deploy

Meteor Up: Production Quality Meteor Deployments

Building Started: /root/TS/
Bundling Error: code=137, error:
-------------------STDOUT-------------------

Figuring out the best package versions to use. This may take a moment.

-------------------STDERR-------------------
bash: line 1: 31217 Killed meteor build --directory /tmp/dc37af3e-eca0-4a19-bf1a-d6d38bb8f517

下面是日志.节点-v表示我正在使用0.10.31.如何检查哪个脚本退出并出现错误?还有其他想法吗?谢谢!

Below are the logs. node -v indicates I am using 0.10.31. How do I check which script is exiting with the error? Any other ideas? Thanks!

error: Forever detected script exited with code: 1
error: Script restart attempt #106
Meteor requires Node v0.10.29 or later.
error: Forever detected script exited with code: 1
error: Script restart attempt #107
Meteor requires Node v0.10.29 or later.
error: Forever detected script exited with code: 1
error: Script restart attempt #108

stepping down to gid: meteoruser
stepping down to uid: meteoruser

返回到DO Droplet的旧备份,并重新运行mup设置和mup部署后,现在可以在命令行输出中找到它

After I went back to an old backup of the DO Droplet, and re-ran mup setup and mup deploy, I now get this in the command line output

Building Started: /root/TS
Bundling Error: code=134, error:
-------------------STDOUT-------------------

Figuring out the best package versions to use. This may take a moment.

-------------------STDERR-------------------
FATAL ERROR: JS Allocation failed - process out of memory
bash: line 1:  1724 Aborted                 (core dumped) meteor build --directory /tmp/bfdbcb45-9c61-435f-9875-3fb304358996

,并在日志中显示:

 >> stepping down to gid: meteoruser
 >> stepping down to uid: meteoruser
Exception while invoking method 'login' TypeError: Cannot read property '0' of undefined
    at ServiceConfiguration.configurations.remove.service (app/server/accounts.js:7:26)
    at Object.Accounts.insertUserDoc (packages/accounts-base/accounts_server.js:1024)
    at Object.Accounts.updateOrCreateUserFromExternalService (packages/accounts-base/accounts_server.js:1189)
    at Package (packages/accounts-oauth/oauth_server.js:45)
    at packages/accounts-base/accounts_server.js:383
    at tryLoginMethod (packages/accounts-base/accounts_server.js:186)
    at runLoginHandlers (packages/accounts-base/accounts_server.js:380)
    at Meteor.methods.login (packages/accounts-base/accounts_server.js:434)
    at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1594)
    at packages/ddp/livedata_server.js:648
Exception while invoking method 'login' TypeError: Cannot read property '0' of undefined
    at ServiceConfiguration.configurations.remove.service (app/server/accounts.js:7:26)
    at Object.Accounts.insertUserDoc (packages/accounts-base/accounts_server.js:1024)
    at Object.Accounts.updateOrCreateUserFromExternalService (packages/accounts-base/accounts_server.js:1189)
    at Package (packages/accounts-oauth/oauth_server.js:45)
    at packages/accounts-base/accounts_server.js:383
    at tryLoginMethod (packages/accounts-base/accounts_server.js:186)
    at runLoginHandlers (packages/accounts-base/accounts_server.js:380)
    at Meteor.methods.login (packages/accounts-base/accounts_server.js:434)
    at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1594)
    at packages/ddp/livedata_server.js:648

推荐答案

内存问题源于使用DigitalOcean的$ 5 Droplet.为了解决该问题,我在服务器上添加了交换,如下所述.

The memory issue stems from using DigitalOcean's $5 Droplet. To solve the problem, I added swap to the server, as explained in detail below.

使用dd命令创建并启用交换文件:

Create and enable the swap file using the dd command :

sudo dd if=/dev/zero of=/swapfile bs=1024 count=256k

"of =/swapfile"指定文件的名称.在这种情况下,名称为swapfile.

"of=/swapfile" designates the file’s name. In this case the name is swapfile.

接下来,通过创建linux交换区域来准备交换文件:

Next prepare the swap file by creating a linux swap area:

sudo mkswap /swapfile

结果显示:

Setting up swapspace version 1, size = 262140 KiB
no label, UUID=103c4545-5fc5-47f3-a8b3-dfbdb64fd7eb

通过激活交换文件来完成:

Finish up by activating the swap file:

sudo swapon /swapfile

当您查看交换摘要时,您将能够看到新的交换文件.

You will then be able to see the new swap file when you view the swap summary.

swapon -s
Filename                Type        Size    Used    Priority
/swapfile                               file        262140  0   -1

此文件将在虚拟专用服务器上持续存在,直到计算机重新启动为止.您可以通过将交换添加到fstab文件中来确保该交换是永久的.

This file will last on the virtual private server until the machine reboots. You can ensure that the swap is permanent by adding it to the fstab file.

打开文件:

sudo nano /etc/fstab

粘贴以下行:

 /swapfile       none    swap    sw      0       0 

文件的Swappiness应该设置为10.跳过此步骤可能会导致性能下降,而将其设置为10则会使swap充当紧急缓冲区,从而防止内存不足崩溃.

Swappiness in the file should be set to 10. Skipping this step may cause both poor performance, whereas setting it to 10 will cause swap to act as an emergency buffer, preventing out-of-memory crashes.

您可以使用以下命令执行此操作:

You can do this with the following commands:

echo 10 | sudo tee /proc/sys/vm/swappiness
echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf
To prevent the file from being world-readable, you should set up the correct permissions on the swap file:

sudo chown root:root /swapfile 
sudo chmod 0600 /swapfile

这篇关于Digital Ocean上的流星(Mup)内存问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆