Linux operations must be the face of the question (ii)

Source: Internet
Author: User
Tags in domain docker ps docker registry

First, the Linux startup process?

  1. post : After the server host is powered on, the CPU, memory, graphics card, keyboard, and other devices will be tested according to the setup of the motherboard BIOS (basic input/output system, primary input and output system). After successful detection, the system control is transferred according to the preset boot order, and most of the time it is transferred to the local hard drive.

  2. MBR boot : When booting a system from a native hard disk, the system control is passed to the partition containing the operating system boot file based on the settings of the MBR (Master boot record, master boot recording) in the 1th sector of the hard disk. or call the boot menu (such as grub) directly from the boot information in the MBR record.

  3. Grub Menu : For Linux systems, GRUB is the most widely used multi-system bootstrapper program. After the system control is passed to grub, the boot menu is displayed to provide the user with the option to load the Linux kernel files based on the selected (or default), and then transfer the system control to the kernel.

  4. load Linux kernel : Linux kernel is a pre-compiled special binary file, between various hardware resources and system programs, responsible for resource allocation and scheduling. After the kernel takes control of the system, it will fully control the operation of the entire Linux operating system. In the RHEL6 system, the default kernel files are located in "/boot/vmlinuz-2.6.32-431.e16.x86_64".

  5. init process Initialization : To complete the further system boot process, the Linux kernel first loads the "/sbin/init" program in the system into memory (the running program is called the process) and the INIT process is responsible for completing a series of system initialization processes. Finally, wait for the user to log in.


Second,Linux system monitoring commands, view CPU load memory, etc.

The top command is a common performance analysis tool under Linux, such as CPU, memory usage, and real-time display of the resource usage of each process in the system, similar to the Task Manager of Windows.

Top display system current process and other conditions, is a dynamic display process, that is, you can continue to refresh the current state through the user keys. If the command is executed in the foreground, it will monopolize the foreground until the user terminates the program. More accurately, the top command provides real-time status monitoring of the system's processor. It will display the most "sensitive" CPU in the system Task List. This command can be used by CPU. Memory usage and execution time to sort tasks, and many of the features of the command can be set through interactive commands or in personal customization files.

Top command parameters

D: Specifies the time interval between each two screen information refresh. Of course the user can use the s interactive command to change it.

P: Monitor only the state of a process by specifying the monitoring process ID.

Q: This option will cause top to refresh without any delay. If the calling program has Superuser privileges, top will run at the highest possible priority.

S: Specify cumulative mode

S: Causes the top command to run in Safe mode. This removes the potential danger of interactive commands.

I: Make top not show any idle or zombie processes.

C: Display the entire command line instead of just displaying the command name

Common operations

Top//5-second explicit resource usage for all processes

top-d2//Resource usage for all processes explicitly every 2 seconds

top-c//The resource usage of the explicit process every 5 seconds and displays the process's command-line arguments (by default, only the process name)

top-p12345-p6789//every 5 Seconds the PID is 12345 and the PID is 6789 of the resource usage of two processes

Top-d2-c-p123456//every 2 seconds, the PID is 12345 of the resource usage of the process, and the command-line arguments that the process starts are explicitly


Iii. commands for viewing network traffic

Watch-n 1 "/sbin/ifconfig eth0 | grep bytes "

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/91/00/wKioL1jzi32AHtQ1AAA8lVPYtuc948.jpg-wh_500x0-wm_ 3-wmp_4-s_3332436109.jpg "title=" 1.jpg "alt=" Wkiol1jzi32ahtq1aaa8lvpytuc948.jpg-wh_50 "/>

Four, the Docker four network mode

  1. host mode : If you use the host mode when you start the container, the container will not get a separate network Namespace, but instead share a network Namespace with the host. The container will not be virtual out of its network card, configure its own IP, etc., but use the host's IP and port.

  2. container mode : This mode specifies that the newly created container shares a Network Namespace with a container that already exists, rather than sharing it with the host. The newly created container does not create its own network card, configures its own IP, but shares the IP, port range, and so on with a specified container. Similarly, two containers, in addition to the network, other such as file system, process list, etc. are still isolated. Two container processes can communicate over the LO network card device.

  3. None Mode : This mode differs from the first two. In this mode, the Docker container has its own network Namespace, but it does not make any networking configuration for the Docker container. In other words, this Docker container does not have network cards, IP, Routing and other information. We need to add network cards, configure IP, etc. for our Docker containers.

  4. Bridge Mode: Bridgemode isDockerdefault network settings, this mode assigns each containerNetwork Namespace, settingIpAnd a host on theDockerThe container is connected to a virtual bridge. WhenDocker ServerOn startup, a host is created with a name ofDocker0Virtual bridge that is started on this host .DockerThe container is connected to the virtual bridge. A virtual bridge works like a physical switch so that all the containers on the host are connected through a switch to a two-tier network. Next you'll assign the containerIpout,Dockerwill be fromRFC1918The defined privateIpnetwork segment, select a different one from the hostIpaddress and subnet assigned toDocker0, connected toDocker0from this subnet, select an unoccupiedIpuse. such as GeneralDockerwill use172.17.0.0/16this network segment, and will172.17.0.1/16assigned toDocker0Network Bridge (used on the hostIfconfigcommand is to seeDocker0, you can think of it as the management interface of the bridge and use it as a virtual network card on the host computer .

    Docker Common commands:

