Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse cluster not working properly #6894

Closed
simonegiacco opened this issue Sep 3, 2020 · 4 comments
Closed

Parse cluster not working properly #6894

simonegiacco opened this issue Sep 3, 2020 · 4 comments
Labels
type:question Support or code-level question

Comments

@simonegiacco
Copy link

I'm trying to start parse server in a cluster of 3 instances (4 cores, so N - 1)

Setting the "cluster" parameter when creating new ParseServer() is not working
I tried with an app using parse-server@2.8.4 and with a clean installation of parse-server-example using latest parse-server without success;

var api = new ParseServer({
  databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || 'myAppId',
  cluster: 3, //. <==== HERE! also tried cluster:true
  masterKey: process.env.MASTER_KEY || '',
  serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse'  
});

Using this setting, ps -aux | grep node shows one node instance

I've tried with parse-server CLI and the clustering is working properly:

parse-server --appId X --masterKey X --databaseURI mongodb://localhost:27017/dev --publicServerURL http://localhost:1337/parse  --cluster=3

Using this command, ps -aux | grep node shows three node instances.

Is this a bug or am I doing something wrong?

@mtrezza
Copy link
Member

mtrezza commented Sep 3, 2020

Setting the "cluster" parameter when creating new ParseServer() is not working
I've tried with parse-server CLI and the clustering is working properly

This is expected and it may be more obvious when you think about it this way:

  • Starting Parse Server via the CLI parse-server --cluster=true ... does not immediately create and start a Node.js Parse Server instance. It is merely telling the Parse CLI that you want to launch a Parse Server instance. The CLI acts as an intermediary and looks at the cluster option to launch multiple Parse Server instances.

  • Starting Parse Server via Node.js const api = new ParseServer(...); express().use('/parse', api); means you are directly creating and launching a Parse Server instance. There is no intermediary who looks at the cluster option. So it would be up to you to launch multiple Parse Server instances using the Node.js cluster package which provides an example.

@dplewis Just to make sure, did I get this right?

@TomWFox
Copy link
Contributor

TomWFox commented Sep 12, 2020

I'm closing this as there has been no further response, let us know if you still have any questions/issues.

@TomWFox TomWFox closed this as completed Sep 12, 2020
@mtrezza mtrezza added type:question Support or code-level question and removed 🔧 troubleshooting labels Jul 11, 2021
@rdhelms
Copy link

rdhelms commented Jul 23, 2021

@mtrezza @TomWFox Just to clarify - the conclusion here was that using the cluster option has no effect when using new ParseServer(...)?

Could that be updated somewhere in the docs? The ParseServerOptions docs mention the cluster option in a way that certainly implies that it does something when used with new ParseServer(), but attempting to understand its impact is what led me here.

@mtrezza
Copy link
Member

mtrezza commented Jul 23, 2021

Such a note would be welcome.

You are correct. The cluster option is in the Parse Server Options docs because usually (probably all other) options can be set either via the Parse Server CLI or via the Parse Server object. cluster is an exception and can only be set via the CLI, as it needs the CLI intermediary logic to spin up multiple Parse Server instances.

Please feel free to add a comment to the options definitions. We do not have a way in the docs to specify "CLI only" options, so a comment there should be fine. The change would be made in this parse-server repo in the options definitions. Remember to run npm run definitions and npm run docs afterwards. You can reference this issue in your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Support or code-level question
Projects
None yet
Development

No branches or pull requests

4 participants