From the course: Advanced Node.js: Scaling Applications
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Working with clusters with PM2 - Node.js Tutorial
From the course: Advanced Node.js: Scaling Applications
Working with clusters with PM2
- [Instructor] In the last few examples, we built our own simple cluster. In the real world, there are already many tools that we can use to help us manage clusters in production. The tool I want to look at is called PM2. PM2 is a no JS process manager. It will allow you to manage zero down time clusters in production. Let's install PM2. So, I'm in the terminal, in the exercise files, under chapter one. Chapter one, lesson six and I'm gonna go ahead and run a sudo npm install dash g PM2. And while PM2 in installing, let's go ahead and take a look at our files within the start folder. So we have a app dot js and this contains a web server that will serve advice. So this is a variation on the advice server that we used in the third lesson in this chapter. The difference with this advice server is on line 17 we're just also logging the process ID, along with the advice, and we're no longer serving the port. And then on…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.