1.docker Version//View the release number of Docker, including client, server, dependent go, etc.

2.docker Info//View system (Docker) level information, including managed images, containers number, etc.

3.docker Search <image>//searching for image in Docker index

4.docker Pull <image>//drop-down image from Docker Registry server

5.docker Push <image|repository>//push an image or repository to registry

6.docker Push<image|repository>:tag//Ibid., specify TAG

7.docker Inspect <image|container>//view the underlying information for image or container

8.docker images//view native images

9.docker images–a//List all images

10.docker PS//default display of container in operation


Vi. How Docker realizes the independence between containers

Using Core technology namespaces

1. PID Namespace

2.net namespace :

3.IPC namespace:process interaction in container or Linux common inter-Process interaction method (Interprocess COMMUNICATION-IPC), including Common semaphores, Message Queuing and shared memory. Container inter-process interaction is actually a process interaction in the same PID namespace on the host.

4.mnt namespace: Similar to chroot, a process is placed into a specific directory for execution. MNT namespace allows different namespace processes to see different file structures so that each namespace process sees a file directory that is isolated. in container, see the file system, is a complete Linux system, have/etc,/lib, etc., through the chroot implementation.

5.UTS namespace:UTS ("UNIX time-sharing System") namespace allows each container to have a separate hostname and domain name to make it on the network Can be viewed as a separate node rather than a process on the Host.

6.usernamespace: Each container can have different user and groupid, that is, it can execute the program inside the container with the user inside the container rather than the user on the Host.


Vii. What are the tools for achieving high availability?

1.hearbeat

2.keepalived

...


VIII. MySQL database backup tool?

Mysqldump Tools:

1. Is the backup tool that comes with MySQL, the directory is under the bin directory:/usr/local/mysql/bin/mysqldump, supports INNODB-based hot backup. However, because it is a logical backup, the speed is not very fast, suitable for small backup data scenarios. Mysqldump full backup + binary log enables point-in-time recovery.

2. MySQL is a tool for backup and data transfer. It mainly produces a series of SQL statements that can be encapsulated into a file that contains all the SQL commands needed to rebuild your database, such as CREATE database,create Table,insert, and so on. Can be used to implement a lightweight fast migration or recovery database.

3. It is the most commonly used backup method to make a data table into a SQL script file, which is relatively appropriate when upgrading between different MySQL versions.

4. Database export objects can be exported for a single table, multiple tables, a single database, multiple databases, all databases.

For

Xtrabackup tools provided by Percona:

The Xtrabackup implementation is a physical backup, and is a physical hot standby

1. Support InnoDB physical hot backup, support full backup, incremental backup, and very fast, support INNODB storage caused by the migration of data between different databases, support copy mode of slave backup restore backup recovery, in order to let xtrabackup support more function extension, You can set up a stand-alone tablespace, turn on the innodb_file_per_table feature, and enable a separate table backup when enabled.

2. (1) The backup process is fast and reliable;

(2) The backup process does not interrupt the executing transaction;

(3) Can save disk space and traffic based on functions such as compression;

(4) Automatic implementation of backup inspection;

(5) Fast restore speed.


Ix. What is the difference between awk and sed?

Awk:

Awk is a programming language that has a strong ability to handle document data. AWK specializes in extracting data from formatted messages or from a large text file.

AWK's command format is:

awk [-F Filed-separator] "commands" input-file (s)

awk divides a line of text by the delimiter (filed-separator) into multiple fields, which are then recorded as $1,$ 2 ... $ n. $ A represents all domain values. As a result, awk is more suitable for working with files in domain units. Plus the built-in variables such as Argind allow awk to process multiple files. A typical application is to find whether a field in one file appears in another file


Sed:

Sed is a streamlined, non-interactive editor. It can perform the same editing tasks as editing VI and Emacs, but the SED editor does not provide interactive usage, only input edit commands at the command line.

The command format for SED is:

sed [options] ' command ' file (s)

sed [options]-F scrīptfile file (s)

As an editor, of course there are commands such as inserting (A/, i/), deleting (d), finding replacements (s), and so on.

If the file is formatted, that is, separated by delimiters into multiple domains, the use of awk is preferred

Awk is suitable for column (domain) operations, and SED is suitable for line-by-row operation

Awk is suitable for extracting files, and sed is suitable for editing files.


Ten,cacti alarm already know, how to shut down the alarm?

Remove the tick in the Front option box "Threshold Enabled", which is the disabled threshold, which is not reported when the set alarm threshold is reached.


This article is from "Hello Sunshine" blog, please be sure to keep this source http://hexiaoshuai.blog.51cto.com/12156333/1916522

Linux operations must be the face of the question (ii)

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.