简体   繁体   English

多宿主服务器上的流星?

[英]Meteor on Multihomed Server?

Does anybody have any experience running Meteor on multihomed servers? 是否有人在多宿主服务器上运行Meteor有任何经验? We're bring an app into production, and have some servers that have two network cards each. 我们将一个应用程序投入生产,并拥有一些服务器,每个服务器都有两个网卡。 The one interface on eth0 connects to our internal network with our Mongo cluster, and the other interface eth1 connects to our DMZ. eth0上的一个接口通过Mongo集群连接到我们的内部网络,而另一个接口eth1连接到我们的DMZ。 We're well past development, and are in post-bundle workflow. 我们已经过了很长时间的开发,并且处于捆绑后的工作流程中。 So, it's a question of running the following command only on eth1: 因此,这是仅在eth1上运行以下命令的问题:

MONGO_URL='mongodb://mongodb:27017/?replicaSet=meteor' PORT='80' ROOT_URL=' http://app.domain.org ' node main.js MONGO_URL ='mongodb:// mongodb:27017 /?replicaSet = meteor'PORT = '80'ROOT_URL =' http ://app.domain.org'节点main.js

I don't know enough about node to know exactly how to specify a single interface. 我对节点了解不足,无法确切知道如何指定单个接口。 Is this specified with an environment variable? 是否使用环境变量指定? In our /etc/network/interfaces file? 在我们的/ etc / network / interfaces文件中? iptables? iptables的? Something else? 还有吗

I'm finding resources like the following on the web, but I'm not sure if I'm on the right track with them. 我可以在网上找到类似以下资源的资源,但是不确定是否能正确地使用它们。 Does getting a node.js server running on a specific interface require this kind of fussing? 使node.js服务器在特定接口上运行是否需要这种麻烦? Is there something easier? 有更简单的东西吗?

https://gist.github.com/logicalparadox/2142595 https://gist.github.com/logicalparadox/2142595
how to set node.js as a service on a private server?[can't access the node application] 如何将node.js设置为私有服务器上的服务?[无法访问节点应用程序]

Any help would be much appreciated! 任何帮助将非常感激! Thanks! 谢谢!
Abigail 阿比盖尔

Meteor will listen on 0.0.0.0 (all interfaces) unless your specify the environment variable BIND_IP . 除非您指定环境变量BIND_IP否则流星将监听0.0.0.0 (所有接口)。

Explicitly- the value of BIND_IP is passed as the hostname parameter to http://nodejs.org/api/http.html#http_server_listen_port_hostname_backlog_callback 明确地BIND_IP的值作为hostname参数传递给http://nodejs.org/api/http.html#http_server_listen_port_hostname_backlog_callback

Source: https://github.com/meteor/meteor/blob/master/packages/webapp/webapp_server.js#L541 来源: https : //github.com/meteor/meteor/blob/master/packages/webapp/webapp_server.js#L541

Okay, so got things working. 好的,这样就可以了。 Second ethernet card wasn't configured. 未配置第二个以太网卡。

sudo nano /etc/network/interfaces    
  auto eth0
  iface eth0 inet static
      address aaa.bbb.ccc.ddd
      gateway aaa.bbb.ccc.eee

  auto eth1
  iface eth1 inet static
      address aaa.bbb.ccc.fff
      gateway aaa.bbb.ccc.ggg

sudo ifconfig eth1 up
sudo /etc/init.d/networking restart

Then had to make sure firewalls were working... 然后必须确保防火墙正常工作...

sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT    
sudo iptables -L -n -v

Then confirmed the site was running on the correct IP address with a big of curl... 然后确认该网站运行在正确的IP地址上,并且卷曲很大。

curl -XGET http://aaa.bbb.ccc.fff/main.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM