Welcome to the Market Trade Processor Consumer subproject!
This subproject is a part of Market Trade Processor project.
Consumer is built using Node.js v0.12.2.
Perhaps Golang could show a better performance but I'd like to check Node.js cluster.
Note. The instruction below is suitable for CentOS only. Please check pm2 documentation for installation to other OSes.
Note 2. Make sure that your servers are able to open the necessary number of connections. Please check How to tune Linux server section for details.
Before start of the application please:
- install Node.js >= v0.12.2;
- prepare RabbitMQ certificates
- check "config/config.json";
- in the project dir execute:
sudo npm install pm2 -g
sudo npm install
pm2 start -e logs/err.log -o logs/out.log consumer.js
sudo pm2 startup centos
The most of necessary information you could find in the RabbitMQ documentation. There are some tips below I used on my installation.
rabbitmqctl add_user consumer password4consumer
rabbitmqctl delete_user guest
rabbitmqctl add_vhost /consumer
rabbitmqctl set_permissions -p /consumer consumer "^messages" ".*" ".*"
rabbitmqctl add_user worker password4worker
rabbitmqctl set_permissions -p /consumer worker "^messages" "" ".*"
[
{ssl, [{versions, ['tlsv1.2']}]},
{rabbit, [
{tcp_listeners, []},
{log_levels, [{connection, none}]},
{ssl_listeners, [5671]},
{ssl_options, [{cacertfile,"/usr/local/rabbit/certs/cacert.pem"},
{certfile,"/usr/local/rabbit/server/cert.pem"},
{keyfile,"/usr/local/rabbit/server/key.pem"},
{password, "ServerSuperT0p$3kRe7Password"},
{depth, 2},
{verify,verify_peer},
{fail_if_no_peer_cert,true}]},
{vm_memory_high_watermark, 0.9},
{hipe_compile, true},
{heartbeat, 60}
]}
].