Episode

11. What is the website gray publish?
Refers to a gradation release released between black and white, it can be a smooth transition manner

AB test is a kind of gray distribution so that a user continues to use A, B began to use part of the user, if the user does not have any objections to B, then gradually expand the scope, all users are migrated to the top of B to release the gray can guarantee the stability of the overall system, can be found in the initial gray when the adjustment problems, in order to ensure that the impact of
process 12, briefly DNS for name resolution?
To access the user www.baidu.com, will go first to the host file of the machine, find a local DNS server setting, if no, then went to look for the root server network, the root server result of feedback that can only provide a domain Name server .cn, went to a domain name server, a domain name server to provide secondary domain name server can only say .com.cn, went to the secondary domain name server, secondary domain server can only provide third-level domain servers. baidu.com.cn, went to three domain name server, three name servers happen to have this site www.baidu.com, then the request to the server, and after a save, and then distributed to the client

13, RabbitMQ is what?
I.e. RabbitMQ container message queue middleware, messaging middleware message is stored in the message information transmission process
acts as an intermediary in the message middleware then bid message from its source to its target role in
the main purpose is to provide the queue route and ensure the transmission of the message; if the recipient is unavailable to send a message when
the message queue is not retained message until it can successfully transferred so far, of course, save the message also has a message queue indefinitely

14, talk about the principle of Keepalived?
In a virtual router, only as a MASTER of VRRP router will always send VRRP advertisement information,
the BACKUP will not seize MASTER, unless it higher priority. When MASTER is unavailable (BACKUP not receive notification information)
multiple BACKUP highest priority of this will be preempted as MASTER. This preemption is very fast (<1s), in order to ensure continuity of service
due to safety considerations, VRRP packet is encrypted using an encryption protocol. BACKUP does not send notification information, only receive information notice

15, tells about the work process LVS three modes?
LVS load balancing three modes, namely VS / NAT (nat mode) VS / DR (Route mode) VS / TUN (tunnel mode)

A, the NAT mode (VS-NAT)
Principle: IP header destination address is sent to the client data packet, wherein the IP address into a station RS at the load balancer
concurrent RS to process point, processed RS after the data to the load balancer, the load balancer then the original packet IP address to its own IP
destination address IP address can be changed during the client, whether incoming traffic or out of traffic, must after the load balancer
advantages: a cluster of physical servers can use any support TCP / IP operating systems, load balancing requires only a valid IP address
shortcomings: limited scalability. When too many server nodes (ordinary PC server) growth, the load balancer will become the bottleneck of the whole system
because all the request packets and response packets have been flowing to the load balancer. When the server node too
many packets are in the load balancer that intersection, the speed will slow down!

Two, IP tunnel mode (VS-TUN)
Principle: First of all you know, most of the Internet service request packet on the Internet is very short, and response packets usually large
so that the tunnel mode, the client sent the data packet, a package the new IP header marker (only the destination IP) RS issued
after the RS receives the head of the first packet untied restore data packets, after processing, returned to the client directly, do not need to go through
the load balancer. Note that since the RS need to load balancer sent me a packet reduction, so that must support
IPTUNNEL agreement, so in RS kernel must be compiled to support IPTUNNEL this option
Advantages: load balancer is only responsible for the request packet distributed backend server node, and RS a response packet directly to the user
Therefore, reducing the amount of data flow in the load balancer, the load balancer is no longer the bottleneck of the system, it can handle the huge amount of requests
in this way, a load balancer can distribute as many RS. And running can be distributed in different areas of the public Internet.
Drawback: RS node tunnel mode requires legitimate IP, this approach requires all servers support the "IP Tunneling"
(IP Encapsulation) protocol, a server may only be limited to the part of the Linux system

Third, direct routing mode (VS-DR)
Principle: load balancer and RS use the same IP DR Foreign Service but only to the ARP request responds to
all RS remain silent on this IP ARP request itself that is to say, the gateway will the request for IP services directed to all DR
and the DR receives a data packet according to the scheduling algorithm, find the corresponding RS, the RS destination MAC address to a MAC (since the same IP)
and that this request is distributed RS when the RS receives this packet, after the process is completed, since the same IP, the data may be directly returned to the client
is then equal directly from the client receives this data packet is no different, directly after the processing returns to the client
the load balancer to Layer packet header change, must be in a broadcast domain between the load balancer and the RS
may also be understood as a simple switch on the same
advantages: and TUN (tunnel mode), as only the load balancer to distribute the request, a response packet the method returns through a separate route to the client
in comparison with VS-TUN, VS-DR tunnel structure does not require such an implementation, the operating system can be used most as a physical server.
:( shortcomings can not say shortcomings, can only be said to be inadequate) requires the card must load balancer on the physical network card in a physical segment.

16, how to locate the mysql innodb lock problem, how mysql reducing latency from the master copy?
How to locate the mysql innodb lock problem:
when using the show engine innodb status check engine status, we found a deadlock
in 5.5, information_schema library added three tables on the lock (MEMORY engine)
innodb_trx ## currently running all transaction
innodb_locks ## lock is currently appearing
correspondence between innodb_lock_waits ## lock wait

