In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Systemd:Systemd is the latest initialization system (init) in Linux system.
Summary explanation reference: https://www.ibm.com/developerworks/cn/linux/1407_liuming_init3/index.html
POST-- > Boot Sequence-- > Bootloader-- > kernel + initramfs (initrd)-- > rootfs-- > / sbin/init
Init:
CentOS 5: SysV init
CentOS 6: Upstart
CentOS 7: Systemd
To reduce system startup time, the goal of systemd is to:
Start as few processes as possible
Start as many processes in parallel as possible
What's new in Systemd:
Realize service parallel startup when the system is booted
Activate the process on demand
System status snapshot
Define service control logic based on dependency relationship
Systemd has its own log service journald, which is originally designed to overcome the shortcomings of existing syslog services.
Core concept: unit
The concept of unit
There are many things that need to be done to initialize the system. Background services need to be started, such as SSHD services, and configuration work needs to be done, such as mounting the file system. Each step in this process is abstracted by systemd as a configuration unit.
That is, unit. You can think of a service as a configuration unit; a mount point as a configuration unit; a swap partition configuration as a configuration unit; and so on. Systemd classifies the configuration units into the following different types.
Each configuration unit has a corresponding configuration file, and the system administrator's task is to write and maintain these different configuration files, such as a MySQL service corresponding to a mysql.service file. The syntax of this configuration file is so simple that users no longer need to write and maintain complex system scripts.
Configuration file for identification and configuration; the file mainly contains system services, monitoring socket, saved system snapshots and other init-related information
When systemd runs as a system instance (--system), the order in which the units are loaded (higher priority than the previous directory):
System unit catalog description
/ etc/systemd/system locally configured system unit
/ run/systemd/system system units configured at run time
System unit installed by / usr/lib/systemd/system software package
Type of Unit:
Service unit: file extension .service, used to define system services
Target unit: the file extension is .target, which is used to simulate the implementation of the run level
Device unit: .device, which defines the device recognized by the kernel
Mount unit: .mount, which defines the file system mount point
Socket unit: .socket, which is used to identify socket files for interprocess communication
Snapshot unit: .snapshot to manage system snapshots
Swap unit: .swap, used to identify swap devices
Automount unit: .automount, the automatic mount point of the file system
Path unit: .path, which defines a file or directory in the file system
Manage system services:
CentOS 7: service unit
Note: compatible with earlier service scripts
Command: systemctl COMMAND name.service
Start: service name start = = > systemctl start name.service
Stop: service name stop = > systemctl stop name.service
Restart: service name restart = > systemctl restart name.service
Status: service name status = = > systemctl status name.service
Conditional restart: service name condrestart = > systemctl try-restart name.service
Reload or restart the service: systemctl reload-or-restart name.service
Reload or conditional restart service: systemctl reload-or-try-restart name.service
Disable is set to boot: systemctl mask name.service
Disable is set to self-boot: systemctl unmask name.service
Check the status of whether a service is currently active or not: systemctl is-active name.service
View all services that have been activated:
Systemctl list-units-type service
View all services:
Systemctl list-units-type service-all
Correspondence of the chkconfig command:
Set a service to boot automatically: chkconfig name on = > systemctl enable name.service
Prohibit: chkconfig name off = = > systemctl disable name.service
Check the post status of all services:
Chkconfig-- list = = > systemctl list-unit-files-- type service
Check whether the service is self-booting: systemctl is-enabled name.service
Other commands:
View the dependencies of the service: systemctl list-dependencies name.service
Target and run level
Systemd replaces the concept of runlevel with target, providing more flexibility
Target units:
Unit configuration file: .target
Run level:
0 = = > runlevel0.target, poweroff.target
1 = = > runlevel1.target, rescue.target
2 = = > runlevel2.target, multi-user.target
3 = = > runlevel3.target, multi-user.target
4 = = > runlevel4.target, multi-user.target
5 = = > runlevel5.target, graphical.target
6 = > runlevel6.target, reboot.target
(it makes no difference for systemd to run level 2, 3, 4, 4)
The: runlevel command is not recommended for Centos7
Level switching:
Init N = > systemctl isolate name.target (.target cannot be omitted)
View level:
Runlevel = > systemctl list-units-- type target
Get the default run level:
/ etc/inittab = = > systemctl get-default
Modify the default level:
/ etc/inittab = = > systemctl set-default name.target
Switch to emergency rescue mode:
Systemctl rescue
Switch to emergency mode:
Systemctl emergency
(emergency: driver does not load, system does not initialize, service does not start)
Other common commands:
Shutdown: systemctl halt, systemctl poweroff
Restart: systemctl reboot
Pending: systemctl suspend
Snapshots: systemctl hibernate
Snapshot and suspend: systemctl hybrid-sleep
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.