RAID, process, log, and Systemctl control

Source: Internet
Author: User
Tags pkill

1 RAID

2 Process Management

3rd Log Management

4 Systemctl Control



1. RAID

RAID array overview (redundant Arrays of inexpensive Disks) inexpensive redundant disk array

– Consolidate multiple small/low-speed disks into one large disk with hardware/software technology

– Value of the array: increased I/O efficiency, hardware-level data redundancy

– Different RAID level features and features vary


1.1 RAID0

Stripe mode

Use a minimum of two disks;

There are different disks scattered across the same document;

Parallel writes to improve efficiency;

1.2 RAID1

Mirroring mode

Use a minimum of two disks;

A document is copied into multiple copies, each written to a different disk;

Multiple copies improve reliability, no improvement in efficiency;

1.3 RAID01/RAID10

Consolidate the advantages of RAID0,RAID1; Parallel access improves efficiency, mirroring writes improve reliability

1.4 RAID5

Cost-effective mode with at least 3 disks

A compromise equivalent to RAID0 and RAID1

At least one disk capacity is required to hold the checksum data

1.5 RAID6

Cost-effective, reliable mode, requiring a minimum of 4 disks

Equivalent to RAID5 array with 2 independent calibration schemes

Requires at least two disks of capacity to hold the checksum data

1.6 RAID levels feature comparison


2. Process Management

Program: Static code that does not execute, consumes disk space

Process: Executing code in memory, consuming memory, CPU

PID: numbering, identifying processes

Parent process, child process


2.1 Viewing the process tree

Pstree-processes Tree

Format:pstree [options] [PID or user name]

Common Command Options

-A: Displays the full command line

-P: List the corresponding PID number

SYSTEMD: The first process that the kernel runs directly, the PID is always 1

[Email protected] ~]# Pstree

[Email protected] ~]# Pstree Lisi

Bash───vim

[Email protected] ~]# pstree-p Lisi

Bash (30712) ───vim (30751)

[Email protected] ~]# Pstree-ap Lisi


2.2 Viewing process Snapshots

PS (processes snapshot)

PS aux The operation displays the current end of all processes (a), the current user processes under all terminals (x), output in user format (u) #列出正在运行的所有进程

ps-elf The operation displays all processes (-e) in the system, with long format output (-L), information, including the most complete process information (-f) #列出正在运行的所有进程

PS aux | grep ssh


2.3 Process Dynamic Ranking

Top Interactive Tools

Format: Top [-D refresh seconds]

Load average:0.03, 0.04, 0.05

Sort by uppercase P-CPU

Sort by uppercase M memory

T: Sort by time in descending order of process consumption

K: kills the specified process

Q: Exit Top


2.4 Retrieval Process

Pgrep-process Grep

Purpose:pgrep [options] ... Query criteria

Common Command Options

-L: Output process name, not just PID

-U: Retrieves the process for the specified user

-T: Retrieving the process for the specified terminal

-X: Exact Match of the full process name

[Email protected] ~]# pgrep log

[Email protected] ~]# pgrep-l log

[Email protected] ~]# pgrep-u Lisi

[Email protected] ~]# Pgrep-lu Lisi

[Email protected] ~]# Pstree-ap Lisi

[email protected] ~]# who #查看正在登陆的用户信息

[Email protected] ~]# Pgrep-lu Lisi

[Email protected] ~]# Pgrep-lu lisi-t PTS/2


2.5 Scheduling of processes (front and rear)

Put into the background boot

– Add the "&" symbol at the end of the command line and the running state into the background

–ctrl + z key combination, paused state in background

[[email protected] ~]# sleep & #将前台的进程, running into the background

[email protected] ~]# jobs #查看后台进程

[[email protected] ~]# jobs-l #查看后台进程, plus PID

[[email protected] ~]# sleep 700

^z #按Ctrl +z can pause into the background

[2]+ has stopped sleep 700

[Email protected] ~]# jobs-l

[[email protected] ~]# BG 2 #将后台进程编号为2的, continue running in the background

[2]+ Sleep &

[Email protected] ~]# jobs-l

[[email protected] ~]# FG 1 #将后台的进程恢复到前台

Sleep 800

