Question of operation and dimension of Linux system

Source: Internet
Author: User
Tags domain name server cpu usage domain server haproxy

1. Brief introduction of commonly used high-availability technologies

Answer:

Keepalived:keepalived is a service software that ensures high availability of clusters to prevent single points of failure and is implemented using the VRRP protocol. The backup will take over Master's work and continue the service if the master proactively lowers its weight between master and backup, or if backup detects that master fails.

Haproxy:haproxy provides high availability, load balancing, and proxies based on TCP and HTTP applications, supporting virtual hosting, which is a free, fast, and reliable solution. Haproxy is especially useful for Web sites that are heavily loaded, and often require session-hold or seven-tier processing. The haproxy runs on the current hardware and can support tens of thousands of concurrent connections. and its operating mode makes it easy and safe to integrate into your current architecture, while protecting your Web server from being exposed to the web.

heartbeat+ DRBD:

Heartbeat (Linux-ha) Working principle: Heartbeat core consists of two parts, heartbeat monitoring part and the resource taking over part, heartbeat monitoring can be carried out through the network link and serial port, and support redundant links, they send each other a newspaper Greek tell each other their current state, If the message is not received by the other party within the specified time, then it is considered to be invalid, then the resource takeover module should be started to take over the resources or services running on the other host.

Distributed replicated block Device (DRBD) is a software-implemented, non-shared storage replication solution for mirrored block device content between servers.

Data mirroring: Real-time, transparent, synchronous (all servers are returned after success), asynchronous (returned after successful local server)

2. briefly describe the DNS parsing process

Answer:

1, enter the www.qq.com domain name in the browser, the operating system will first check their local hosts file whether there is this URL mapping relationship, if there is, first call this IP address mapping, complete the domain name resolution.

2, if the hosts do not have this domain name mapping, then find the local DNS resolver cache, whether there is this URL mapping relationship, if there is, direct return, complete the domain name resolution.

3, if the hosts and the local DNS resolver cache does not have the corresponding URL mapping relationship, first will find the TCP/IP parameters set in the preferred DNS server, where we call it a local DNS server, when the server receives the query, if the domain name to query, included in the Local Configuration zone resources, The parsing result is returned to the client and the domain name resolution is completed, which is authoritative.

4, if the domain name to be queried is not resolved by the local DNS server zone, but the server has cached this URL mapping relationship, call this IP address mapping, complete the domain name resolution, this resolution is not authoritative.

5, if the local DNS server local zone file and cache resolution are invalidated, according to the local DNS server settings (whether set forwarders) to query, if not in the forwarding mode, local DNS will send the request to 13 root DNS, the root DNS server receives the request will determine the domain name (. com) Who is authorized to administer and returns an IP that is responsible for the top-level domain name server. After the local DNS server receives the IP information, it will contact the server responsible for the. com domain. After the server that is responsible for the. com domain receives the request, if it cannot resolve itself, it will find a management. com domain's next-level DNS server address (qq.com) to the local DNS server. When the local DNS server receives this address, it will find the qq.com domain server, repeat the above action, query until the www.qq.com host is found.

6, if the use of a forwarding mode, this DNS server will forward the request to the first level of DNS server, from the previous level of the server to resolve, the previous level of the server if it can not resolve, or find root DNS or transfer requests to the upper ancestor, in this cycle. Whether the local DNS server uses either forwarding or root hints, the result is returned to the local DNS server, which is then returned to the client.

From the client to the local DNS server is a recursive query, and the DNS server is an interactive query between the iterative query.

3. Brief introduction of the server monitoring software you used, and briefly explain the characteristics of their respective, introduce the common monitoring indicators. View the status of your current Linux system, such as CPU usage, memory usage, load conditions, and more, to see the 5 most memory-intensive processes

Answer:

Nagios

The features that Nagios can monitor are:

1, monitoring network services (SMTP, POP3, HTTP, NNTP, ping, etc.);

2, monitor the host resources (processor load, disk utilization, etc.);

3, simple plug-in design allows users to easily expand their services to detect methods;

4, parallel service inspection mechanism;

5, with the ability to define the hierarchical structure of the network, with the "parent" host definition to express the relationship between the network host, this relationship can be used to identify and clarify the host outage or unreachable state;

6, when the service or host problems arise and resolve the alarm sent to the contact person (via email, SMS, user-defined mode);