How to reduce the mysql master-slave replication latency:
if the delay is relatively large, it confirms the following factors:

From the library hardware is worse than the main library, leading to replication latency
master copy from a single-threaded, if the main library to write complicated by too much, too late from the library will be transferred to the cause delays.
Later versions can support multi-threaded replication mysql
slow SQL statements excessive
network latency
master load, the main library reading and writing pressure, leading to replication latency, front-end architecture to add buffer and buffer layers
slave load, the general practice is to use more than sharing a read request to the slave station, and then take a dedicated server from the slave, only as a backup without performing any other additional operation, two parameters can reduce delay:. -slave-net-timeout = seconds unit the default setting is 3600 seconds seconds
Definition: when the slave to read log data from the primary database fails, how long to wait to re-establish the connection and data acquisition

-Master-connect-retry = seconds seconds with a default of 60 seconds
Definition: re-established when the master-slave connection, if the connection establishment fails, the long retry interval

Usually two or more parameters can be configured to reduce the problems caused by the primary network synchronization delay data from the
MySQL database master-slave synchronization delay solutions
easiest slave synchronization delay reduction program is to do optimization on the architecture, try to make the main library DDL fast execution , there is the main library is written, data security is high, such as sync_binlog = 1, innodb_flush_log_at_trx_commit = 1 is set and the like, while the slave you do not need such a high data security, can speak sync_binlog set to zero or close binlog , innodb_flushlog can also be set to 0 to improve the efficiency of sql. The other is to use the library better than the main hardware devices as slave

17, how to reset mysql root password?

First, in the case where ROOT MYSQL database known to the user password, the password modification methods:
1, at SHELL environment, using the command set mysqladmin:
mysqladmin -u -p the root password "New Password" enter the old password after the transport requirements

2, the mysql> environment, using the update command, update data directly mysql database user table:
the Update the mysql.user SET password = password ( 'new password') WHERE user = 'the root';
the flush privileges;
Note: mysql statement to semicolon ";" end

3, in the mysql> environment, use the grant command to modify the authorization privileges of the root user.
. grant all on to root @ ' localhost' identified by ' new password';

Second, as the investigation forget ROOT users mysql database password, and how to do it? As follows:
1, close the program currently running mysqld service: service mysqld stop (the first will add mysqld as a system service)
2, using mysqld_safe script in safe mode (no load Authorization Form) start mysqld service
/ usr / local / mysql / bin / the mysqld_safe --skip-Grant &-Table
. 3, empty root user password database, the user's password reset rOOT
#mysql -u root
Mysql> the Update the mysql.user sET password = password ( 'new password') where user = 'the root';
Mysql> the flush privileges;

18, lvs / nginx / haproxy advantages and disadvantages of
the advantages of Nginx are:
1, work on the seven layers of the network, you can do some diversion policy for http applications, such as for the domain name, directory structure, it is more the rule than the regular HAProxy one of the powerful and flexible, which is the main reason it is now widely popular, Nginx this in itself can take advantage of the occasion to far more than the LVS.

2, Nginx dependence on the stability of the network is very small, in theory, be able to ping you will be able to load functions, this is one of its strengths, contrary LVS relatively large dependence on the stability of the network, this point I fully understood;

3, Nginx is relatively simple to install and configure, test more convenient, it can basically wrong with the log print out, LVS configuration, testing would take a long time, LVS relatively large dependence on the network.

4, and can take the higher load pressure is stable, the difference in the hardware does not support a case generally tens of thousands of times the amount of concurrent load is relatively smaller than those LVS.

5, Nginx be inside the server through the port failure is detected, such as web server processing according to the status code returned, to time out, and will return an error to resubmit the request to another node, but which do not support the drawback is detected url . For example, the user is uploading a file, and upload just the processing node failure during the upload process, Nginx will cut uploaded to another server re-processing, and LVS directly cut off, if it is to upload a large file or important documents, users may therefore dissatisfied.

6, Nginx is not just a good load balancer / reverse proxy software, it is also a powerful Web application server, LNMP in recent years, is also very popular web framework, stability in high-traffic environments very it is good.

7, Nginx now as a reverse Web caching to accelerate more and more mature, and speed faster than traditional Squid server, consider using it as a reverse proxy accelerator

8, Nginx reverse proxy can be used as a mid-level, this level Nginx essentially unopposed, the only possible comparison is only lighttpd Nginx, but lighttpd Nginx do not yet fully functional, configuration is not so clear and easy to read, community information is also far from active Nginx

9, Nginx also be used as static pages and pictures server, performance in this area and no opponents. There Nginx community is very active, there are many third-party modules

Nginx drawback is that:
1, Nginx only supports http, https and Email protocols, so the smaller the scope of the above, this is its shortcomings
2, health checks of the backend server supports only be detected through the port, not support detected by url
does not support direct keep the Session, but it can be solved ip_hash

