How can meteor run on multiple ports.For example if the meteor run on 3000 i need another meteor app run on the same terminal.Please help me.
4 Answers
You can use the --port
parameter:
`meteor run --port 3030`
To learn more about command line parameters, run meteor help <command>
, e.g. meteor help run
.
I see you've tagged your question meteor-up. If you're actually using mup
, check out the env
parameter in the config file.

- 143,271
- 52
- 317
- 404
-
related question: Is it possible to run same app(two instances) in different ports? I tried to run same app in 3000 and 5000 ports and second one is showing errors related to mongodb – Sasikanth Oct 30 '14 at 07:20
-
It's definitely possible; I have several apps that run on my website. Your app instances probably conflict while use the same database though - hence the Mongo errors. – Dan Dascalescu Oct 30 '14 at 07:22
-
getting this error "Exception in callback of async function: Error: connection closed" @Dan Dascalescu – vamsi kr Oct 30 '14 at 07:26
-
How can we run the several apps on the same server please give me example.we are running single app at time.please help me @dan-dascalescu – vamsi kr Oct 30 '14 at 07:30
-
1That is a [different question](http://stackoverflow.com/questions/18151621/what-are-the-major-steps-required-to-create-multiple-instances-of-a-meteor-js-ap); see [this](http://code.krister.ee/hosting-multiple-instances-of-meteor-on-digitalocean/) and [this](https://groups.google.com/forum/#!topic/meteor-talk/lNUXckZpAO4). – Dan Dascalescu Oct 30 '14 at 07:35
-
Is there a way to do this with the settings.json file? – Michael Cole Aug 29 '15 at 16:52
I think the OP was referring to the exceptions caused because of locks on the mongo db. I am only on this platform for last week - and am learning as quick as I can. But when I tried running my application from the same project directory as two different users on two different ports - I got an exception about MongoDB :
Error: EBUSY, unlink 'D:\test\.meteor\local\db\mongod.lock'
The root of the issue isn't running on different ports - it is the shared files between the two instances - Specifically the database.
I don't think any of your answers actually helped him out. And .. neither can I yet.
I see two options -
First -
I am going to experiment with links to see if I can get the two users to use a different folder for the .meteor\local tree ... so both of us can work on the same code at the same time - but not impact each other when testing.
But I doubt if that is what the OP was referring to either (different users same app)...
Second - is trying to identify if I can inject into the run-mongo.js some concept of the URL / port number I am running on, so the mongodb.lock (and db of course) ... are named something like mongodb.lock-3000
I don't like the 2nd option because then I am on my own version of standard scripts.
B

- 11
- 1
-
1This doesn't answer the question, it's more appropriate as a few comments. – Sterling Archer Dec 03 '15 at 17:47
No, it is mainly used the default port of 3000 or any state at the start, and the following (+1) to Mongo.
That is, the following application can be run through a 2-port, already in 3002, hence the previous 2-port as before - it is 2998.
Check can be very simple (Mac, Linux):
ps|grep meteor

- 316
- 4
- 9
-
Lord, that distribute cons, please unsubscribe in the comments, what's wrong? – borodatych Aug 12 '16 at 11:42
Just use different db instance (set METEOR_LOCAL_DIR)
"devOne": "export METEOR_LOCAL_DIR=.meteor/local/db2 && meteor --settings settings1.json --port 3000",
"devTwo": "meteor --settings settings2.json --port 4000"

- 657
- 6
- 16