^c #按Ctrl +c End Process

[[email protected] ~]# FG 2

Sleep 700

^c #按Ctrl +c End Process


2.6 Kill Process

Kill [-9] PID ...

Killall [-9] Process name ...

Pkill Find Criteria

Pkill-9-U Lisi #强制踢出用户

[Email protected] ~]# sleep &

[Email protected] ~]# sleep &

[Email protected] ~]# sleep &

[Email protected] ~]# sleep &

[Email protected] ~]# jobs-l

[[email protected] ~]# kill 1928

[Email protected] ~]# jobs-l

[[email protected] ~]# Killall sleep

[Email protected] ~]# jobs-l


3. Log Management

3.1 Log Overview

"Journal" of Systems and programs

– Record the various events that occur in the system and program operations

– Understand and troubleshoot by viewing logs

– the "Basis for information security control"


3.2 Common Log files

/var/log/messages record kernel messages, public messages for various services

/VAR/LOG/DMESG recording the various messages of the system startup process

/var/log/cron record messages related to cron scheduled tasks

/var/log/maillog record messages related to sending and receiving mail

/var/log/secure record security messages related to access restrictions

TAILF real-time tracking of new Day value messages


3.3 User logs

Logged/managed by the login program

Log messages in binary format

Log logged-in user's time, source, command to execute, and other information

/var/log/lastlog: Logging The most recent user logon event

/var/log/wtmp: Logging Successful user logon/Logoff events

/var/log/btmp: Logging of failed user logon events

/VAR/RUN/UTMP: Records information about each user who is currently logged on


3.4 Log Analysis

Users, who, W commands

View logged-in user information with varying degrees of detail

Last, Lastb command

View user information for recent login success/failure

[[email protected] ~]# users

[email protected] ~]# who

[Email protected] ~]# W

[Email protected] ~]# last-2 #最近两次登录成功

[Email protected] ~]# lastb-2 #最近两次登录失败


3.5 Priority of log messages

Event urgency defined by the Linux kernel

– Divided into 0~7 a total of 8 priority levels

– The smaller the value, the more urgent/important the corresponding event

0 Emerg (Emergency) causes the host system to become unusable

1 alert (warning) must take immediate action to solve the problem

2 Crit (severe) more serious situation

3 Err (Error) Run error

4 WARNING (Reminder) events that may affect system functionality

5 NOTICE (note) does not affect the system but is worth noting

6 info (info) General Information

7 Debug (Debug) program or system debug information, etc.

3.6 Using the Journalctl tool

? Extracting logs collected by the Systemd-journal service

? Common usage

–journalctl | grep keyword

–journalctl-u service name [-p priority]

–journalctl-n Number of message bars

–journalctl--since= "Yyyy-mm-dd HH:MM:SS"--

Until= "Yyyy-mm-dd HH:MM:SS"

[Email protected] ~]# yum-y install httpd

[Email protected] ~]# systemctl restart httpd

[Email protected] ~]# Journalctl-u httpd-p 6


4. Systemctl Control

4.1 Systemd Introduction

A more efficient system & Service Manager

Start-up service in parallel, accurate dependencies between system services

Service Catalog:/lib/systemd/system/

Control Service Status

Systemctl Start|stop|restart Service Name ...

To view the health status of a service

Systemctl status|is-active Service Name ...

[Email protected] ~]# Systemctl enable httpd #设置随机自起

[Email protected] ~]# systemctl is-enabled httpd #查看是否随机自起

[Email protected] ~]# systemctl disable httpd #设置随机不自起

[Email protected] ~]# Systemctl is-enabled httpd

Graphical.target Graphics mode

Multi-user.target text mode

Current Toggle Graphics Mode

[Email protected] ~]# Systemctl isolate Graphical.target

Each boot is entered in the mode, the default mode of modification

[Email protected] ~]# Systemctl get-default #查看默认级别

[Email protected] ~]# systemctl set-default graphical.target #设置默认级别

[Email protected] ~]# Systemctl Get-default

[email protected] ~]# reboot

SYSTEMCLI-T Service #列出活动的系统服务

SYSTEMCLI-T Service--all #列出所有系统服务



RAID, process, log, and Systemctl control

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.