LVS: clustering the Linux kernel to achieve a high performance, highly available server load balancing, it has good scalability (Scalability), reliability (Reliability) and manageability (the Manageability)
advantage is that LVS:
1, anti- load capacity, is working on the 4th floor of the distribution network for use only, no traffic, this feature also determines its strongest performance, memory and cpu resource consumption in the load balancing software where relatively low

2, the configuration is relatively low, which is a disadvantage is also an advantage, because there is really nothing much to configure, it does not take much in contact, greatly reducing the chance of human error

3, stable, because of its strong anti-load capacity itself, itself a complete dual-Redundancy, as LVS + Keepalived, but we are still the most used embodiment LVS / DR + Keepalived project

4, no traffic, LVS distribute only request, but does not flow out of itself, this is to ensure that the performance of the equalizer IO will not receive a large flow of influence.
5, wide range of applications, because LVS work in four layers, so it can do load balancing for almost all applications, including http, databases, online chat rooms, etc.

LVS disadvantages are:
1, the software itself does not support regular expression processing, do not separate movement
and now many sites in this area have a strong demand, this is Nginx / HAProxy + Keepalived the advantages
2, if a Web application relatively large, then, LVS / DR + Keepalived implement more complicated, there are machines Windows Server particular behind the words, if the implementation and configuration as well as the maintenance process is more complicated, relatively speaking, Nginx / HAProxy + Keepalived much easier a.

HAProxy is characterized by:
1, HAProxy also supports virtual hosts.
2, the advantages of HAProxy can add some shortcomings Nginx, such as support Session remains to guide Cookie, while supporting the state to detect the back-end server by obtaining specified url
3, HAProxy similar with LVS, itself just a load balancing software, simple HAProxy than Nginx have in terms of efficiency from better load balancing speed on the concurrent processing is superior to the Nginx
4, HAProxy TCP protocol supports load balancing forwarding, load balance MySQL can read on the back end MySQL node detection and load balancing, you can use LVS + Keepalived to do load balancing MySQL master-slave
5, HAProxy load balancing strategy very much, HAProxy load balancing algorithm is now specific there are eight types:
①roundrobin, represents a simple poll, this much said, this is a load balancing basically have;
② static-rr, expressed according to the weight, the proposed attention;
③leastconn, represents the minimum connection, first treatment, the proposed attention;
④ source, shows a request source IP, this with Nginx the IP_hash similar mechanism
we use it as a way to solve the problem of session , Proposes a focus;
⑤ri, shows a request URI;
⑥rl_param, according to URl parameter represents the request 'Balance url_param' AN The requires the URL of the Parameter name;
⑦hdr (name), shows a HTTP request to lock up every HTTP request;
⑧rdp-the cookie (name), according to data representation to lock cookie (name) and TCP hash every request.

. 19, the data backup tool mysql
mysqldump tool, carrying the mysql mysqldump backup tool, the following directory listings bin: / usr / local / mysql / bin / mysqldump, innodb supports hot backup, but because it is logical backup, the speed not very fast, the backup data is relatively small for the scene, Mysqldump full backup + binary log recovery point can be achieved based on the time.
LVM snapshot-based backups
in physical backup, there is a physics-based backup of the file system (LVM snapshots) can be directly used commands like tar the entire database directory
to package a backup, but these can only be backed Ling, different storage not the same engine backup, myisam automatically backed up to the table level
and innodb not open a separate table space, then only back up the entire database.

Backup tar package

xtrabackup percona provide tools to support physical innodb hot backup support full backup, incremental backup, and very fast, due to storage innodb support data migration between different databases, the machine supported from the backup copy mode is backup and recovery recovery, in order to allow xtrabackup support more extensions, you can set up a separate table space, open innodb_file_per_table function is enabled after the backup can support a separate table

20, keepalive works and how to do health checks
keepalived is to achieve VRRP protocol-based, VRRP stands for Virtual Router Redundancy Protocol, or virtual routing redundancy protocol.
Virtual routing redundancy protocol, protocol router can be considered to achieve high availability, N sets about to routers provide the same functionality of a router group
this group which has a master and multiple backup, there is a master above the external service provider vip (the LAN router is located within the
default route for the other machines vip), master will send multicast, when the backup does not receive packets vrrp considers that the master dawdle out
then you need a backup when the master of a priority of VRRP election. This ensures high availability of the router

keepalived there are three main modules, namely core, check and vrrp. keepalived core module as the core, the main process responsible for initiating, maintaining and global configuration files are loaded and parsed. check responsible for health checks, including a variety of common inspection methods, vrrp VRRP module is to achieve agreement

Keepalived health check arranged
HTTP_GET | SSL_GET
HTTP_GET | SSL_GET
{
url {
path / # the HTTP / inspection of the SSL url may be a plurality of
digest information of the digest # HTTP / SSL inspection tool genhash generating
status_code 200 # HTTP / SSL returned check status code
}
connect_port port # 80
the bindto
connect_timeout The connection time. 3 #
nb_get_retry 3 # reconnect times
delay_before_retry 2 # connection interval
}
source:
http://www.yunweipai.com/archives/27983.html

Guess you like

Origin www.cnblogs.com/Juvenile/p/12602858.html