|
|
[root@compute01 ~]# vim /etc/sysconfig/libvirtd 修改文件:
* h; ~/ j" [, p" T0 p1 B, _
3 c. g% f2 B' f- b8 v" C[root@compute01 ~]# vim /etc/sysconfig/libvirtd
$ Z) ^, D1 g; J' R6 YLIBVIRTD_ARGS="--timeout 86400 " #时间设置3 x' ~* U" Q% J9 n
LIBVIRTD_CONFIG=/etc/libvirt/libvirtd.conf #配置文件; U0 Z, j; G! l/ V$ k
; R1 F# ~- g n) U$ F
3 m/ J" |. G; p; H0 r$ z[root@compute01 ~]# libvirtd -d) d" n# j5 i+ e% E% {2 g' @
libvirtd: error: Unable to obtain pidfile. Check /var/log/messages or run without --daemon for more info. 说明已经启动了。- s5 X5 i( g9 y l: c* K# ]' o) b' \( x5 I. \
) m0 f- D" L7 P! m& i
[root@compute01 ~]# ps -ef |grep libvirtd 查看进程:/ x" O# z/ P* N) m" E* J2 I
root 9051 1 0 08:47 ? 00:00:00 libvirtd -d7 [& ~2 l$ _2 d8 D( d* a6 c
root 9171 2791 0 08:48 pts/1 00:00:00 grep --color=auto libvirtd* N3 {& V' ~1 a
7 _& C, B0 _, g1 {: U! h' a, r0 G7 k0 Y7 W5 }
停止程序:
5 [5 X: K. j. Z! E) {[root@compute01 ~]# kill -9 9051' H2 Z2 s7 N0 z( P8 w
" K( C" T( D: ^* J5 Y
[root@compute01 ~]# ps -ef |grep libvirt
5 F/ [! B2 i* s% ^; I: v& ednsmasq 9124 1 0 08:47 ? 00:00:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper4 _8 w7 v7 \- {: O
root 9125 9124 0 08:47 ? 00:00:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
5 R: O2 g+ L4 @root 9173 2791 0 08:49 pts/1 00:00:00 grep --color=auto libvirt" z' \( M( Z* O3 ~
[root@compute01 ~]# kill -9 9124 9125
) F' \: N7 ]! U1 V
; O+ k. ~, i: Q m- i9 S$ i, a }" U7 Z- x
[root@compute01 ~]# ps -ef |grep libvirt
$ x @% ^4 G& f# hroot 9183 2791 0 08:49 pts/1 00:00:00 grep --color=auto libvirt
2 s8 T1 r4 K2 x[root@compute01 ~]# ps -ef |grep libvirt
, i* O7 S! f4 x* v+ q9 n4 Troot 9185 2791 0 08:49 pts/1 00:00:00 grep --color=auto libvirt
8 q& q9 P/ i7 X- n% H& }" g3 D! M8 `4 k, U
0 T+ S) `& f9 x3 E0 N
[root@compute01 ~]# virsh list . z8 k% r" H) Q, v) D$ T& r+ N8 l6 W
error: failed to connect to the hypervisor
7 b6 F6 s8 F6 Q; [) B' v2 M1 |2 S0 d4 z& _3 r
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused
1 ?, Q9 T; O0 }' v$ D4 o
1 r+ }& _4 \9 u9 g1 {* M, J( i, l
检查状态:
6 E/ u$ J Y, c& C7 V X
( @$ f7 K8 Q( V* ?0 a8 p/ l" M[root@compute01 ~]# systemctl status libvirtd.service 3 ?: S5 P1 V3 p. H! Q& x
● libvirtd.service - Virtualization daemon0 }+ W+ p8 h4 m, G2 M+ J
Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; disabled; vendor preset: enabled)- U1 z$ Q' u/ v
Active: failed (Result: exit-code) since Sun 2022-05-08 08:47:37 CST; 2min 3s ago
, G- @6 w6 B" O2 A* q2 K Docs: man:libvirtd(8)
- Z- B$ q: ]6 B: p+ `1 n' v! K https://libvirt.org
; z* w& g# j9 | A, v4 G% q Process: 9028 ExecStart=/usr/sbin/libvirtd $LIBVIRTD_ARGS (code=exited, status=6)
# v+ `% E1 O4 D8 p4 h! K) Z Main PID: 9028 (code=exited, status=6)
) a) d( w1 y: _ ^' \% O$ F! _: {May 08 08:47:37 compute01 systemd[1]: libvirtd.service: Service RestartSec=100ms expired, scheduling restart.
1 L4 o9 P: I0 hMay 08 08:47:37 compute01 systemd[1]: libvirtd.service: Scheduled restart job, restart counter is at 5.
2 q* c: M$ B# h* o; }May 08 08:47:37 compute01 systemd[1]: Stopped Virtualization daemon.
0 F7 {6 p, b7 E0 \& W2 BMay 08 08:47:37 compute01 systemd[1]: libvirtd.service: Start request repeated too quickly.5 c% T! q2 C; A q9 a# Q$ Q2 C
May 08 08:47:37 compute01 systemd[1]: libvirtd.service: Failed with result 'exit-code'.
# u( b7 z" r e: O! AMay 08 08:47:37 compute01 systemd[1]: Failed to start Virtualization daemon.$ i, i6 r* d( L' v* [
( c# t8 T+ d8 k7 q: \- y启动:
" ~( q: P) N" p) I6 j' \# r9 M[root@compute01 ~]# systemctl start libvirtd.service
) h" G( x% v- i ]
9 f1 j9 K" |! s: r7 N2 {
( x: c. Q2 L* U9 e! t5 A* @8 p[root@compute01 ~]# systemctl status libvirtd.service
0 o9 J% B) l& v8 d6 e- \● libvirtd.service - Virtualization daemon2 ~$ ?3 C# ^3 i( Q: ?! P
Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; disabled; vendor preset: enabled)' I( w% L1 B, j: k
Active: active (running) since Sun 2022-05-08 08:49:45 CST; 1s ago
9 Z( i8 `1 ~, o& ?7 w Docs: man:libvirtd(8)4 P, g2 D [9 e# B4 w# H
https://libvirt.org8 d/ l( r0 q9 v
Main PID: 9196 (libvirtd); L9 J* _/ i5 b/ ]$ X
Tasks: 21 (limit: 32768)
* R: E! f% |8 n8 F' M3 h' P8 R Memory: 14.8M/ q3 y" ~! L, y+ e( b( V
CGroup: /system.slice/libvirtd.service
. T; K+ F& W4 K2 y" k: B+ d ├─9196 /usr/sbin/libvirtd --timeout 86400; w! N- W% ?/ n# V
├─9269 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-scr>
, {- p4 k3 g5 U) O └─9270 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-scr>
5 X$ T$ e% W! L' P4 ZMay 08 08:49:46 compute01 dnsmasq[9266]: listening on virbr0(#7): 192.168.124.1
: L) e; c. F: `0 oMay 08 08:49:46 compute01 dnsmasq[9269]: started, version 2.79 cachesize 150
1 u" J9 ~3 o5 f2 `May 08 08:49:46 compute01 dnsmasq[9269]: compile time options: IPv6 GNU-getopt DBus no-i18n IDN2 DHCP DHCPv6 no>) h8 H7 G+ x6 H( N
May 08 08:49:46 compute01 dnsmasq-dhcp[9269]: DHCP, IP range 192.168.124.2 -- 192.168.124.254, lease time 1h! M6 L# s6 M' y K# e4 u
May 08 08:49:46 compute01 dnsmasq-dhcp[9269]: DHCP, sockets bound exclusively to interface virbr0" Q ]# _5 T6 ~9 ?& I
May 08 08:49:46 compute01 dnsmasq[9269]: reading /etc/resolv.conf
9 ~6 Z4 |" @6 v! O" yMay 08 08:49:46 compute01 dnsmasq[9269]: using nameserver 202.106.0.20#53+ q3 X# p) [6 k, L7 x' s
May 08 08:49:46 compute01 dnsmasq[9269]: read /etc/hosts - 4 addresses
4 R) w: k5 X! q6 \7 y! ^May 08 08:49:46 compute01 dnsmasq[9269]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses4 Q0 z# t3 h! M" a& w
May 08 08:49:46 compute01 dnsmasq-dhcp[9269]: read /var/lib/libvirt/dnsmasq/default.hostsfile8 Z& z1 @- b+ B" Y1 L2 l
# l' ]" B" @1 F* q7 L- z# k1 l) z y3 b& I: Z( Z4 W
[root@compute01 ~]# virsh list
4 I/ y v. A6 J. p0 V Id Name State
) @; a$ b1 |! w4 A; V: g--------------------. W I1 y( s, y9 {- f
/ `& C; T' Q' c" t" O
" D/ }7 t6 m b0 U' c+ k8 d3 G[root@compute01 ~]# ps -ef |grep libirt
$ g3 l8 O& N6 e8 R7 t+ @, H/ I: nroot 9296 2791 0 08:50 pts/1 00:00:00 grep --color=auto libirt
8 g% o+ G4 n3 ^* g9 ?: g$ X/ w[root@compute01 ~]# ps -ef |grep libvirt
8 i- Y( T2 T2 y8 r% Y! j4 e& yroot 9196 1 1 08:49 ? 00:00:00 /usr/sbin/libvirtd --timeout 86400
0 W3 ~+ s+ B* R5 zdnsmasq 9269 1 0 08:49 ? 00:00:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
* m( o. m$ v( m9 rroot 9270 9269 0 08:49 ? 00:00:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
( K7 D! {5 F* _; Zroot 9300 2791 0 08:50 pts/1 00:00:00 grep --color=auto libvirt) {+ e6 Y6 N L% O% ~
4 h6 x4 R5 W5 A/ m9 t* p8 w( r4 C* I" ?# ^. |' S8 B4 o7 k% T) n* d- y
[root@compute01 ~]# virsh list d7 s: N# L, H; ?$ y8 M. Y
Id Name State- F7 Y3 c9 Z' f1 Z& t
--------------------/ A L; g8 c+ E0 Y
[root@compute01 ~]# virsh net-list
9 D( t( y* D- S& U+ y) S8 F2 o, J Name State Autostart Persistent7 q; s! P% X- W2 y& E. E9 j
--------------------------------------------
+ c; ]* m4 B$ L v default active yes yes
A6 G% Q2 ]5 O+ C4 G: u) \/ @$ K( H5 L( x6 [$ y
kvm系统停止default网络:2 b* b0 r4 r y5 J/ h$ Y) A' j
[root@compute01 ~]# virsh net-destroy default 8 k$ r; z' d q- M. ^4 i7 v
Network default destroyed( @ a3 z; x/ p, Y( g+ g. h
1 j* F" u8 d9 u, K启动default网络:7 ?- c$ n) f& M, }
[root@compute01 ~]# virsh net-start --network default & {! S; P9 b( W8 A. x: s% c* U
Network default started; A& Q7 @( a% O$ d
% R# _6 T. Y/ m) Y/ p( X a% }
[root@compute01 ~]# virsh list
; q: A" A. p; g9 q. q$ \: K# U- O Id Name State9 t* I7 _" Z! o! Y, Q3 r
--------------------( y" @/ p2 C" o+ C$ f, {' V
' I' O* b1 N: D& e# \: z9 P[root@compute01 ~]# virsh net-list $ }8 Z- l/ G% `' _
Name State Autostart Persistent# t' S; J$ c/ l ]) X# s, H
--------------------------------------------$ J5 g1 g. ^4 g) t& }
default active yes yes/ ^4 U- r4 J' a3 z: \
7 C! {4 J1 _! c& s2 w: n3 c
视乎解决了。
$ r( i# c& c4 c; U0 |观察下吧。
( u2 ?1 U) O- w9 a |
|