1. 程式人生 > >Linux環境Mysql環境配置優化及主從配置

Linux環境Mysql環境配置優化及主從配置

準備2臺伺服器資訊:
伺服器IP
伺服器使用者名稱
伺服器密碼
作業系統
資料庫型別
資料庫IP
資料庫使用者名稱
資料庫密碼
伺服器設定
192.168.3.4
root
123456
Centos7
Mysql
192.168.3.4
root
123456Abc
master
192.168.3.5
root
123456
Redhat7
Mysql
192.168.3.5
root
123456Abc
slave
1.192.168.3.4 上已經安裝配置mysql,192.168.3.5按照如下步驟設定mysql:

【1】192.168.3.5 上安裝mysql
[

[email protected] ~]# cd /usr/local/mysql
[[email protected] mysql]# ll
total 580020
-rw-r–r–. 1 root root 593940480 Mar 25 22:50 mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar
[[email protected] mysql]# tar -xvf mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar
mysql-community-embedded-devel-5.7.21-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-5.7.21-1.el7.x86_64.rpm
mysql-community-common-5.7.21-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.21-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.21-1.el7.x86_64.rpm
mysql-community-server-minimal-5.7.21-1.el7.x86_64.rpm
mysql-community-client-5.7.21-1.el7.x86_64.rpm
mysql-community-server-5.7.21-1.el7.x86_64.rpm
mysql-community-embedded-5.7.21-1.el7.x86_64.rpm
mysql-community-test-5.7.21-1.el7.x86_64.rpm
mysql-community-devel-5.7.21-1.el7.x86_64.rpm
mysql-community-libs-5.7.21-1.el7.x86_64.rpm
[
[email protected]
mysql]# rpm -qa|grep mariadb
mariadb-libs-5.5.52-1.el7.x86_64
mariadb-server-5.5.52-1.el7.x86_64
mariadb-5.5.52-1.el7.x86_64
[[email protected] mysql]# rpm -e –nodeps mariadb-server-5.5.56-2.el7.x86_64
error: package mariadb-server-5.5.56-2.el7.x86_64 is not installed
[
[email protected]
mysql]# rpm -e –nodeps mariadb-server-5.5.52-1.el7.x86_64
[[email protected] mysql]# rpm -e –nodeps mariadb-libs-5.5.52-1.el7.x86_64
[[email protected] mysql]# rpm -e –nodeps mariadb-5.5.52-1.el7.x86_64
[[email protected] mysql]# rpm -qa|grep mariadb
[[email protected] mysql]# rpm -ivh mysql-community-common-5.7.21-1.el7.x86_64.rpm
warning: mysql-community-common-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql-community-common-5.7.21-1.e################################# [100%]
[[email protected] mysql]# rpm -ivh mysql-community-libs-5.7.21-1.el7.x86_64.rpm
warning: mysql-community-libs-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql-community-libs-5.7.21-1.el7################################# [100%]
[[email protected] mysql]# rpm -ivh mysql-community-devel-5.7.21-1.el7.x86_64.rpm
warning: mysql-community-devel-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql-community-devel-5.7.21-1.el################################# [100%]
[[email protected] mysql]# rpm -ivh mysql-community-libs-compat-5.7.21-1.el7.x86_64.rpm
warning: mysql-community-libs-compat-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql-community-libs-compat-5.7.2################################# [100%]
[[email protected] mysql]# rpm -ivh mysql-community-embedded-5.7.21-1.el7.x86_64.rpm
warning: mysql-community-embedded-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql-community-embedded-5.7.21-1################################# [100%]
[[email protected] mysql]# rpm -ivh mysql-community-embedded-devel-5.7.21-1.el7.x86_64.rpm
warning: mysql-community-embedded-devel-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql-community-embedded-devel-5.################################# [100%]
[[email protected] mysql]# rpm -ivh mysql-community-embedded-compat-5.7.21-1.el7.x86_64.rpm
warning: mysql-community-embedded-compat-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql-community-embedded-compat-5################################# [100%]
[[email protected] mysql]# rpm -ivh mysql-community-client-5.7.21-1.el7.x86_64.rpm
warning: mysql-community-client-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql-community-client-5.7.21-1.e################################# [100%]
[[email protected] mysql]# rpm -ivh mysql-community-server-5.7.21-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql-community-server-5.7.21-1.e################################# [100%]
[[email protected] mysql]# yum install perl-JSON.noarch
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
There are no enabled repos.
Run “yum repolist all” to see the repos you have.
To enable Red Hat Subscription Management repositories:
subscription-manager repos –enable
To enable custom repositories:
yum-config-manager –enable
[[email protected] mysql]# mysql-community-test-5.7.21-1.el7.x86_64.rpm
bash: mysql-community-test-5.7.21-1.el7.x86_64.rpm: command not found…
[[email protected] mysql]# rpm -ivh mysql-community-test-5.7.21-1.el7.x86_64.rpm
warning: mysql-community-test-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
perl(JSON) is needed by mysql-community-test-5.7.21-1.el7.x86_64
[[email protected] mysql]# yum repolist all
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
repolist: 0
[[email protected] mysql]# ll
total 1160144
-rw-r–r–. 1 root root 593940480 Mar 25 22:50 mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar
-rw-r–r–. 1 7155 31415 25107316 Dec 28 20:53 mysql-community-client-5.7.21-1.el7.x86_64.rpm
-rw-r–r–. 1 7155 31415 278844 Dec 28 20:53 mysql-community-common-5.7.21-1.el7.x86_64.rpm
-rw-r–r–. 1 7155 31415 3779988 Dec 28 20:53 mysql-community-devel-5.7.21-1.el7.x86_64.rpm
-rw-r–r–. 1 7155 31415 46256768 Dec 28 20:53 mysql-community-embedded-5.7.21-1.el7.x86_64.rpm
-rw-r–r–. 1 7155 31415 24078148 Dec 28 20:53 mysql-community-embedded-compat-5.7.21-1.el7.x86_64.rpm
-rw-r–r–. 1 7155 31415 128571868 Dec 28 20:53 mysql-community-embedded-devel-5.7.21-1.el7.x86_64.rpm
-rw-r–r–. 1 7155 31415 2238596 Dec 28 20:53 mysql-community-libs-5.7.21-1.el7.x86_64.rpm
-rw-r–r–. 1 7155 31415 2115904 Dec 28 20:54 mysql-community-libs-compat-5.7.21-1.el7.x86_64.rpm
-rw-r–r–. 1 7155 31415 55662616 Dec 28 20:54 mysql-community-minimal-debuginfo-5.7.21-1.el7.x86_64.rpm
-rw-r–r–. 1 7155 31415 171890056 Dec 28 20:54 mysql-community-server-5.7.21-1.el7.x86_64.rpm
-rw-r–r–. 1 7155 31415 15289580 Dec 28 20:54 mysql-community-server-minimal-5.7.21-1.el7.x86_64.rpm
-rw-r–r–. 1 7155 31415 118654584 Dec 28 20:54 mysql-community-test-5.7.21-1.el7.x86_64.rpm
-rw-r–r–. 1 root root 98112 Mar 25 23:03 perl-JSON-2.59-2.el7.noarch.rpm
[[email protected] mysql]# rpm -ivh perl-JSON-2.59-2.el7.noarch.rpm
warning: perl-JSON-2.59-2.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:perl-JSON-2.59-2.el7 ################################# [100%]
[[email protected] mysql]# rpm -ivh mysql-community-test-5.7.21-1.el7.x86_64.rpm
warning: mysql-community-test-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql-community-test-5.7.21-1.el7################################# [100%]
[[email protected] mysql]#

