解析服务器安装中的MongoError写入EPIPE" [英] MongoError write EPIPE” in Parse-Server Installation

查看:101
本文介绍了解析服务器安装中的MongoError写入EPIPE"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在帮助一个朋友将Parse应用程序迁移到专用服务器而不是托管服务提供商,而我一直无法解决我认为服务器上的Parse Server实例中发生的错误.

I'm helping a friend with migrating a Parse app to a dedicated server as opposed to a hosting provider, and I've gotten stuck trying to resolve an error that I THINK is happening in the Parse Server instance on the server.

首先,这是PM2日志中的错误堆栈,每次对服务器进行GET或POST都会抛出该错误堆栈:

Firstly, here is the error stack from the PM2 logs, it gets thrown every time a GET or POST is made to the server:

parse-wrapper-0 (err):     at null.<anonymous> (/usr/lib/node_modules   /parse-server/node_modules/mongodb-core/lib/connection/pool.js:119:12)
parse-wrapper-0 (err):     at g (events.js:273:16)
parse-wrapper-0 (err):     at emitTwo (events.js:100:13)
parse-wrapper-0 (err):     at emit (events.js:185:7)
parse-wrapper-0 (err):     at Socket.<anonymous> (/usr/lib/node_modules/parse-server/node_modules/mongodb-core/lib/connection/connection.js:144:49)
parse-wrapper-0 (err):     at Socket.g (events.js:273:16)
parse-wrapper-0 (err):     at emitOne (events.js:90:13)
parse-wrapper-0 (err): error: Uncaught internal server error. { [MongoError: server localhost:27017 received an error {"name":"MongoError","message":"write EPIPE"}]
parse-wrapper-0 (err):   name: 'MongoError',
parse-wrapper-0 (err):   message: 'server localhost:27017 received an error {"name":"MongoError","message":"write EPIPE"}' } MongoError: server localhost:27017 received an error {"name":"MongoError","message":"write EPIPE"}
parse-wrapper-0 (err):     at null.<anonymous> (/usr/lib/node_modules/parse-server/node_modules/mongodb-core/lib/topologies/server.js:308:40)
parse-wrapper-0 (err):     at emitTwo (events.js:100:13)
parse-wrapper-0 (err):     at emit (events.js:185:7)
parse-wrapper-0 (err):     at null.<anonymous> (/usr/lib/node_modules/parse-server/node_modules/mongodb-core/lib/connection/pool.js:119:12)
parse-wrapper-0 (err):     at g (events.js:273:16)
parse-wrapper-0 (err):     at emitTwo (events.js:100:13)
parse-wrapper-0 (err):     at emit (events.js:185:7)
parse-wrapper-0 (err):     at Socket.<anonymous> (/usr/lib/node_modules/parse-server/node_modules/mongodb-core/lib/connection/connection.js:144:49)
parse-wrapper-0 (err):     at Socket.g (events.js:273:16)
parse-wrapper-0 (err):     at emitOne (events.js:90:13)

由于我不太确定问题的性质(我查了写EPIPE错误是什么,但不确定为什么它在GET上发生或为什么每次都关闭),我只需提供我能想到的有关服务器的所有信息.

Since I'm not really sure as to the nature of the problem (I looked up what the write EPIPE error is, but not sure as to why it's happening on GETs or why it's closing every single time), I'm just gonna give every piece of information about the server I can think of that is relevant to this.

这是当前的相对用户结构:

This is the relative user structure right now:

root -defuser:运行mongo实例以及nginx -parse:通过PM2运行解析

root -defuser: running the mongo instance as well as nginx -parse: running parse via PM2

这是PM2正在使用的ecosystem.json文件:

Here is the ecosystem.json file PM2 is using:

{
  "apps":[{
    "name" : "parse-wrapper",
    "script" : "/usr/bin/parse-server",
    "watch" : true,
    "merge_logs" : true,
    "cwd" : "/home/parse",
    "env" : {
      "PARSE_SERVER_CLOUD_CODE_MAIN": "cloud/main.js",
      "PARSE_SERVER_DATABASEURI": "mongodb://parse:SUPERPASSWORDHERE@domain.here:27017/beerdb?ssl=true",
      "PARSE_SERVER_APPLICATION_ID": "super secret Parse key",
      "PARSE_SERVER_MASTER_KEY" : " master key"
   }
  }]
}

这是mongo.conf文件:

Here's the mongo.conf file:

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
#  engine:
#  mmapv1:
#  wiredTiger:

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# network interfaces
net:
  port: 27017
  bindIp: 0.0.0.0
  ssl:
    mode: requireSSL
    PEMKeyFile: /etc/ssl/mongo.pem


#processManagement:

security:
  authorization: enabled

#operationProfiling:

#replication:

#sharding:

setParameter:
  failIndexKeyTooLong: false

## Enterprise-Only Options:

#auditLog:

#snmp:

我认为nginx与此无关,但这是配置,无论如何:

I don't think nginx has anything to do with this, but here's the config regardless:

# HTTP - redirect all requests to HTTPS
server {
    listen 80;
    listen [::]:80 default_server ipv6only=on;
    return 301 https://$host$request_uri;
}

# HTTPS - serve HTML from /usr/share/nginx/html, proxy requests to /parse/
# through to Parse Server
server {
    listen 443;
    server_name domain.here;

    root /usr/share/nginx/html;
    index index.html index.htm;

    ssl on;
    # Use certificate and key provided by Let's Encrypt:
    ssl_certificate /etc/letsencrypt/live/domain.here/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/domain.here/privkey.pem;
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';

    # Pass requests for /parse/ to Parse Server instance at localhost:1337
    location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-NginX-Proxy true;
            proxy_pass http://localhost:1337/parse/;
            proxy_ssl_session_reuse off;
            proxy_set_header Host $http_host;
            proxy_redirect off;
    }


}

我在这里基本上没有主意,尽管我不仅仅只是设置Apache以外的专家,所以这可能是一个愚蠢的疏忽,也可能是我的头上的烦恼.因此,如果能提供一些简单的帮助,我们将不胜感激.

I'm basically out of ideas here, although I'm not exactly an expert at much more than just setting up Apache, so it might be a stupid oversight or over my head. So, any assistance is appreciated and sorry if it is something simple.

推荐答案

我在部署中遇到了同样的问题.事实证明,Parse Dashboard与MongoDB建立了大量连接(在我的情况下为> 1k连接),因此我们必须增加mongo.conf中的最大连接限制和文件描述符限制(取决于您的操作系统).

I met the same issue with my deployment. It turned out that Parse Dashboard made a lot of connections to MongoDB (> 1k connections in my case) so we have to increase the maximum connection limit in mongo.conf and file descriptor limit (depends on your OS).

例如,在Linux中:

For example, in Linux:

  • 编辑mongo.conf文件并添加maxConns = 10000
  • 编辑/etc/sysctl.conf文件并添加fs.file-max = 10000
  • 运行ulimit -n 50000
  • Edit the mongo.conf file and add maxConns = 10000
  • Edit the /etc/sysctl.conf file and add fs.file-max = 10000
  • Running ulimit -n 50000

这篇关于解析服务器安装中的MongoError写入EPIPE"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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