7, can define some processing procedures, so that it can be in service or host failure to play a preventive role;

8, automatic log scrolling function;

9, can support and implement redundant monitoring of the host;

10, the optional web interface for viewing the current network status, notification and fault history, log files and so on;

11, can be viewed through the mobile phone system monitoring information;

12, can specify the custom event processing controller;

To view the status of the current system: top

View the top 5 processes that occupy the largest memory, and then press the M (uppercase) key. Method Two: Ps-aux | Sort-k4nr | Head-5

4. Use the Windows Service Management command to turn on the BEASD service and view the number of connections currently established, with a default port of

Answer:

Start service: net start BEASD

If the service is forbidden to start, use this command: sc config beasd=demand (manual) |auto (Auto) |disabled (disabled); SC start BEASD

5. briefly describe the boot sequence of Linux systems, query program RunLevel and modify RunLevel.

Answer:

Post power-on self-test-"MBR boot-" grub--"Loading kernel-" Start the init process-"read/etc/inittab file,/etc/init/*.conf file--" Use/etc/rc.d/ Rc.sysinit init Script-"Execute/ETC/RC.D/RC script (load/etc/rc3.d/all scripts)-" Execute/etc/rc.d/rc.local--"execute/bin/login Login Program

Query program Run Level: RunLevel

Modify RunLevel: init [0123456]

6. describe the differences between soft links and hard links.

Answer:

Soft link refers to the creation of a new file, the block is stored in the file name of the link is pointed, the inode of the soft link with the source file of the inode, the source files are deleted, then rebuilt, changed the inode, the soft link file is still valid.

The hard link is to create a new file name that points its inode to the inode of the source file, so the hard-link inode and source files are the same, and the source files are deleted after the hard link can still be valid.

7. host a needs to transmit a copy of 100G data to Host B, which transmission optimization can be done?

Answer:

    1. Data packaging compression

    2. Data fragmentation, synchronous transmission

    3. Increase transmission bandwidth, network port aggregation

8. This paper introduces the working mode and scheduling algorithm of LVS, and recommends architecture of large concurrent environment.

Answer:

Operating mode: Nat,tunnel,dr,fullnat

Algorithm

Description

Rr

Polling schedule (Round-robin), which assigns the request to a different RS node in turn, that is, the request is divided across the RS node. This algorithm is simple to answer, but only suitable for the RS node processing performance is not small difference situation

Wrr

Weighted polling Schedule (Weighted Round-robin) It assigns tasks according to the weights of the different RS nodes. RS with higher weights will take precedence over the task, and the number of connections allocated will be greater than RS nodes with lower weights. RS of the same weighted value get the same number of connections.

Dh

Destination Address hash dispatch (Destination Hashing) find a static hash table with the destination address as the keyword to obtain the required RS

Sh

Source Address Hash Dispatch (source Hashing) finds a static hash table with the source address as a keyword to obtain the required RS

Lc

The minimum number of connections is dispatched (Least-connection), and the Ipvs table stores all active connections. Send a new connection request to the smallest current number of connections RS

Wlc

Weighted minimum number of connections scheduling (Weighted least-connection) assume that the weights of each RS is WI (I=1..N), the current number of TCP connections is Ti (I=1..N), and then select Ti/wi as the smallest RS as the next assigned RS

Lblc

Address-based minimum number of connections dispatch (Locality-based least-connection), the request from the same destination address is assigned to the same RS node, if this server is full load, assigned to the minimum number of connections RS, and it for the next assignment is the first consideration

LBLCR

The minimum number of connections is scheduled based on the address with repeat (locality-based least-connection with Replication), for a certain destination address, a corresponding RS subset. For this address request, assign it the minimum number of sub-set connections RS; If all servers in the subset are full, select a smaller number of servers from the cluster, add it to this subset, and assign connections; If no modifications have been made within a certain amount of time, the node with the largest subset of the sub-set is removed

Sed

Shortest expected delay (shortest expected delay scheduling SED)

Based on the WLC algorithm. Example:

The ABC three machines weigh 123 respectively, and the number of connections is 123. Then if a new request comes in using the WLC algorithm, it may be assigned to any of the ABC's. This is done after using the SED algorithm:

A (+)/1

B (1+2)/2

C (1+3)/3

According to the result of the operation, the connection is given C

