Linux boot some knowledge points

runlevel

   The Init process is the first user process after the system starts, so its pid (process number) is always 1. The first thing the init process does is to read the initdefault id value in the inittab file in the /etc/ directory, which is called the run-level. It determines what level the system will run at after startup. Runlevels determine most of the behavior and purpose of system startup. This level goes from 0 to 6 and has different functions. The different runlevels are defined as follows:
  # 0 - shutdown (never set initdefault to 0 or the system will never start)
  # 1 - single-user mode
  # 2 - multi-user, no NFS
  # 3 - full multi-user mode (standard run level)
  # 4 - reserved by the system
  # 5 - X11 (x window - is the graphical interface)
  # 6 - restart (do not set initdefault to 6, otherwise it will keep restarting)
   where 3 and 5 are more commonly used runlevel of

Relationship between /etc/rc.d/ and /etc/rc.d/init.d

The init.d directory stores command files for services, such as zookeeper

rc0.d\rc1.d\rc2.d\rc3.d\rc4.d\rc5.d\rc6.d stores the connection file for each run level that needs to be started and shut down to stop the service. This file is connected to / The corresponding service file in the etc/rc.d/init.d directory

Take one of the zookeepers for example

There is a line in the /etc/rc.d/init.d/zookeeper file

#chkconfig:2345 20 90

2345: The level that the host runs, indicating that the host will start zookeeper when it runs at levels 2, 3, 4, and 5, and stop zookeeper at levels 0, 1, and 6

20: The priority of booting is higher than 50 of solr

90: Sequence of shutdown stops

In general settings, start first, then stop. Be careful not to set the startup value too small, otherwise some system core services may not be started, causing your application to fail to start.

use

chkconfig --add zookeeper

The S20zookeeper connection file will be generated in rc2.d\rc3.d\rc4.d\rc5.d, and the K90zookeeper connection file will be generated in rc0.d\rc1.d\rc6.d

S: stands for start

K: stands for stop

20: Represents the order of startup, the smaller the value, the first to start

zookeeper: service name, which is the file name in /etc/rc.d/init.d

When the boot is started, the start startup parameter will be added after the command when S20zookeeper is executed.

When the shutdown stops, the stop parameter will be added after the command when executing K90zookeeper

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325066642&siteId=291194637