How to install multiple node servers
This document explains how to install a second node.js server (for scalability purposes) on an existing installation. The additional server shares the same MongoDB repository.
This procedure describes a Windows installation, but the information can be used for any operating system on which the X3 web server is usable.
Example
- You have a running Syracuse environment on X3ServerA with a MongoDB and an Elasticsearch installed and set.
- You want to install a secondary Syracuse server on X3ServerB.
- On Server X3ServerB, the Syracuse prerequisites are met (except for the MongoDB and the Elasticsearch installation).
Operation on X3ServerA
- Open a cmd window.
- Go to the Syracuse installation directory, and type the following commands:
cd syracuse
cd certs_tools
certgen.bat
The last command requires you to enter data and answer some questions:
- Select option (1): Create new certificate and private key.
- Enter the server name (in our case X3ServerB).
- Enter the server name for tcp connection (in our case X3ServerB).
- Enter the days of validity (5000 for example).
- Enter the passphrase for the new private key.
- Reenter the passphrase for the new private key.
- Enter the passphrase for the private key of the CA certificate (you need to know this passphrase).
- Enter the port of the Syracuse server where you want to transfer the certificate (enter 8124; but you will get an error message because the server is not installed yet).
The following operation will run:
Generate key pair ...
Generate certificate ...
Write private key output/testserver.key ...
Write certificate output/testserver.crt ...
Write public key output/testserver.pem ...
Transfer data to xxxserver:8124 ...
Cannot connect to xxserver: java.net.UnknownHostException: X3ServerB
Press RETURN to continue
Finished
Now you can return to your cmd window and type:
cd output
First, check that x3serverb.crt, x3serverb.key and x3serverb.pem were generated.
Then:
- Copy the x3serverb.pem in the runtime keys subfolder.
- Copy x3serverb.crt, x3serverb.key AND ca.cacrt on X3ServerB (for example in c:\sage\cert\x3serverb).
Operation on X3ServerB
- Start the Syracuse server installation.
- On step 4, choose the new installation option.
- On step 5, enter the installation path.
- On Step 7, specify X3ServerA in the Host Name field and the correct port for MongoDB. An information message will appear : This MongoDB is used and already has a database with the name ‘syracuse’ ! Do you want to continue?
- Click the 'OK' button to validate.
- On Step 8, specify X3ServerA in the Host Name field and the port for Elasticsearch.
- On Step 9, specify the path where you copied the certificate files (for example in c:\sage\cert without x3serverb at the end !).
- IMPORTANT : Clear the Simplified certificates installation for a single server.
- Validate all the steps after and check for errors in the log :
Server name X3SERVERB
Error: Nanny already installed Error: Nanny already installed
at start (C:\Sage\Syracuse\syracuse\bin\node_modules\syracuse-load\lib\balancer.js:512:12)
at __streamline$run (C:\Sage\Syracuse\syracuse\bin\node_modules\streamline\lib\fibers-fast\runtime.js:56:14)
Disregard this error.
- Before executing the next command, ensure that X3ServerB is running the same version as X3ServerA.
If the X3ServerA is on version 6 + hotfix, we need to install the hotfix on X3ServerB.
Open a cmd window. You must be connected with the same account that runs the node.js server.
- Go to the Syracuse installation directory, and type the following commands (enter the passphrase for the new private key you entered when generating the certificate):
cd syracuse
passphrase.cmd “passphrase”
Your are now able to connect to your additional server.