【2】配置192.168.3.5
[[email protected] mysql]# systemctl start mysqld.service
[[email protected] mysql]# service mysqld status
Redirecting to /bin/systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2018-03-25 23:08:51 CST; 4s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 3928 ExecStart=/usr/sbin/mysqld –daemonize –pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
Process: 3842 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 3931 (mysqld)
CGroup: /system.slice/mysqld.service
└─3931 /usr/sbin/mysqld –daemonize –pid-file=/var/run/mysqld/mysqld.pid

Mar 25 23:08:33 marklin.com systemd[1]: Starting MySQL Server…
Mar 25 23:08:51 marklin.com systemd[1]: Started MySQL Server.
[[email protected] mysql]# cat /var/log/mysqld.log | grep password
2018-03-25T15:08:45.982603Z 1 [Note] A temporary password is generated for [email protected]: dZ),Jr:vo6Tg
[[email protected] mysql]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
[[email protected] mysql]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.21

Copyright (c) 2000, 2018, 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> set global validate_password_policy=0;
Query OK, 0 rows affected (0.01 sec)

mysql> set global validate_password_mixed_case_count=0;
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password_number_count=3;
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password_special_char_count=0;
Query OK, 0 rows affected (0.00 sec)

mysql> et global validate_password_length=3;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘et global validate_password_length=3’ at line 1
mysql> set global validate_password_length=3;
Query OK, 0 rows affected (0.00 sec)

