日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > windows >内容正文

windows

Systemd-CentOS7系统服务介绍与CentOS6服务对比

發(fā)布時間:2023/12/15 windows 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Systemd-CentOS7系统服务介绍与CentOS6服务对比 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

Systemd:

POST --> Boot Sequence --> Bootloader --> kernel + initramfs(initrd) --> rootfs --> /sbin/init

init:

CentOS 5: SysV init

CentOS 6: Upstart

CentOS 7: Systemd


Systemd新特性:

系統(tǒng)引導(dǎo)時實現(xiàn)服務(wù)并行啟動;

按需激活進程;

系統(tǒng)狀態(tài)快照;

基于依賴關(guān)系定義服務(wù)控制邏輯;


核心概念:unit

配置文件進行標(biāo)識和配置;文件中主要包含了系統(tǒng)服務(wù)、監(jiān)聽socket、保存的系統(tǒng)快照以及其它與init相關(guān)的信息;

保存至:

/usr/lib/systemd/system

/run/systemd/system

/etc/systemd/system


Unit的類型:

Service unit: 文件擴展名為.service, 用于定義系統(tǒng)服務(wù);

Target unit: 文件擴展名為.target,用于模擬實現(xiàn)“運行級別”;

Device unit: .device, 用于定義內(nèi)核識別的設(shè)備;

Mount unit: .mount, 定義文件系統(tǒng)掛載點;

Socket unit: .socket, 用于標(biāo)識進程間通信用的socket文件;

Snapshot unit: .snapshot, 管理系統(tǒng)快照;

Swap unit: .swap, 用于標(biāo)識swap設(shè)備;

Automount unit: .automount,文件系統(tǒng)的自動掛載點;

Path unit: .path,用于定義文件系統(tǒng)中的一個文件或目錄;


關(guān)鍵特性:

基于socket的激活機制:socket與服務(wù)程序分離;

基于bus的激活機制:

基于device的激活機制:

基于path的激活機制:

系統(tǒng)快照:保存各unit的當(dāng)前狀態(tài)信息于持久存儲設(shè)備中;

向后兼容sysv init腳本;


不兼容:

systemctl命令固定不變

非由systemd啟動的服務(wù),systemctl無法與之通信


管理系統(tǒng)服務(wù):

CentOS 7: service unit

注意:能兼容早期的服務(wù)腳本


命令:systemctl COMMAND name.service


啟動:service name start ==> systemctl start name.service

停止:service name stop ==> systemctl stop name.service

重啟:service name restart ==> systemctl restart name.service

狀態(tài):service name status ==> systemctl status name.service

條件式重啟:service name condrestart ==> systemctl try-restart name.service

重載或重啟服務(wù):systemctl reload-or-restart name.service

重載或條件式重啟服務(wù):systemctl reload-or-try-restart name.service

禁止設(shè)定為開機自啟:systemctl mask name.service

取消禁止設(shè)定為開機自啟:systemctl unmask name.service



查看某服務(wù)當(dāng)前激活與否的狀態(tài):systemctl is-active name.service

查看所有已經(jīng)激活的服務(wù):

systemctl list-units --type service?

查看所有服務(wù):

systemctl list-units --type service --all


chkconfig命令的對應(yīng)關(guān)系:

設(shè)定某服務(wù)開機自啟:chkconfig name on ==> systemctl enable name.service

禁止:chkconfig name off ==> systemctl disable name.service

查看所有服務(wù)的開機自啟狀態(tài):

chkconfig --list ==> systemctl list-unit-files --type service?

查看服務(wù)是否開機自啟:systemctl is-enabled name.service


其它命令:

查看服務(wù)的依賴關(guān)系:systemctl list-dependencies name.service



target units:

unit配置文件:.target


運行級別:

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


級別切換:

init N ==> systemctl isolate name.target


查看級別:

runlevel ==> systemctl list-units --type target


獲取默認(rèn)運行級別:

/etc/inittab ==> systemctl get-default


修改默認(rèn)級別:

/etc/inittab ==> systemctl set-default name.target


切換至緊急救援模式:

systemctl rescue


切換至emergency模式:

systemctl emergency


其它常用命令:

關(guān)機:systemctl halt、systemctl poweroff

重啟:systemctl reboot

掛起:systemctl suspend

快照:systemctl hibernate

快照并掛起:systemctl hybrid-sleep


轉(zhuǎn)載于:https://blog.51cto.com/zhanx/2316304

總結(jié)

以上是生活随笔為你收集整理的Systemd-CentOS7系统服务介绍与CentOS6服务对比的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。