In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
One environment preparation 1 environment hostname network card disk mastereth0 bridge mode eth0 (192.168.1.10) custom mode (VMnet2) (192.168.2.10) VIP 192.168.1.200 system disk + 20g external disk slaveeth0 bridge mode (192.168.1.20) eth2 custom mode (VMnet2) (192.168.2.20) VIP 192.168.1.200 system disk + 20g external disk server3eth0 bridge mode Mode (192.168.1.30) system disk
Master
Slave
Server3
2 domain name DNS
3 time synchronization
4 Network card configuration
5 disk condition
6 location of software package
Link: https://pan.baidu.com/s/1W2-jeaK_tc-abvSZzmRaiw
Extraction code: 4evz
Introduction of software installation 1 drbd principle of 1 drbd
Drbd works under the file system and is a block-based migration
Migration of drbd
File system-buffer-cache- Nic is passed to the other end-bare device-drbd writes to disk
Drbd data is divided into two parts, the data storage part and the metadata part.
2 drbd replication mode
Protocol A: after the local write is successful, it will be returned to the client.
Protocol B: semi-synchronous protocol, which is written locally and returned immediately after it is sent to the peer.
Protocol C: sent to the peer and successfully written and cached.
3 the application mode of DRBD
1 single master mode, and active / standby mode, which is a typical high availability lap scheme
2 complex primary mode, which requires a shared cluster file system, such as GFS and OCFS2
4 shortcomings
When one end is running, the other end is invisible.
2 drbd installation
The configuration at both ends is basically the same.
1 disk partition
/ dev/sdb1 is the data area
/ dev/sdb2 is the metadata area
2 formatting
The metadata region cannot be formatted
3 download and unzip and install drbd
A to solve dependency
Yum-y install gcc kernel-devel kernel-headers flex
B compile and install
. / configure-prefix=/usr/local/drbd.8.4.4-with-km-with-heartbeat-sysconfdir=/etc/
Make KDIR=/usr/src/kernels/2.6.32-431.el6.x86_64/
This must be the kernel obtained by your own uname-r, not necessarily the kernel above
Make install
Inspection
4 load the module into the kernel
Slave end loading
5 configuration
Slave end is the same
Related explanation
Global {
Usage-count no
}
Common {
Syncer {
Rate 100m; # bandwidth consumed by synchronization
Verify-alg crc32c; # algorithm used for authentication
}}
# Primary for drbd1
Resource data {
Protocol used by protocol C; # drbd
Disk {
How to handle IO errors in on-io-error detach; #
}
On master {
Devices for device / dev/drbd0; # drbd
Data partition corresponding to disk / dev/sdb1; #
Address 192.168.1.10 address 7788; # address is the IP address that listens to your heartbeat
Meta-disk / dev/sdb2 [0]; # metadata location
}
On slave {
Device / dev/drbd0
Disk / dev/sdb1
Address 192.168.1.20:7788
Meta-disk / dev/sdb2 [0]
}
}
6 initialization data
Where data is the name of the above resource.
7 create a folder
8 start the service
View startup parameters
Explanation of relevant parameters:
Note: it will take effect only when the DRBD of both the master and the standby is started.
Cs: link statu
Ro: role information. The status is Secondary/Secondary, which means that the status of both hosts is standby.
Ds: disk status. The status displayed by Inconsistent/Inconsistent is "inconsistent". This is because DRBD cannot determine which party is the host and which side's disk data should be used as the standard.
Dw: disk write operation
Dr: disk read operation
Ns: network transmission
Nr: network acceptance
If the NS of the active side is the same as the NR of the slave side, it indicates that the sending and receiving are synchronized.
9 the active terminal declares itself to be primary
View synchronization
10 create a mount file and test
Mount synchronization test
Slave test
Restore
3 brief introduction of heartbeat 1 function
Failover and related services can be provided through heartbeat
Switching time is also required during failover, which is usually about 5-20 seconds. But it ensures business consistency.
The high availability of heartbeat is server-level, not service-level. The downmachine of the service will not cause the service to switch.
2 Common conditions for Heartbeat handoff
1 server downmachine
2 heartbeat service itself downmachine
3 heartbeat chain connection downmachine
3 Heartbeat message type
Generally speaking, there are three message types in the working process of Heartbeat high availability software, which are:
1 heartbeat message
More than 150 bytes, which may be unicast, broadcast or multicast, to control the heartbeat frequency and how long to wait for failure to fail over
2 Cluster conversion message
Ip-request and ip-request-resp
When the master server returns to the online state, the standby machine is requested to release the resources obtained by the server when the master server fails through the ip-request message, and then the backup server shuts down and releases the resources and services obtained when the master server fails.
After the server releases the resource service obtained when the master server fails, it will notify the master server through ip-request-resp message that he no longer owns the resources and services of the server. After receiving the notification of ip-request-resp message from the node, the master server will release the resources and services when starting failure, and begin to provide normal access services.
3 retransmission request
Rexmit-request controls the retransmission of heartbeat requests.
All of the above heartbeat control messages use the UDP protocol to send to any interface defined by the / etc/ha.d/ha.cf file, or the specified multicast address.
4 Ip address takeover and failover
Heartbeat fails over through IP address takeover and ARP broadcast
ARP broadcast when the primary server fails, after the standby node takes over, it will immediately force the update of all client local ARP (and clear the resolution records of VIP and MAC addresses of failed servers cached locally by the client) to ensure the dialogue between the client and the new primary server.
4 heartbeat installation 1 install heartbeat
2 copy configuration file
3 configuration
Configure the key and configure its permissions to 600, which must be 600
Configuration file parsing
Debugfile debug log location
Logfile log location
Logfacility local configures in the syslog service to accept logs through the locally device
Keepalive2 specifies a heartbeat interval of 2 seconds
Deadtime 30 specifies that if the standby node does not receive a heartbeat signal that reaches the primary node within 30 seconds, it immediately takes over the service resources of the primary node.
Warntime 10 specifies a heartbeat delay of 10 seconds. When the backup node cannot receive the heartbeat signal of the primary node within 10 seconds, a warning log is written to the log, but the service is not switched at this time.
Initdead 120specifies the resources that need to wait 120 seconds to start the master server after heartbeat is run for the first time. This option is used to solve the time interval caused by this situation. The value is at least twice that of deadtime. It is normal to encounter slow VIP binding when starting a stand-alone machine.
Bcast eth2 indicates that the heartbeat is broadcast over the eth2 interface using Ethernet broadcasting. If two real networks are used to transmit the heartbeat, then bcast eth0 eth2
Mcast eht2 225.0.0.1 694 10 sets the port used for broadcast communication. 694 is the default port, and one is TTL.
Auto_failback on is used to define whether the service is automatically switched back to when the primary node is restored.
Node master host node hostname
Node slave standby node hostname
Whether Crm no enables cluster resource manager (Cluster Resource Manager)
Copy to the passive end
4 start and view
5 combined with DRBD
5 mysql installation 1 configure yum source
2 install mysql
3 configure / data permissions
4 configure mysql profile
5 start mysql
6. Delete mysql on Slave
7 configuration switching
Three configuration mysql hot backup and slave library 1 configuration mysql hot backup 1 replication related configuration
2 shut down mysql and restart the service heartbeat
3 close mater
4 recovery
2 configure master-slave synchronization 1 configure server-id and binary log on
Restart the server
2 configure the export and import of the database to ensure the same master and slave between synchronization
3 configure master-slave synchronization
Grant replication slave on. To admin@'%' identified by 'root123'
Change master to master_host='192.168.1.200',master_user='root',master_password='root123',master_log_file='mysql-bin.000001',master_log_pos=319
This 192.168.1.200 is the VIP of heartbeat and is dedicated to data links.
test
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.