mysql> set password for ‘root’@’localhost’ = password(‘123456Abc’);
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show variables like ‘validate_password%’;
+————————————–+——-+
| Variable_name | Value |
+————————————–+——-+
| validate_password_check_user_name | OFF |
| validate_password_dictionary_file | |
| validate_password_length | 3 |
| validate_password_mixed_case_count | 0 |
| validate_password_number_count | 3 |
| validate_password_policy | LOW |
| validate_password_special_char_count | 0 |
+————————————–+——-+
7 rows in set (0.00 sec)

mysql> grant all privileges on . to ‘root’@’%’ identified by ‘123456Abc’ with grant option;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql>

【3】配置優化:
mysql> set @@global.slow_query_log = on;
Query OK, 0 rows affected (0.00 sec)

mysql> set @@global.log_slow_admin_statements=1;
Query OK, 0 rows affected (0.00 sec)

mysql> set global min_examined_row_limit=100;
Query OK, 0 rows affected (0.00 sec)

mysql> set global log_queries_not_using_indexes=1;
Query OK, 0 rows affected (0.00 sec)

mysql> set global log_throttle_queries_not_using_indexes=10;
Query OK, 0 rows affected (0.00 sec)

mysql> set @@global.log_queries_not_using_indexes=on;
Query OK, 0 rows affected (0.00 sec)

mysql> set global general_log=on;
Query OK, 0 rows affected (0.00 sec)

mysql> set global log_output=’file,table’;
Query OK, 0 rows affected (0.04 sec)

mysql> set @@global.log_queries_not_using_indexes=on;
Query OK, 0 rows affected (0.01 sec)

mysql>

2.Mysql主從配置:
[1]Master主資料庫伺服器配置
主從配置的資料庫:mark-apple-amber,ark-apple-orchid,mark-apple-knight
(1).Xhell5輸入:vim /etc/my.cnf,配置內容如下:

Setting server-id

server-id=1
log-bin=mysql-master-bin
log-bin-index=mysql-master-bin.index
sync_binlog=1
binlog-ignore-db=mysql
binlog-do-db=mark-apple-amber,mark-apple-orchid,mark-apple-knight
log-slave-updates

(2)重啟master資料庫服務,輸入:service mysqld restart
[[email protected] ~]# service mysqld restart
Redirecting to /bin/systemctl restart mysqld.service
[[email protected] ~]# service mysqld status
Redirecting to /bin/systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2018-03-25 06:26:43 EDT; 12s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 52432 ExecStart=/usr/sbin/mysqld –daemonize –pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
Process: 52409 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 52434 (mysqld)
CGroup: /system.slice/mysqld.service
└─52434 /usr/sbin/mysqld –daemonize –pid-file=/var/run/mysqld/mysqld.pid

Mar 25 06:26:41 marklin.com systemd[1]: Starting MySQL Server…
Mar 25 06:26:43 marklin.com systemd[1]: Started MySQL Server.
[[email protected] ~]#

