In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the principle of building MMM scheme and MMM architecture. The MMM scheme is not suitable for businesses that require high data consistency. Let's learn together. First, let's take a look at the specific architecture topology, as follows:
Among them
Role HostsIP address Application attribute VIPmaster1master192.168.142.135write192.168.142.188master2backup192.168.142.132write | read192.168.142.188slave1slave192.168.142.136read192.168.142.200, 192.168.142.210slave2slave192.168.142.137read192.168.142.200, 192.168.142.210monitormonitor192.168.142.143moitor No VIP specific configuration step 1. Configuration of experimental environment
Configure ALI cloud source (skip if installed)
Master1 is used as an example here, and all five of them need to be installed.
[root@master1 ~] # wget-O / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo[root@master1 ~] # yum-y install epel-release [root@master1 ~] # yum clean all & & yum makecache
Install MySQL for all master and slave servers and configure
[root@master1 ~] # yum install mysql-y [root@master1 ~] # vim / etc/my.cnf # modify configuration file # # server id cannot be the same server-id = log-bin = zhu-bin log-slave-updates = ture # # enable master-slave synchronization sync_binlog = 1 # # write auto_increment_increment=2 # increment to 2 auto immediately The starting value of _ increment_offset=1 # is 1 [root@master1 ~] # systemctl restart mysqld [root@master1 ~] # systemctl enable mysqld 2. Configure master master synchronization (two master servers replicate each other Level with each other)
M1 gives m2 subordinate permissions, m2 gives M1 subordinate permissions
[root@master1 ~] # mysql-u root-pgrant replication slave on *. * to 'myslave'@'192.168.142.%' identified by' asd123'; # allows the slave server to use the myslave account to copy on the master server (both masters are authorized) show master status +-- + | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +-- -+ | mysql_bin.000001 | 245 | | mysql Information_schema | +-+ 1 row in set (0.00 sec) # View the information as the master server The key points are position number, change master to master_host=' master server address', master_user='myslave',master_password='asd123',master_log_file='File',master_log_pos=position number. # # Grant permission (M1 is the master of m2, m2 is the master of M1) start slave;show slave status\ G Slave_IO_Running: Yes Slave_SQL_Running: Yes # check whether the information of the slave server is enabled synchronously. Third, perform master-slave synchronization (two slaves mean the same master)
Configure two servers to point to master1
[root@slave1 ~] # vim / etc/my.cnf server-id = 6 # cannot have the same log-bin=mysql-bin log-slave-updates=ture sync_binlog = 1 [root@slave1 ~] # systemctl restart mysqld [root@slave1 ~] # netstat-atnp | grep 3306tcp6 00: 3306: * LISTEN 38831/mysqld# raises the weight and points to master1 (the slave operation of the two servers is the same! ) [root@slave1 ~] # mysql-uroot-pchange master to master_host=' master server address', information found by master_user='myslave',master_password='asd123',master_log_file=' master server', master_log_pos= number; # # Grant permissions (slave1, slave2 are slaves of master1) start slave Show slave status\ G Slave_IO_Running: Yes Slave_SQL_Running: Yes # check whether the slave server is enabled synchronously. IV. Install and configure MMM on all servers
Modify mmm_common configuration file
[root@master1 ~] # yum-y install mysql-mmm*# modifies MMM configuration file [root@master1 ~] # vim / etc/mysql-mmm/mmm_common.confcluster_interface ens33.replication_user myslave # access master server account replication_password asd123agent_user mmm_user # MMM user account agent_password 123123 ip 192.168.142.135 # IP address of master1 mode master peer db2 ip 192.168.142.132 # IP address of master2 mode master peer db1 ip 192.168.142.136 # slave1 IP address mode slave ip 192.168.142.137 # slave2 IP address mode slave hosts db1 Db2 ips 192.168.142.188 # # VIP virtual IP address mode exclusive hosts db3, db4 ips 192.168.142.200, 192.168.142.210 # VIP virtual IP address mode balanced#scp remote replication Remote push [root@master1 ~] # scp / etc/mysql-mmm/mmm_common.conf root@192.168.142.132:/etc/mysql-mmm/ [root@master1 ~] # scp / etc/mysql-mmm/mmm_common.conf root@192.168.142.136:/etc/mysql-mmm/ [root@master1 ~] # scp / etc/mysql-mmm/mmm_common.conf root@192.168.142.137:/etc/mysql-mmm/ [root] will be configured @ master1 ~] # scp / etc/mysql-mmm/mmm_common.conf root@192.168.142.143:/etc/mysql-mmm/
Modify mmm_monitor configuration file (monitor listener only)
[root@localhost] # vim / etc/mysql-mmm/mmm_mon.conf. Ping_ips 192.168.142.135192.168.142.132192.168.142.136192.168.142.137 # all master and slave server IP addresses auto_set_online 5 # waiting time monitor_user mmm_monitor # # create monitoring user monitor_password 123123
Lift rights in all master-slave databases (MMM users, monitoring users)
[root@master1] # mysql-u root-pgrant super,replication client,process on *. * to 'mmm_user'@'192.168.142.%' identified by' 123123 grant replication client on *. * to 'mmm_monitor'@'192.168.142.%' identified by' 123123 grant privileges## every master and slave should claim the right.
Modify the agant configuration file (every master and slave must modify it)
Location: / etc/mysql-mmm/mmm_agent.conf
[root@master1 ~] # vim / etc/mysql-mmm/mmm_agent.confthis db1 (corresponding role) 5. Enable the service
All master and slave servers turn on mmm_agant service
[root@master1 ~] # systemctl start mysql-mmm-agent.service [root@master1 ~] # systemctl enable mysql-mmm-agent.service
The monitoring side opens the mmm_monitor service.
[root@localhost ~] # systemctl stop firewalld.service [root@localhost ~] # setenforce 0 [root@localhost ~] # systemctl start mysql-mmm-monitor.service [root@localhost ~] # mmm_control show # # View the monitoring status 6. Verify the result [root@localhost mysql-mmm] # mmm_control show db1 (192.168.142.135) master/ONLINE. Roles: writer (192.168.18.250) db2 (192.168.142.132) master/ONLINE. Roles: db3 (192.168.142.136) slave/ONLINE. Roles: reader (192.168.18.251) db4 (192.168.142.137) slave/ONLINE. Roles: reader (192.168.18.252) / / adjust the virtual IP to switch to master2: [root@localhost mysql-mmm] # mmm_control move_role writer db2OK: Role 'writer' has been moved from' db1' to 'db2'. Now you can wait some time and check new roles info! [root@localhost mysql-mmm] # mmm_control show db1 (192.168.142.135) master/ONLINE. Roles: db2 (192.168.142.132) master/ONLINE. Roles: writer (192.168.18.250) db3 (192.168.142.136) slave/ONLINE. Roles: reader (192.168.18.251) db4 (192.168.142.137) slave/ONLINE. Roles: reader (192.168.18.252) / / check whether all states are normal: [root@localhost mysql-mmm] # mmm_control checks alldb4 ping [last change: 15:25:54 on 2019-11-25] OKdb4 mysql [last change: 15:25:54 on 2019-11-25] OKdb4 rep_threads [last change: 15:25:54 on 2019-11-25] OKdb4 rep_backlog [last change: 2019-11-25 15: 25:54] OK: Backlog is nulldb2 ping [last change: 2019-11-25 15:25:54] OKdb2 mysql [last change: 2019-11-25 15:25:54] OKdb2 rep_threads [last change: 2019-11-25 15:25:54] OKdb2 rep_backlog [last change: 2019-11-25 15:25:54] OK: Backlog is nulldb3 ping [last change: 2019-11-25 15:25:54] OKdb3 mysql [last change: 2019-11-25 15:25:54] OKdb3 rep_threads [last change: 2019-11-25 15:25:54] OKdb3 rep_backlog [last change: 2019-11-25 15:25:54] OK: Backlog is nulldb1 ping [last change: 2019-11-25 15:25:54] OKdb1 mysql [last change: 2019-11-25 15:25:54] OKdb1 rep_threads [last Change: 15:25:54 on 2019-11-25] OKdb1 rep_backlog [last change: 15:25:54 on 2019-11-25] OK: Backlog is null is the whole process of building a MMM cluster. Thank you for reading!
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.