Help & DocumentationAuto ScalingBest PracticesAuto-enable Services on Startup

Auto-enable Services on Startup

Last updated: 2020-02-25 15:27:09

PDF

Set the Service to Be Activated upon Boot

Use cases

When using auto scaling expansion, we hope there will be no human intervention in the whole process. Therefore, it is strong to set up Start up post-service automatic Launch for automatic expansion's machine, for example:

Httpd Service
Mysqld Service
Php-fpm Service
Tomcat Service

  • Other services, etc.

The setting can be done within one minute-Modify the file / ETC _ rc.local!

Setting Method (taking centos as an example):

Step 1: open a rc.local file

Input

vim /etc/rc.d/rc.local

Do not change the existing contents and add contents at the end of the file.

Operation TIPS (experienced users may skip this):

Input "I" to enter the insert mode of vim, and then you can press the direction key "to reach the end of the file and enter the content."

Step 2: write down the service for Launch

This example is the website Start up hopes to build from Launch httpd, mysqld, php-fpm services. So I added these words after rc.local:

service httpd start
service mysqld start
service php-fpm start

Save and exit. After this server Start up, the website can be Access automatically. Note that different websites require different services, this step can be set up according to your needs.

Operation TIPS (experienced users may skip this):

After entering the content, press the Esc key, Hold down the Shift key and press "Z" twice To exit,

Step 3: Verification (optional)

Reboot the server (Input reboot, or reboot the server in the console). After the server is rebooted, refresh the webpage on the website first without entering the server to see if there is a response.

Step 4: Create an image based on this machine and use this image when creating scaling configurations

This step is simple. Refer to the guides below if you have problems with the operation:

Create Custom Image

Create Scaling Configurations