(3)master資料庫建立授權:grant file on . to ‘root’@’192.168.3.%’ identified by ‘123456Abc’;
mysql> grant file on . to ‘root’@’192.168.3.%’ identified by ‘123456Abc’;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

修改密碼策略:
set global validate_password_policy=0;
set global validate_password_length=1;

mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password_length=1;
Query OK, 0 rows affected (0.00 sec)

mysql> grant file on . to ‘root’@’192.168.3.%’ identified by ‘123456Abc’;
Query OK, 0 rows affected, 1 warning (0.00 sec)

(4)檢視master主庫日誌情況:show master status;
mysql> show master status;
+——————+———-+—————————————————–+———————————————+——————-+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+——————+———-+—————————————————–+———————————————+——————-+
| mysql-bin.000002 | 422 | mark-apple-amber,ark-apple-orchid,mark-apple-knight | performance_schema,information_schema,mysql | |
+——————+———-+—————————————————–+———————————————+——————-+
1 row in set (0.00 sec)

mysql>

mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password_length=1;
Query OK, 0 rows affected (0.00 sec)

mysql> grant file on . to ‘root’@’192.168.3.%’ identified by ‘123456Abc’;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> grant replication slave on . to [email protected]’192.168.3.%’ identified by ‘123456Abc’;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> grant replication slave,super,reload on mark-apple-amber.* to ‘root’@’192.168.3.%’ identified by ‘123456Abc’;
ERROR 1046 (3D000): No database selected
mysql> grant replication slave,super,reload on . to ‘root’@’192.168.3.%’ identified by ‘123456Abc’;
Query OK, 0 rows affected, 1 warning (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 |
+————————-+———-+——————————————————+——————+——————-+
| mysql-master-bin.000001 | 1188 | mark-apple-amber,mark-apple-orchid,mark-apple-knight | mysql | |
+————————-+———-+——————————————————+——————+——————-+
1 row in set (0.00 sec)

mysql>

[2]Slave從資料庫伺服器配置
(1).Xhell5輸入:vim /etc/my.cnf,配置內容如下:

Setting server-id

log-bin=mysql-bin
server-id=2
log-bin-index=mysql-bin.index
binlog-ignore-db=information_schema
binlog-ignore-db=mysql
replicate-do-db=mark-apple-amber,ark-apple-orchid,mark-apple-knight
replicate-ignore-db=mysql
log-slave-update
slave-skip-errors=all
slave-net-timeout=60
sync_master_info=1
master-host=192.168.3.4
master-user=root
master-password=123456Abc
master-port=3306

(2)重啟master資料庫服務,輸入:service mysqld restart
[[email protected] ~]# service mysqld restart
Redirecting to /bin/systemctl restart mysqld.service
[[email protected] ~]# service mysqld status
Redirecting to /bin/systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2018-03-25 06:26:43 EDT; 12s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 52432 ExecStart=/usr/sbin/mysqld –daemonize –pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
Process: 52409 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 52434 (mysqld)
CGroup: /system.slice/mysqld.service
└─52434 /usr/sbin/mysqld –daemonize –pid-file=/var/run/mysqld/mysqld.pid

Mar 25 06:26:41 marklin.com systemd[1]: Starting MySQL Server…
Mar 25 06:26:43 marklin.com systemd[1]: Started MySQL Server.
[[email protected] ~]#

(3) 配置連線主伺服器的資訊:
mysql> stop slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> change master to master_host=’192.168.3.4’, master_user=’root’, master_password=’123456Abc’, master_log_file=’mysql-bin.000002’, master_log_pos=422;
Query OK, 0 rows affected, 2 warnings (0.29 sec)

mysql> start slave;
Query OK, 0 rows affected (0.00 sec)

(3) 檢視從伺服器狀態:show slave status \G;
mysql> show slave status \G;
***************** 1. row *****************
Slave_IO_State: Connecting to master
Master_Host: 192.168.3.4
Master_User: root
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000002
Read_Master_Log_Pos: 422
Relay_Log_File: marklin-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.000002
Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
Replicate_Do_DB: mark-apple-amber,ark-apple-orchid,mark-apple-knight
Replicate_Ignore_DB: mysql
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: 422
Relay_Log_Space: 154
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: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 2003
Last_IO_Error: error connecting to master ‘[email protected]:3306’ - retry-time: 60 retries: 2
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 0
Master_UUID:
Master_Info_File: /var/lib/mysql/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp: 180326 03:12:45
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)

