Red_Hat_Enterprise_Linux-7-Resource_Management_and_Linux_Containers_Guide-en-US.pdf

(2855 KB) Pobierz
Red Hat Enterprise Linux 7
Resource Management and Linux
Containers Guide
Managing system resources and administering Linux Containers on Red
Hat Enterprise Linux 7
Peter Ondrejka
Rüdiger Landmann
Douglas Silas
Martin Prpič
Red Hat Enterprise Linux 7 Resource Management and Linux
Containers Guide
Managing system resources and administering Linux Containers on Red
Hat Enterprise Linux 7
Peter Ondrejka
Red Hat Engineering Co ntent Services
po ndrejk@redhat.co m
Do uglas Silas
Red Hat Engineering Co ntent Services
dhensley@redhat.co m
Martin Prpič
Red Hat Security Respo nse Team
mprpic@redhat.co m
Rüdiger Landmann
Red Hat Engineering Co ntent Services
r.landmann@redhat.co m
Legal Notice
Copyright © 2013 Red Hat, Inc.
T his document is licensed by Red Hat under the
Creative Commons Attribution-ShareAlike 3.0 Unported
License.
If you distribute this document, or a modified version of it, you must provide attribution to Red
Hat, Inc. and provide a link to the original. If the document is modified, all Red Hat trademarks must be
removed.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section
4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity Logo,
and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux ® is the registered trademark of Linus T orvalds in the United States and other countries.
Java ® is a registered trademark of Oracle and/or its affiliates.
XFS ® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States
and/or other countries.
MySQL ® is a registered trademark of MySQL AB in the United States, the European Union and other
countries.
Node.js ® is an official trademark of Joyent. Red Hat Software Collections is not formally related to or
endorsed by the official Joyent Node.js open source or commercial project.
T he OpenStack ® Word Mark and OpenStack Logo are either registered trademarks/service marks or
trademarks/service marks of the OpenStack Foundation, in the United States and other countries and
are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or
sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
Abstract
Managing system resources, administering Linux Containers, and using Docker on Red Hat Enterprise
Linux 7.
Table of Contents
Table of Contents
P . . . . . . . . . . . . . . . . . . . . . . With . . . . . . . . . . . .
. .art .I. Resource. Management. . . . . .Control. Groups. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 . . . . . . . .
.
C . . . . . . . Introduction . . . . . . . . Groups . . . . . . . .
. .hapter. 1. . . . . . . . . . . . .to. Control . . . . . . . .(Cgroups). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 . . . . . . . .
.
1.1. What are Control Groups
4
1.2. Default Cgroup Hierarchies
4
1.3. Resource Controllers in Linux Kernel
6
1.4. Additional Resources
7
C . . . . . . . Using . . . . . . . . . . . .
. .hapter. 2. . . . . . .Control. Groups. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 . . . . . . . .
.
2.1. Creating Control Groups
9
2.2. Removing Control Groups
10
2.3. Modifying Control Groups
11
2.4. Obtaining Information About Control Groups
15
2.5. Additional Resources
18
C . . . . . . . . . . . . . . . . . . . . . . .
. .hapter. 3. Using .libcgroup .T.ools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 . . . . . . . .
..
3.1. Mounting a Hierarchy
20
3.2. Unmounting a Hierarchy
22
3.3. Creating Control Groups
22
3.4. Removing Control Groups
23
3.5. Setting Cgroup Parameters
24
3.6. Moving a Process to a Control Group
25
3.7. Starting a Process in a Control Group
26
3.8. Obtaining Information About Control Groups
27
3.9. Additional Resources
28
C . . . . . . Control . . . . . . . . . . . . . . . Examples
. .hapter. 4 . . . . . . . . .Group .Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 . . . . . . . .
..
4 .1. Prioritizing Database I/O
29
4 .2. Prioritizing Network T raffic
30
P . . . . . . . . . . . . . . . . .
. .art .II. .Linux. Containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 . . . . . . . .
..
C . . . . . . . Introduction . . . . . . . . . . . . . . .
. .hapter. 5. . . . . . . . . . . . .to. Linux .Containers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 . . . . . . . .
..
5.1. Linux Containers Architecture
33
5.2. Secure Containers with SELinux
35
5.3. Container Use Cases
35
5.4. Application Packaging with Docker
38
5.5. Linux Containers Compared to KVM Virtualization
38
5.6. Additional Resources
39
C . . . . . . . Using . . . . . .
. .hapter. 6. . . . . . .Docker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4 0 . . . . . . . .
..
6.1. Working with Docker Images
40
6.2. Managing Containers
42
6.3. Monitoring Images and Containers
45
6.4. Using Dockerfiles
50
6.5. Networking
52
6.6. Sharing Data Across Containers
53
6.7. Publishing Images
56
6.8. Additional Resources
57
C . . . . . . . Using . . . .
. .hapter. 7. . . . . . .virsh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 . . . . . . . .
..
7.1. Connecting to the LXC Driver
58
7.2. T he virsh Utility
59
7.3. Creating a Container
59
7.4. Starting, Connecting to, and Stopping a Container
60
7.5. Modifying a Container
61
1
Zgłoś jeśli naruszono regulamin