? RAID disk array
? Redundant array of Inexpensive disks
–redundant Arrays of Inexpensive Disks
– Through hardware/software technology, multiple small/low-speed disks are integrated into one
A large disk
– Value of the array: increased I/O efficiency, hardware-level data redundancy
– Different RAID level features and features vary
? RAID 0, stripe mode
– the same document is distributed across different disks
– Parallel writes for increased efficiency
? RAID 1, mirroring mode
– One document is copied into multiple copies and written to different disks
– Multiple copies for increased reliability and no improvement in efficiency
? RAID5, cost-effective mode
– a compromise equivalent to RAID0 and RAID1
– The capacity of at least one disk is required to hold the checksum data
? RAID6, cost-effective/Reliable mode
– Equivalent to an extended RAID5 array with 2 independent calibration schemes
– The capacity of at least two disks is required to hold the checksum data
? RAID 0+1/raid 1+0
– Benefits of consolidating RAID 0, RAID 1
– Parallel access improves efficiency, mirroring writes improve reliability
? Hard raid: Managed array by raid control card
– Motherboard----> Array card----> Disk----> Operating system----> data
##################################################
? Process Management
??? Program: Static code that takes up space on the hard disk
???? Process: Dynamic code that takes up memory, CPU space
? ? ? ? ? ? ? Parent process/child process
? ? ? ? ? ? ? Identification of the process: PID
? ? ? ?
? viewing processes
? 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: Parent process for all processes
[Email protected] ~]# Pstree
[Email protected] ~]# Pstree? Lisi
Bash───vim
[Email protected] ~]# pstree-p? Lisi
Bash (20356) ───vim (20387)
[Email protected] ~]# Pstree-ap? Lisi
bash,20356
? └─vim,20387 1.txt
###############################################
? PS aux operation
– List all processes that are running
? Ps-elf operation
– List all processes that are running
[[Email protected] ~]# PS aux | Wc-l
131
[Email protected] ~]# Ps-elf | Wc-l
131
[[Email protected] ~]# PS aux
[Email protected] ~]# ps-elf
Process Dynamic Ranking
? Top Interactive tools
– Format: Top [-D refresh seconds] [-u user Name]
[Email protected] ~]# top-d 1
???????????
????????????
Enter? Q to exit?
####################################################
Retrieval process
? Pgrep-process Grep
? – Purpose: pgrep [options] ... Query criteria
? Common Command Options
–-l: Output process name, not just PID
–-u: Retrieving the process for a specified user
–-T: Retrieving the process for the specified terminal
–-x: Exact match to Full process name
[Email protected] ~]# Pstree-ap Lisi
bash,22636
? └─vim,22669 1.txt
[Email protected] ~]# Pgrep-lu Lisi
22636 Bash
22669 vim
[Email protected] ~]# pgrep-l Crond
[Email protected] ~]# pgrep-l sshd
[Email protected] ~]# pgrep-l log
########################################################
? Front and back scheduling of processes
?? Background boot
Add the "&" symbol at the end of the command line without occupying the current terminal
? Ctrl + Z key combination
– Suspends the current process (pauses and goes back into the background)
? Jobs command
– View Background Task List
? FG Command
– Restore background tasks to foreground run
? BG Command
– Activate a task that is suspended from the background
#################################################
[Email protected] ~]# sleep &????? #正在运行放入后台
[1] 23304
[[email protected] ~]# jobs
[Email protected] ~]# jobs-l?????? #查看后台进程信息, and output PID
[Email protected] ~]# sleep. #按Ctrl +z pause in the background
^z
[2]+ has stopped??????? Sleep 700
[Email protected] ~]# jobs-l???????
[Email protected] ~]# BG 2?????? #将后台暂停的进程, continue running
[Email protected] ~]# FG 2?????? #将后台的进程, back to the front desk
[[email protected] ~]# FG 1
#########################################################
? Please write the shell script:
? ?
??? The user enters an integer within 10
The computer randomly generates an integer within 10
??? If two integers are the same, the output is "congratulations, winning."
??? If two integers are different, output "Congratulations, thank you for reviewing."
? #!/bin/bash
?? read? -P? ' Please enter an integer within 10: '??? num1
?? num2=$ (expr $RANDOM?% 10)
?? if [? $num 1-eq? $num 2?]; Then
Congratulations on your winning.
? ? ? Else
Congratulations, thank you for your review.
?????? Echo correct number for $num2
?? fi
#####################################################
Kill process
? Different ways to kill a process
? –ctrl+c key combination to interrupt the current command program
? –kill [-9] PID ...?
? –killall [-9] Process name ...
? –pkill Find Criteria
[Email protected]/]# sleep &
[Email protected]/]# sleep &
[Email protected]/]# sleep &
[Email protected]/]# jobs-l
[email protected]/]# kill? 301127
[Email protected]/]# jobs-l
[[email protected]/]# Killall sleep
[Email protected]/]# jobs-l
? To force a user to kick out:
[Email protected]/]# killall-9-u Lisi
####################################################
Features of the log
? "Journal" of Systems and programs
– Record the various events that occur in the system and program operations
– Understand and troubleshoot by viewing logs
– "Basis" for information security control
? Common Log files
Log file
/var/log/messages? Log kernel messages, public messages for various services
/var/log/dmesg?? Recording various messages of the system startup process
/var/log/cron. Log 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
?? Real-time tracking of new log messages
? ? ? ? Tailf
User Login 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
################################################
2} Emerg (Emergency) causes the host system to become unusable
1? Alert (warning) must take immediate action to solve the problem
2? Crit (serious) 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 (information) General Information
7? Debug (Debug) program or system debug information, etc.
###################################################
Using the Journalctl tool
? Extracting logs collected by the Systemd-journal service
– Mainly includes kernel/system logs, service logs
? 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]/]# journalctl?--since= "9:00"? --until= "9:30"?
[Email protected]/]# yum-y install httpd
[Email protected]/]# systemctl restart? httpd
[Email protected]/]# journalctl?-u? httpd??
[Email protected]/]# Journalctl?-n? 10
#########################################################
? Systemctl Control
Systemd
? A more efficient system & Service Manager
? – Start-up service in parallel, precise dependencies between system services
? – Configuration directory:/etc/systemd/system/
? – Service Catalog:/lib/systemd/system/
? – Primary management tool: Systemctl
? Control Service Status
–systemctl? Start|stop|restart? Service name ...
? To view the health status of a service
–systemctl status|is-active Service Name ...
Configuring power-on self-booting
? See if the service is self-starting
–systemctl is-enabled Service Name ...
? Set whether the service is booted
–systemctl enable|disable Service Name ...
[Email protected]/]# systemctl status Crond
[Email protected]/]# systemctl? is-active Crond
[Email protected]/]# systemctl? Restart Crond
[Email protected]/]# systemctl? Stop Crond
[Email protected]/]# systemctl status Crond
[Email protected]/]# systemctl? is-active Crond
[Email protected]/]# Systemctl is-enabled Crond
? Manage RunLevel (run mode)
??? character mode: Multi-user.target
??? Graphics Mode: Graphical.target
? View the default run mode
? [Email protected]/]# systemctl Get-default?
? Set the default run mode
? [Email protected]/]# systemctl set-default graphical.target?
? [Email protected]/]# systemctl Get-default?
? [email protected]/]# reboot
?
? Now enter the appropriate mode immediately
? [Email protected]/]# systemctl isolate? multi-user.target
? [Email protected]/]# systemctl isolate? graphical.target?
######################################################
Linux system service and Management (services)---------the third day