ERROR:
No query specified

mysql>

mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)

mysql> change master to master_host=’192.168.3.4’, master_user=’root’, master_password=’123456Abc’, master_log_file=’mysql-master-bin.000001’, master_log_pos=1188;
Query OK, 0 rows affected, 2 warnings (0.02 sec)

mysql> start slave;
Query OK, 0 rows affected (0.00 sec)

mysql> show slave status\G;
***************** 1. row *****************
Slave_IO_State: Connecting to master
Master_Host: 192.168.3.4
Master_User: root
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-master-bin.000001
Read_Master_Log_Pos: 1188
Relay_Log_File: marklin-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-master-bin.000001
Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
Replicate_Do_DB: mark-apple-amber,ark-apple-orchid,mark-apple-knight
Replicate_Ignore_DB: mysql
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: 1188
Relay_Log_Space: 154
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: NULL
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: 0
Master_UUID:
Master_Info_File: /var/lib/mysql/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
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
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)

ERROR:
No query specified

mysql>

相關推薦

Linux環境Mysql環境配置優化主從配置

準備2臺伺服器資訊: 伺服器IP 伺服器使用者名稱 伺服器密碼 作業系統 資料庫型別 資料庫IP 資料庫使用者名稱 資料庫密碼 伺服器設定 192.168.3.4 root 123456 Centos7 Mysql 192.168.

Linux環境mysql讀寫分離以及主從配置(不錯可以的)

記下File及Position下的值。以備在配置從伺服器時使用。 注:File:當前binlog的檔名,每重啟一次mysql,就會生成一個新binlog檔案       Position:當前binlog的指標位置 三、從伺服器配置 1、配置mysql.cnf # vi /etc/my.cnf (1)修改

linux+apache+mysql+php平臺構建環境配置

1.我使用的centos6。安裝時已經選擇安裝apach、mysql,其實在執行下列兩行命令的時候又對其進行了更新,所以說裝的時候可以不安裝,免得浪費時間。 yum install php-mysql  yum install mysql-devel 這兩項執行完以後,PHP就已經裝上了,這是因為它們存在

LINUXMysql環境部署問題解決

tab 登錄 修改 遠程連接 p地址 過程 ID 出現 xxxx 連接mysql用戶: mysql -u root -p 回車,輸入密碼 創建數據庫:create database 【數據庫名稱】 復制數據:navicat傳輸數據功能 過程中出現的問題:1、打開表,報10

eclipse開發android-ndk環境所需工具包安裝配置方法

一、準備工具包 到網盤下載android相關工具包; 地址:https://pan.baidu.com/s/1kUSRu31 二、安裝 1、安裝eclipse、adt、sdk; 解壓adt-bu

redis安裝主從配置

redis;redis主從配置一、redis介紹 redis是一個key-value存儲系統。和Memcached類似,它支持存儲的value類型相對更多,包括string(字符串)、list(鏈表)、set(集合)和zset(有序集合)。這些數據類型都支持push/pop、add/remove及取交集並

linux下安裝mysql5.7.17簡單配置

http mkdir exp 重要 ble ges 選擇 bsp 統一 1.mysql5.7.17安裝在/usr/local/mysql目錄裏面,也可以安裝在其他地方 (安裝包最好與Linux系統一樣,eg;64位的就是“mysql-5.7.17-linux-glibc2.

Nginx配置優化深入講解,大家可以聽一下

inactive 建立連接 epo 快速 一個 sync 檢測 wait 新建 隨著訪問量的不斷增加,需要對Nginx和內核做相應的優化來滿足高並發用戶的訪問,那下面在單臺Nginx服務器來優化相關參數。 1) Nginx.conf配置優化: worker_pr