NQ

Minimum queue scheduling (never queue scheduling NQ)

No queues are required. If the number of connections to RS = 0 is allocated directly to the past, no further SED operations are required

Recommended for large concurrency environments: Dr Mode, RR scheduling algorithm.

9. describe the process of the TCP three handshake?

Answer:

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/8D/9A/wKiom1ii9qjCscn2AAEEMO9NDeg316.jpg-wh_500x0-wm_ 3-wmp_4-s_1158167094.jpg "title=" 111.jpg "alt=" Wkiom1ii9qjcscn2aaeemo9ndeg316.jpg-wh_50 "/>


. sed changes all "/opt/tmp" in the file Test.txt to "/root/tmp" and deletes all empty lines.

Answer:

Sed-i ' s#/opt/tmp #/root/tmp #g ' test.txt|sed-i '/^\s*$/d '

One by one . 192.168.16.3 This Windows Server folder to the Linux local/mnt/server directory, the Windows account is: Administrator, the password is: 123456

Answer:

1. First share the directory server that needs to be mounted under Windows.

2, make sure that Linux and Windows are in the same LAN.

3. Create a directory/mnt/server below Linux that needs to be mounted.

4. Mount using the Mount command.

Mount command: mount-t cifs-o username=administrator,password=123456//192.168.16.3/server/mnt/server

. Write a firewall configuration script that allows only remote hosts to access the local port 80. (Linux iptables)

Answer:

#!/bin/bash

#this is a server firewall

#updated by Yehaifeng

#qq: 769358362

#define Var

Ipt=/sbin/iptables

#Remove any existing rules

$IPT-F

$IPT-X

$IPT-Z

#setting default Firewallpolicy

$IPT--policy OUTPUT ACCEPT

$IPT--policy FORWARD DROP

$IPT-P INPUT DROP

#setting for loopback interface

$IPT-A input-i lo-j ACCEPT

$IPT-A output-o lo-j ACCEPT

#accept Port only

$IPT-A input-p TCP--dport 80-j ACCEPT

#save iptables

/etc/init.d/iptables Save

. Write a shell script to transfer files from the/logs directory 3 days ago to the/tmp directory.

Answer:

#!/bin/bash

#this is to move file 3 Yearago from/logs to/tmp

#updated by Yehaifeng

#qq: 769358362

#define Var

File_from=/logs

File_to=/tmp

Day_ago=3

CD $FILE _from

For file in ' Find $FILE _from-type f-mtime +3 '

Do

/BIN/MV $FILE _from/$file $FILE _to/$file

Done

. Daily 1:00 Backup the log file of the previous day in the/var/log directory and place it in the Btslog directory of the current directory, and delete the log backup file 15 days ago, using the shell script. (The log format is: BTSVR.LOG.2016-01-01, the package backup file format is: btsvr.log.2016-01-01.tar.gz)

Answer:

Cat bak_logs.sh

#!/bin/bash

#this is to backup logs

#updated by Yehaifeng

#qq: 769358362

#define Var

yesterday= ' Date +%f-d '-1 day '

Log_dir=/var/log

Bak_dir=/var/log/btslog

Log_file=btsvr.log

CD $LOG _dir/

If [-F $LOG _dir/$LOG _file. $YESTERDAY]; then{

Tar zcf $LOG _dir/$LOG _file $YESTERDAY. tar.gz$log_dir/$LOG _file. $YESTERDAY

/BIN/MV $LOG _dir/$LOG _file $YESTERDAY. tar.gz/bak_dir/

}

Else

echo "The file is not exist."

Fi

Use a timed task to execute the script 1 points per day: 0001 * * */bin/bash bak_logs.sh

A . write a script to the Nginx log statistics, get the top 10 IP access (nginx log path:/nginx/default/access.log)

Answer:

Cat bak_logs.sh

#!/bin/bash

#this is to backup logs

#updated by Yehaifeng

#qq: 769358362

#define Var

Log_file=/nginx/default/access.log

awk ' {print '} '/application/nginx/logs/access.log |sort|uniq-c|sort-r|head-10>/tmp/ip_max.txt

Echo/tmp/ip_max.txt


This article is from the "Wind Herd" blog, please be sure to keep this source http://2660453.blog.51cto.com/2650453/1897797

Question of operation and dimension of Linux system

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.