In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Environment: 192.168.205.17: as master www.example.com: as middle www.example.com: as slave server Version: OS: centos 7 1810 with mini installmariadb-5.5.60 Destination:
If in a production environment there may be a master server, which is also a read-write server, and there may be multiple slaves, but this master server will degrade with the increase of slaves, so it is best that the master server only has one slave, and the other slaves replicate from this slave server to reduce the pressure on the master server, so that intermediate servers are dedicated to replication to minimize the impact on the performance of the master server.
Steps: Configure Primary Backup Intermediate Server Configure Secondary Test Configure Primary Install three servers [root@centos7~]#yum install mariadb-server [root@centos7~]#mkdir/data/{mysql, logs}[root@centos7~]#chown mysql: mysql/data/{mysql, logs} Modify Primary Configuration File [root@master~]#vi/etc/my. cnf [mysqld] log-bin =/data/logs/bindatadir =/data/mysqlserver-id = 17 Restart service [root@master~]#systemctl start mariadb Load a test database [root@master~]#mysql
< hellodb_innodb.sql 创建复帽帐号MariaDB [(none)]>grant replication slave on *.* to repluser@'192.168.205.% 'identified by' centos '; Backup database and copy to intermediate node [root@master~]#mysqldump-A--single-transaction--master-data = 1>/data/all. sql [root@master~]#scp/data/all.sql www.example.com Configure intermediate cascade server Set intermediate server [root@middle~]#vi/etc/my.cnf [mysqld] datadir =/data/mysqllog-bin =/data/logs/binserver-id = 27read-onlylog_slave_updates Modified backup data [root@middle~]#vi/data/all.sql CHANGE MASTER TOMASTER_HOST ='192.168.205.17', MASTER_USER ='repluser ', MASTER_PASSWORD ='centos', MASTER_PORT = 3306, import data MariaDB [(none)]> source/data/all. sql Start thread MariaDB [(none)]> start slave; MariaDB [(none)]> show slave status\G *************************** row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 192.168.205.17 Master_User: repluser Master_Port: 3306 Connect_Retry: 60 Master_Log_File: bin.000003 Read_Master_Log_Pos: 7973 Relay_Log_File: mariadb-relay-bin.000004 Relay_Log_Pos: 604 Relay_Master_Log_File: bin.000003 Slave_IO_Running: Yes Slave_SQL_Running: Yes Backup data from intermediate servers,#mysqldump-A--single-transaction--master-data = 1>/data/middle. sql [root@middle~]#scp/data/middle.sql 192@@.168.205.37:/data modify from server modify from server configuration file [root@slave~]#vi/etc/my. cnf [mysqld] datadir =/data/mysqlserver-id = 37read_only modify backed up file middle. sql [root@slave~]#vi/data/middle.sql CHANGE MASTER TO MASTER_HOST ='192.168.205.27', MASTER_USER =' repluser', MASTER_PASSWORD ='centos', MASTER_PORT = 3306, import data and start service [root@slave~]#mysql
< /data/middle.sql [root@slave ~]#systemctl start mariadb启动线程MariaDB [(none)]>start salve; MariaDB [(none)]> show slave status\G*************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 192.168.205.27 Master_User: repluser Master_Port: 3306 Connect_Retry: 60 Master_Log_File: bin.000005 Read_Master_Log_Pos: 326 Relay_Log_File: mariadb-relay-bin.000003 Relay_Log_Pos: 604 Relay_Master_Log_File: bin.000005 Slave_IO_Running: Yes Slave_SQL_Running: Yes test test build database on master server MariaDB [(none)]> create database zhaoli; Query OK, 1 row affected (0.00 sec) View databases in the middle and slave nodes separately, synchronization succeeded MariaDB [(none)]> show databases;+--------------------|Database |+--------------------+| information_schema || db1 || db2 || hellodb || mysql || performance_schema || test || zhaoli |+--------------------+8 rows in set (0.00 sec)
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.