mongodb的安裝主從配置

mkdir -p 集合 shell 運行 -s -m tle obj unit 一、mongodb安裝1.下載mongodblinux版本 https://www.mongodb.com/download-center#community2.解壓tar xvf mongod

張明貴-Linux文件上傳下載sCRT配置批量管理功能

http ros 系統版本 uname tro 吸引 聯網 上傳 proc 【講課:互動,用提問的方式來吸引聽眾的註意力,聽眾吸收最大化】大學是在許昌學院讀的,在我看來,不幹念PPT的老師就是好講師,因為大部分任課老師自顧自講,沒有互動,傳授的知識我們只是被動的聽,沒有引導

redis安全設置主從配置

毫秒 pri tcp sha inf 自己 ise error_log form redis安全設置 編輯/etc/redisc.conf配置文件 #設置監聽ip bind 127.0.0.1 2.2.2.2 ? #可以是多個ip,使用空格分隔 #設置監聽端口 prot 6

DBA很忙—MySQL的效能優化自動化運維實踐

DBA的日常工作 首先,我們來看看DBA的具體工作,我覺得 DBA 真的很忙:備份和恢復、監控狀態、叢集搭建與擴容、資料遷移和高可用,這是我們 DBA 的功能。 瞭解這些功能以後要對體系結構有更加深入的瞭解,你不知道怎麼處理這些故障和投訴的事情。 所以我們要去了解快取/執行緒、SQL優化、儲

HTTPS配置優化注意點

Nginx官網反向代理時配置SSL證書,需要enable ngx_http_ssl_module模組,且需要支援的openssl開發版,預設配置引數比較少,但是可以根據實際情況對效能及安全性做成優化,具體如下! 一、SSL引數具體優化(這裡只填主要的) 1. ssl_protocols TLSv

HTTPS配置優化註意點

優化 空間 內存 .com 服務器端 最大的 提高 android版本 空閑 Nginx官網反向代理時配置SSL證書,需要enable ngx_http_ssl_module模塊,且需要支持的openssl開發版,默認配置參數比較少,但是可以根據實際情況對性能及安全性做成優

mysql 讀寫分離之主從配置

#mysql主從複製 ###下載mysql安裝包 ###安裝master mysql . 檢查當前機器是否已經安裝mysql yum repolist enabled | grep "mysql.-community." . 解壓mysql壓縮檔

mysql5.7 yum安裝主從配置(從庫只讀),不重啟主庫新增從庫配置

yum -y remove mysql wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm rpm -ivh mysql57-community-release-el7-8.noarch.rpm yum -y ins

linuxmysql安裝報錯修改密碼登入等等

1:下載 [root@localhost soft]# wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz 2:解壓檔案 [root@dbserver /]# tar -xzvf

【Git】 GitLab配置優化漢化

GitLab配置   1、修改GitLab繫結的域名     a、修改/etc/gitlab/gitlab.rb配置檔案,修改成自己的域名 1 external_url 'http://gitlab.example.com'     b、使配置生效       停止服務命令:gitlab-

MySQL語句執行優化分頁查詢優化,分庫分表(一)

下面是關於在使用SQL時,我們儘量應該遵守的規則,這樣可以避免寫出執行效率低的SQL 1、當只需要一條資料時,使用limit 1      在我們執行查詢時,如果添加了 Limit 1,那麼在查詢的時候,在篩選到一條資料時就會停止繼續查詢,但是如果沒有新增limit 1即

Redis服務端優化實踐:配置優化主從切換、持久化

Redis是部門業務重要的核心業務元件,被廣泛應用在行情繫統、推送服務、資料中心、投顧、圈子、量化分析等平臺。在使用Redis的過程中遇到了很多問題,涉及到開發者使用API時的一些注意事項,以及如何通過優化服務端配置提高Redis的健壯性、容錯性。 本文通過案例分析的方式分享一下我們在Redis服務