In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Reference document: http://www.178linux.com/60625
Node one
Modify the configuration file to set unique ID to open binary log
[root@node1 ~] # vim / etc/my.cnf add the following: [mysqld] log-bin=master_bin starts binary log server_id=1 to give the master node a unique ID number innodb_file_per_table=on innodb opens an independent tablespace skip_name_resolve=on enables the inverse solution of skipping hostname
Start the service to create an account with remote replication permissions
[root@node1 ~] # service mariadb start [root@node1 ~] # mysqlMariaDB [(none)] > show global variables like'% log%'; check whether binary log _ bin is enabled MariaDB [(none)] > show global variables like'% server%'; check whether the DI number is 1MariaDB [(none)] > show master logs View the location of the primary node binary log, and copy MariaDB [(none)] > grant replication slave,replication client on *. * to 'copy'@'192.168.%.%' identified by' passwd'; from the location of the last log of the primary node and authorize a remote replication account with the copy password of passwdMariaDB [(none)] > flush privileges; refresh user rights Node 2.
Modify the configuration file to set unique ID to start relay log
[root@node2 ~] # vim / etc/my.cnf relay_log=relay_log to start relay log relay-log-index=relay-log.index server_id=2 similarly, you need to set a unique ID number innodb_file_per_table=on skip_name_resolve= on [root @ node2 ~] # service mariadb start [root@node2 ~] # mysqlMariaDB [(none)] > show global variables like'% log%' Check whether relay log relay _ log turns on MariaDB [(none)] > show global variables like'% server%' Check whether the ID number is 2. The primary node is 192.168.1.107, the remote replication account is copy, the password is passwd, and the starting position of the replication binary log is 000003 at MariaDB [(none)] > change master to master_host='192.168.1.107',master_user='copy',master_password='passwd',master_log_file='master_bin.000003',master_log_pos=245;MariaDB [(none)] > start slave. Start the replication thread MariaDB [(none)] > show slave status\ G from the node * * 1. Row * * Slave_IO_State: Waiting for master to send event Master_Host: 192.168.1.107 Master_User: copy Master_Port: 3306 Connect_Retry: 60 Master_Log_File: master_bin.000003 Read_Master_Log_Pos: 491Relay_Log_File: relay_log.000003 Relay_Log_Pos: 776Relay_Master_Log_File: master_bin.000003 Slave_IO_Running: Yes these two items must be yes Slave_SQL _ Running: Yes must be yes Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0 Last_Error: Skip_Counter: 0 Exec_Master_Log_Pos: 491 Relay_Log_Space: 1064 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 0 Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 11 row in set (0.00 sec) Note
If Slave_IO_Running is not the solution for yes
Such as: ERROR 1201 (HY000)
MariaDB [(none)] > slave stop; stop slave node MariaDB [(none)] > reset slave; reset slave node
Find out where there is something wrong with the setting and re-authorize the slave node
MariaDB [(none)] > change master to master_host='192.168.1.107',master_user='copy',master_password='passwd',master_log_file='master_bin.000003',master_log_pos=245;MariaDB [(none)] > start slave; launch slave node MariaDB [(none)] > show slave status\ G; view status
Note that write operations must not be performed on the slave node.
Verification
Primary node
MariaDB [(none)] > create database msdb;MariaDB [msdb] > create table xx (id int (4) not null auto_increment,name varchar (30) not null,primary key (id)) engine=innodb charset=utf8;MariaDB [msdb] > insert into xx (id,name) values
Slave node
MariaDB [(none)] > show databases;+-+ | Database | +-+ | information_schema | | msdb | | mysql | | performance_schema | | test | +-+ MariaDB [(none)] > use msdb;MariaDB [msdb] > show tables +-+ | Tables_in_msdb | +-+ | xx | +-+ MariaDB [msdb] > select * from xx;+----+-+ | id | name | +-- +-+ | 1 | king | +-+-+
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.