In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Environment: CentOS7.4 x 4mha4mysql-manager x 1mha4mysql-node x 3node Build a master and dual slave mha4mysql Code hosting: https://code.google.com/archive/p/mysql-master-ha/I. Configure MHA:
1. Configure all hosts (including Manager host) to realize that ssh-keys can log in to each other.
When ssh_user in the configuration file is a non-root user: (1) manually create a folder of the node host, and authorize the node host to have the permission of the remote_workdir directory to the ssh_user user;(2) add the user as a MySQL group user, so that it has the permission to read the mysql binary/relay log file and the relay_log.info file;(3) authorize the Mysql log directory to have the permission to write
2. Configure the MHA configuration file and install mha4mysql-manager and mha4mysql-node.
(1)Create and modify the configuration file/etc/mastermha/app1.cnf
#The configuration file can be placed under any path, because the full path needs to be written when the configuration file is called by the later command. [server default]user=mhauser #mysql user password=centos #mysql user password manager_workdir=/data/mastermha/app1/ #Manager host's working directory manager_log=/data/mastermha/app1/manager.log #Manager host logs remote_workdir=/data/mastermha/app1/ #nodo host's working directory ssh_user=root #remote Linux host system user repl_user=repluser #mysql user repl_password=centos used in master-slave replication #mysql password used for master-slave replication ping_interval=1 #Health check interval in seconds [server1]hostname=192.168.1.4 #mysql host IPcandidate_master=1 #Is it a standby master [server2]hostname=192.168.1.6candidate_master=1 #Is it a standby master [server3]hostname=192.168.1.8
(2)Install mha4mysql-manager, mha4mysql-node#Download manager and node in advance, and the versions must be the same!!! To install yum, you need to enable the epel source. yum install mha4mysql-manager-0.55-0.el6.noarch.rpm mha4mysql-node-0.55-0.el6.noarch.rpm II. Main library configuration
(1)Modify mysql configuration file
vi /etc/my.cnf[mysqld]log-binserver_id=1innodb_file_per_tableskip_name_resolve=1
(2)Install mha4mysql-nodeyum install mha4mysql-node-0.55-0.el6.noarch.rpm(3) Create mysql user; master-slave synchronization requires one user, MHA requires one user. #When MHA switches the main database, it needs to modify the global variables of Mysql runtime, so it needs to give all permissions. It is recommended to limit the user's login IP to a specific host. mysql>show master logs; mysql>grant replication slave on *.* to 'repluser'@'192.168.1.% ' identified by 'centos'; mysql>grant all on *.* to 'mhauser'@'192.168.1.% ' identified by 'centos';
III. Slave library 1(standby master library) configuration: (1) modify the configuration file [mysqld]server_id=2 #Backup master library needs to enable binary logging!!! log-bin #Backup master library needs to enable binary logging!!! read_only #Backup master library needs to enable binary logging!!! relay_log_purge=0skip_name_resolve=1 #Disallow name resolution innodb_file_per_table
(2)install mha4mysql-nodeyum install mha4mysql-node-0.55-0.el6.noarch.rpm(3) Set master slave same step mysql>CHANGE MASTER TO MASTER_HOST='192.168.1.4', MASTER_USER='repluser', MASTER_PASSWORD='centos', MASTER_LOG_FILE='mariadb-bin. 00001', MASTER_LOG_POS=245;
IV. Configuration from library 2:(1) Modify the configuration file [mysqld]server_id=3read_onlyrelay_log_purge=0skip_name_resolve=1 #Disallow name resolution innodb_file_per_table
(2)install mha4mysql-nodeyum install mha4mysql-node-0.55-0.el6.noarch.rpm(3) Set master slave same step mysql>CHANGE MASTER TO MASTER_HOST='192.168.1.4', MASTER_USER='repluser', MASTER_PASSWORD='centos', MASTER_LOG_FILE='mariadb-bin. 00001', MASTER_LOG_POS=245;
(1) Check SSH connection masterha_check_ssh --conf=/etc/mastermha/app1.cnf
(2)Check node masterha_check_repl --conf=/etc/mastermha/app1.cnf
(3)Start the script and exit when it detects that the master library cannot be connected, and promote the slave library to the master library.
masterha_manager --conf=/etc/mastermha/app1.cnf Error log: /data/mastermha/app1/manager.log When MHA frequently switches the main database in a short time, it may report an error. Delete/data/mastermha/app1/app1.failover.complete!
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.