In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you how to configure Keepalived+Mysql master copy, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Installation environment:
HostnameIPvirtual IPD2-TYMYSQL51192.168.12.51192.168.12.50D2-TYMYSQL52192.168.12.52
Software package:
Keepalived-1.3.5.tar.gz
Mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz
Node 51 deployment
(1) Environmental confirmation
[root@D2-TYMYSQL51 ~] # cat / etc/centos-release
CentOS Linux release 7.2.1511 (Core)
[root@D2-TYMYSQL51 ~] # hostnamectl status
Static hostname: D2-TYMYSQL51
Icon name: computer-vm
Chassis: vm
Machine ID: 4ff908d829c546f8a037b61638b50e43
Boot ID: 43cbb3326cd646f9aaa40b63c77384b5
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.el7.x86_64
Architecture: x86-64
[root@D2-TYMYSQL51 ~] # cat / etc/hosts
192.168. D2-
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.12.51 D2-TYMYSQL51
[root@D2-TYMYSQL51 ~] # systemctl status firewalld
● firewalld.service-firewalld-dynamic firewall daemon
Loaded: loaded (/ usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
[root@D2-TYMYSQL51 ~] # getenforce
Disabled
(2) install the database
Refer to http://blog.itpub.net/28536251/viewspace-2138854/ to install Mysql and note the location of the directory.
[root@D2-TYMYSQL51 ~] # ps-ef | grep mysql
Root 31799 10 11:16 pts/0 00:00:00 / bin/sh / opt/mysql/bin/mysqld_safe-- datadir=/opt/mysql/data-- pid-file=/opt/mysql/data/D2-TYMYSQL51.pid
Mysql 32214 31799 37 11:16 pts/0 00:00:10 / opt/mysql/bin/mysqld-basedir=/opt/mysql-datadir=/opt/mysql/data-plugin-dir=/opt/mysql/lib/plugin-user=mysql-log-error=/var/log/mysqld.log-pid-file=/opt/mysql/data/D2-TYMYSQL51.pid
Root 32754 30568 0 11:17 pts/0 00:00:00 grep-color=auto mysql
[root@D2-TYMYSQL51 ~] # rm-fr / opt/mysql/data/auto.cnf
[root@D2-TYMYSQL51 ~] # / etc/init.d/mysqld restart
Shutting down MySQL. SUCCESS!
Starting MySQL.. SUCCESS!
(3) Master-slave configuration
[root@D2-TYMYSQL51 ~] # vim / etc/my.cnf
[root@D2-TYMYSQL51 ~] # cat / etc/my.cnf
[mysqld]
Server-id = 1251
Character-set-server=utf8
Binlog_format=mixed
Log-bin=/opt/mysql/log/binlog
Binlog-ignore-db=mysql,information_schema
Auto-increment-increment=2
Auto-increment-offset=1
Slave-skip-errors=all
Relay-log-index = / opt/mysql/log/relaylog
Relay-log-info-file = / opt/mysql/log/relaylog
Relay-log = / opt/mysql/log/relaylog
Slow-query-log
Long_query_time=3
Log-output=TABLE
Expire_logs_days = 7
Basedir=/opt/mysql
Datadir=/opt/mysql/data
Event_scheduler=1
Innodb_file_per_table=1
Innodb_log_file_size=536870912
Innodb_buffer_pool_size=1073741824
Max_binlog_size=1073741824
Log_bin_trust_function_creators=1
Innodb_stats_on_metadata=0
Max_connect_errors = 1000000
Max_connections = 5000
Skip_name_resolve = 1
Symbolic-links=0
[mysql]
Default-character-set=utf8
[mysqld_safe]
Log-error=/var/log/mysqld.log
Pid-file=/var/run/mysqld/mysqld.pid
[root@D2-TYMYSQL51 ~] # / etc/init.d/mysqld restart
Shutting down MySQL. SUCCESS!
Starting MySQL.. SUCCESS!
[root@D2-TYMYSQL51] # / opt/mysql/bin/mysql-uroot-p123456
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 3
Server version: 5.6.22-log Source distribution
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
Mysql > show master status
+-+ +
| | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | |
+-+ +
| | binlog.000003 | 120 | | mysql,information_schema |
+-+ +
1 row in set (0.00 sec)
Mysql > grant replication slave on *. * to 'replication'@'192.168.12.%' identified by' replication'
Query OK, 0 rows affected (0.00 sec)
Mysql > grant replication slave on *. * to 'root'@'192.168.12.%' identified by' 123456'
Query OK, 0 rows affected (0.00 sec)
Mysql > grant all privileges on *. * to 'root'@'192.168.12.%' identified by' 123456 'with grant option
Query OK, 0 rows affected (0.00 sec)
Mysql > flush privileges
Query OK, 0 rows affected (0.00 sec)
Mysql > change master to master_host='192.168.12.52',master_user='replication',master_password='replication',master_log_file='binlog.000003',master_log_pos=637
Query OK, 0 rows affected, 2 warnings (0.00 sec)
Mysql > start slave
Query OK, 0 rows affected (0.00 sec)
Mysql > show slave status\ G
* * 1. Row *
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.12.52
Master_User: replication
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binlog.000004
Read_Master_Log_Pos: 120
Relay_Log_File: relaylog.000005
Relay_Log_Pos: 280
Relay_Master_Log_File: binlog.000004
Slave_IO_Running: Yes
Slave_SQL_Running: 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: 120
Relay_Log_Space: 606
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: 0
Master_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: 1252
Master_UUID: e3b13736-7258-11e5-b726-005056a70ab8
Master_Info_File: / opt/mysql/data/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
1 row in set (0.00 sec)
(4) Master-slave test
Main library:
Mysql > create database test
Query OK, 1 row affected (0.00 sec)
Mysql > use test
Database changed
Mysql > create table usr (number int (10), name varchar (255))
Query OK, 0 rows affected (0.01 sec)
Mysql > insert into usr values (01jinghuaa')
Query OK, 1 row affected (0.00 sec)
From the library:
Mysql > use test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-A
Database changed
Mysql > show tables
+-+
| | Tables_in_test |
+-+
| | usr |
+-+
1 row in set (0.00 sec)
Mysql > select * from usr
+-+ +
| | number | name |
+-+ +
| | 1 | aa |
+-+ +
1 row in set (0.00 sec)
Delete the test database after confirming that the synchronization is normal:
Mysql > drop database test
Query OK, 1 row affected (0.00 sec)
(5) install keepalived
[root@D2-TYMYSQL51 ~] # yum install-y pcre-devel openssl-devel popt-devel gcc
[root@D2-TYMYSQL51 ~] # tar-xvzf keepalived-1.3.5.tar.gz
[root@D2-TYMYSQL51 ~] # cd keepalived-1.3.5/
[root@D2-TYMYSQL51 keepalived-1.3.5] #. / configure-prefix=/usr/local/keepalived
[root@D2-TYMYSQL51 keepalived-1.3.5] # make & & make install
[root@D2-TYMYSQL51 keepalived-1.3.5] # cp / usr/local/keepalived/etc/sysconfig/keepalived / etc/sysconfig/
[root@D2-TYMYSQL51 keepalived-1.3.5] # mkdir / etc/keepalived
[root@D2-TYMYSQL51 keepalived-1.3.5] # cp / usr/local/keepalived/etc/keepalived/keepalived.conf / etc/keepalived/
[root@D2-TYMYSQL51 keepalived-1.3.5] # cp / usr/local/keepalived/sbin/keepalived / usr/sbin/
[root@D2-TYMYSQL51 keepalived-1.3.5] # vim / etc/keepalived/keepalived.conf
[root@D2-TYMYSQL51 keepalived-1.3.5] # cat / etc/keepalived/keepalived.conf
! Configuration File for keepalived
Global_defs {
Notification_email {
Acassen@firewall.loc
Failover@firewall.loc
Sysadmin@firewall.loc
}
Notification_email_from Alexandre.Cassen@firewall.loc
Smtp_server 127.0.0.1
Smtp_connect_timeout 30
Router_id mysql01
}
Vrrp_instance mysql01 {
State BACKUP
Interface eno16777984
Virtual_router_id 50
Priority 100
Advert_int 5
Nopreempt
Authentication {
Auth_type PASS
Auth_pass 123456
}
Virtual_ipaddress {
192.168.12.50
}
}
Virtual_server 192.168.12.50 3306 {
Delay_loop 2
Lb_algo wrr
Lb_kind DR
Persistence_timeout 60
Protocol TCP
Real_server 192.168.12.51 3306 {
Weight 3
Notify_down / usr/local/keepalived.sh
TCP_CHECK {
Connect_timeout 10
Nb_get_retry 3
Delay_before_retry 3
Connect_port 3306
}
}
}
[root@D2-TYMYSQL51 keepalived-1.3.5] # vim / usr/local/keepalived.sh
[root@D2-TYMYSQL51 keepalived-1.3.5] # cat / usr/local/keepalived.sh
#! / bin/bash
Pkill keepalived
[root@D2-TYMYSQL51 keepalived-1.3.5] # chmod + x / usr/local/keepalived.sh
[root@D2-TYMYSQL51 keepalived-1.3.5] # / usr/local/keepalived/sbin/keepalived-D-d-S 0
[root@D2-TYMYSQL51 keepalived-1.3.5] # ps-ef | grep keepalived
Root 17727 10 16:07? 00:00:00 / usr/local/keepalived/sbin/keepalived-D-d-S 0
Root 17728 17727 0 16:07? 00:00:00 / usr/local/keepalived/sbin/keepalived-D-d-S 0
Root 17729 17727 0 16:07? 00:00:00 / usr/local/keepalived/sbin/keepalived-D-d-S 0
Root 17745 10101 0 16:08 pts/0 00:00:00 grep-color=auto keepalived
Node 52 deployment
(1) Environmental confirmation
[root@D2-TYMYSQL52 ~] # cat / etc/centos-release
CentOS Linux release 7.2.1511 (Core)
[root@D2-TYMYSQL52 ~] # hostnamectl status
Static hostname: D2-TYMYSQL52
Icon name: computer-vm
Chassis: vm
Machine ID: 4ff908d829c546f8a037b61638b50e43
Boot ID: 458ee453a718418daf05dea5cac4788b
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.el7.x86_64
Architecture: x86-64
[root@D2-TYMYSQL52 ~] # cat / etc/hosts
192.168. D2-
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.12.52 D2-TYMYSQL52
[root@D2-TYMYSQL52 ~] # systemctl status firewalld
● firewalld.service-firewalld-dynamic firewall daemon
Loaded: loaded (/ usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
[root@D2-TYMYSQL52 ~] # getenforce
Disabled
(2) Database installation
Refer to http://blog.itpub.net/28536251/viewspace-2138854/ to install Mysql and note the location of the directory.
[root@D2-TYMYSQL52 ~] # ps-ef | grep mysql
Root 30967 0 11:28 pts/0 00:00:00 grep-color=auto mysql
Root 32212 10 11:28 pts/0 00:00:00 / bin/sh / opt/mysql/bin/mysqld_safe-- datadir=/opt/mysql/data-- pid-file=/opt/mysql/data/D2-TYMYSQL52.pid
Mysql 32627 32212 33 11:28 pts/0 00:00:10 / opt/mysql/bin/mysqld-basedir=/opt/mysql-datadir=/opt/mysql/data-plugin-dir=/opt/mysql/lib/plugin-user=mysql-log-error=/var/log/mysqld.log-pid-file=/opt/mysql/data/D2-TYMYSQL52.pid
(3) Master-slave configuration
[root@D2-TYMYSQL52 ~] # vim / etc/my.cnf
[root@D2-TYMYSQL52 ~] # cat / etc/my.cnf
[mysqld]
Server-id = 1252
Character-set-server=utf8
Binlog_format=mixed
Log-bin=/opt/mysql/log/binlog
Binlog-ignore-db=mysql,information_schema
Auto-increment-increment=2
Auto-increment-offset=2
Slave-skip-errors=all
Relay-log-index = / opt/mysql/log/relaylog
Relay-log-info-file = / opt/mysql/log/relaylog
Relay-log = / opt/mysql/log/relaylog
Slow-query-log
Long_query_time=3
Log-output=TABLE
Expire_logs_days = 7
Basedir=/opt/mysql
Datadir=/opt/mysql/data
Event_scheduler=1
Innodb_file_per_table=1
Innodb_log_file_size=536870912
Innodb_buffer_pool_size=1073741824
Max_binlog_size=1073741824
Log_bin_trust_function_creators=1
Innodb_stats_on_metadata=0
Max_connect_errors = 1000000
Max_connections = 5000
Skip_name_resolve = 1
Symbolic-links=0
[mysql]
Default-character-set=utf8
[mysqld_safe]
Log-error=/var/log/mysqld.log
Pid-file=/var/run/mysqld/mysqld.pid
[root@D2-TYMYSQL52 ~] # / etc/init.d/mysqld restart
Shutting down MySQL.. SUCCESS!
Starting MySQL.. SUCCESS!
[root@D2-TYMYSQL52] # / opt/mysql/bin/mysql-uroot-p123456
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 2
Server version: 5.6.22-log Source distribution
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
Mysql > grant replication slave on *. * to 'replication'@'192.168.12.%' identified by' replication'
Query OK, 0 rows affected (0.00 sec)
Mysql > grant replication slave on *. * to 'root'@'192.168.12.%' identified by' 123456'
Query OK, 0 rows affected (0.00 sec)
Mysql > flush privileges
Query OK, 0 rows affected (0.00 sec)
Mysql > show master status
+-+ +
| | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | |
+-+ +
| | binlog.000003 | 637 | | mysql,information_schema |
+-+ +
1 row in set (0.00 sec)
Mysql > change master to master_host='192.168.12.51',master_user='replication',master_password='replication',master_log_file='binlog.000003',master_log_pos=120
Query OK, 0 rows affected, 2 warnings (0.01 sec)
Mysql > start slave
Query OK, 0 rows affected (0.00 sec)
Mysql > show slave status\ G
* * 1. Row *
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.12.51
Master_User: replication
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binlog.000004
Read_Master_Log_Pos: 120
Relay_Log_File: relaylog.000004
Relay_Log_Pos: 280
Relay_Master_Log_File: binlog.000004
Slave_IO_Running: Yes
Slave_SQL_Running: 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: 120
Relay_Log_Space: 1351
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: 0
Master_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: 1251
Master_UUID: baf1f004-3471-11e7-ae2b-0050568a1967
Master_Info_File: / opt/mysql/data/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
1 row in set (0.01 sec)
(4) Master-slave test
Main library:
Mysql > create database test
Query OK, 1 row affected (0.00 sec)
Mysql > use test
Database changed
Mysql > create table usr (number int (10), name varchar (255))
Query OK, 0 rows affected (0.00 sec)
Mysql > insert into usr values (01jinghuaa')
Query OK, 1 row affected (0.00 sec)
From the library:
Mysql > use test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-A
Database changed
Mysql > show tables
+-+
| | Tables_in_test |
+-+
| | usr |
+-+
1 row in set (0.00 sec)
Mysql > select * from usr
+-+ +
| | number | name |
+-+ +
| | 1 | aa |
+-+ +
1 row in set (0.00 sec)
Delete the test database after confirming that the synchronization is normal:
Mysql > drop database test
Query OK, 1 row affected (0.00 sec)
(5) install keepalived
[root@D2-TYMYSQL52 ~] # yum install-y pcre-devel openssl-devel popt-devel gcc
[root@D2-TYMYSQL52 ~] # tar-xvzf keepalived-1.3.5.tar.gz
[root@D2-TYMYSQL52 ~] # cd keepalived-1.3.5/
[root@D2-TYMYSQL52 keepalived-1.3.5] #. / configure-prefix=/usr/local/keepalived
[root@D2-TYMYSQL52 keepalived-1.3.5] # make & & make install
[root@D2-TYMYSQL52 keepalived-1.3.5] # cp / usr/local/keepalived/etc/sysconfig/keepalived / etc/sysconfig/
[root@D2-TYMYSQL52 keepalived-1.3.5] # mkdir / etc/keepalived
[root@D2-TYMYSQL52 keepalived-1.3.5] # cp / usr/local/keepalived/etc/keepalived/keepalived.conf / etc/keepalived/
[root@D2-TYMYSQL52 keepalived-1.3.5] # cp / usr/local/keepalived/sbin/keepalived / usr/sbin/
[root@D2-TYMYSQL52 keepalived-1.3.5] # vim / etc/keepalived/keepalived.conf
[root@D2-TYMYSQL52 keepalived-1.3.5] # cat / etc/keepalived/keepalived.conf
! Configuration File for keepalived
Global_defs {
Notification_email {
Acassen@firewall.loc
Failover@firewall.loc
Sysadmin@firewall.loc
}
Notification_email_from Alexandre.Cassen@firewall.loc
Smtp_server 127.0.0.1
Smtp_connect_timeout 30
Router_id mysql01
}
Vrrp_instance mysql01 {
State BACKUP
Interface eno16777984
Virtual_router_id 50
Priority 50
Advert_int 5
Authentication {
Auth_type PASS
Auth_pass 123456
}
Virtual_ipaddress {
192.168.12.50
}
}
Virtual_server 192.168.12.50 3306 {
Delay_loop 2
Lb_algo wrr
Lb_kind DR
Persistence_timeout 60
Protocol TCP
Real_server 192.168.12.52 3306 {
Weight 3
Notify_down / usr/local/keepalived.sh
TCP_CHECK {
Connect_timeout 10
Nb_get_retry 3
Delay_before_retry 3
Connect_port 3306
}
}
}
[root@D2-TYMYSQL52 keepalived-1.3.5] # vim / usr/local/keepalived.sh
[root@D2-TYMYSQL52 keepalived-1.3.5] # cat / usr/local/keepalived.sh
#! / bin/bash
Pkill keepalived
[root@D2-TYMYSQL52 keepalived-1.3.5] # chmod + x / usr/local/keepalived.sh
[root@D2-TYMYSQL52 keepalived-1.3.5] # / usr/local/keepalived/sbin/keepalived-D-d-S 0
[root@D2-TYMYSQL52 keepalived-1.3.5] # ps-ef | grep keepalived
Root 16652 10 16:10? 00:00:00 / usr/local/keepalived/sbin/keepalived-D-d-S 0
Root 16653 16652 0 16:10? 00:00:00 / usr/local/keepalived/sbin/keepalived-D-d-S 0
Root 16654 16652 0 16:10? 00:00:00 / usr/local/keepalived/sbin/keepalived-D-d-S 0
Root 16660 11645 0 16:10 pts/0 00:00:00 grep-color=auto keepalived
(6) failover testing:
51 nodes:
[root@D2-TYMYSQL51 keepalived-1.3.5] # ip addr
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
Link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
Inet 127.0.0.1/8 scope host lo
Valid_lft forever preferred_lft forever
Inet6:: 1/128 scope host
Valid_lft forever preferred_lft forever
2: eno16777984: mtu 1500 qdisc mq state UP qlen 1000
Link/ether 00:50:56:8a:19:67 brd ff:ff:ff:ff:ff:ff
Inet 192.168.12.51/24 brd 192.168.12.255 scope global eno16777984
Valid_lft forever preferred_lft forever
Inet 192.168.12.50/32 scope global eno16777984
Valid_lft forever preferred_lft forever
Inet6 fe80::250:56ff:fe8a:1967/64 scope link
Valid_lft forever preferred_lft forever
The client initiates the connection:
[root@D2-EDUMSDB45] # mysql-h 192.168.12.50-uroot-p123456
Mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 1866
Server version: 5.6.22-log Source distribution
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
Mysql >
Turn off the 51-node mysql:
[root@D2-TYMYSQL51 keepalived-1.3.5] # / etc/init.d/mysqld stop
Shutting down MySQL. SUCCESS!
View 52 nodes:
[root@D2-TYMYSQL52 keepalived-1.3.5] # ip addr
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
Link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
Inet 127.0.0.1/8 scope host lo
Valid_lft forever preferred_lft forever
Inet6:: 1/128 scope host
Valid_lft forever preferred_lft forever
2: eno16777984: mtu 1500 qdisc mq state UP qlen 1000
Link/ether 00:50:56:8a:35:9c brd ff:ff:ff:ff:ff:ff
Inet 192.168.12.52/24 brd 192.168.12.255 scope global eno16777984
Valid_lft forever preferred_lft forever
Inet 192.168.12.50/32 scope global eno16777984
Valid_lft forever preferred_lft forever
Inet6 fe80::250:56ff:fe8a:359c/64 scope link
Valid_lft forever preferred_lft forever
45 nodes for operation:
Mysql > use mysql
No connection. Trying to reconnect...
Connection id: 1289
Current database: * * NONE * *
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-A
Database changed
The above is all the contents of the article "how to configure master master replication in Keepalived+Mysql". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.