您的位置:首页 > 科技 > IT业 > 代理网约车平台赚钱吗_国外最大的设计网站_宁波受欢迎全网seo优化_百度营销平台

代理网约车平台赚钱吗_国外最大的设计网站_宁波受欢迎全网seo优化_百度营销平台

2024/12/22 19:08:09 来源:https://blog.csdn.net/spark_dev/article/details/144417130  浏览:    关键词:代理网约车平台赚钱吗_国外最大的设计网站_宁波受欢迎全网seo优化_百度营销平台
代理网约车平台赚钱吗_国外最大的设计网站_宁波受欢迎全网seo优化_百度营销平台

系列文章目录

【第三节】docker应用系列篇: MySQL主从复制集群部署

  • 系列文章目录
  • 前言
  • 一、 MySQL主节点配置
  • 二、 mysql主节点部署
  • 三、从节点配置
  • 四、从节点启动
  • 五、master节点配置
  • 六 、 slave节点配置


前言


提示:以下是本篇文章正文内容,下面案例可供参考

一、 MySQL主节点配置

# vim /opt/mysql-master/conf/my.cnf
# cat /opt/mysql-master/conf/my.cnf
[client]
default-character-set=utf8[mysql]
default-character-set=utf8[mysqld]
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
skip-name-resolveserver_id=1
log-bin=mysql-bin
read-only=0
binlog-do-db=kubemsb_testreplicate-ignore-db=mysql
replicate-ignore-db=sys
replicate-ignore-db=information_schema
replicate-ignore-db=performance_schema
docker ps 查询容器运行情况,如果发现没七情

二、 mysql主节点部署

 docker run -p 3307:3306 \--name mysql-master \-v /opt/mysql-master/log:/var/log/mysql \-v /opt/mysql-master/data:/var/lib/mysql \-v /opt/mysql-master/conf/my.cnf:/etc/my.cnf \-e MYSQL_ROOT_PASSWORD=root \-d mysql:5.7

查docker启动情况

[root@vm31 mysql-master]# docker ps
CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS         PORTS                                                  NAMES
65f2d74626f4   mysql:5.7      "docker-entrypoint.s…"   5 seconds ago   Up 2 seconds   33060/tcp, 0.0.0.0:3307->3306/tcp, :::3307->3306/tcp   mysql-master

三、从节点配置

# vim /opt/mysql-slave/conf/my.cnf
# cat /opt/mysql-slave/conf/my.cnf
[client]
default-character-set=utf8[mysql]
default-character-set=utf8[mysqld]
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
skip-name-resolveserver_id=2
log-bin=mysql-bin
read-only=1
binlog-do-db=kubemsb_testreplicate-ignore-db=mysql
replicate-ignore-db=sys
replicate-ignore-db=information_schema
replicate-ignore-db=performance_schema

四、从节点启动

[root@vm31 conf]#    docker run -p 3308:3306  --name mysql-slave  -v /opt/mysql-slave/log:/var/log/mysql  -v /opt/mysql-slave/data:/var/lib/mysql  -v /opt/mysql-slave/conf/my.cnf:/etc/my.cnf  -e MYSQL_ROOT_PASSWORD=root  -d  --link mysql-master:mysql-master mysql:5.7

五、master节点配置

进入master, 执行:

 grant replication slave on *.* to 'backup'@'%' identified by '123456';

如下

[root@vm31 ~]# mysql -h vm31  -uroot -proot
^C
[root@vm31 ~]# mysql -h vm31  -uroot -proot -P3307
mysql -h vm31  -uroot -proot -P3307Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.44-log MySQL Community Server (GPL)Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MySQL [(none)]>  grant replication slave on *.* to 'backup'@'%' identified by '123456';
Query OK, 0 rows affected, 1 warning (0.11 sec)

重启容器,使用配置生效

# docker restart mysql-master

六 、 slave节点配置

MySQL [(none)]> change master to master_host='mysql-master', master_user='backup', master_password='123456', master_log_file='mysql-bin.000001', master_log_pos=154, master_port=3306;
MySQL [(none)]> start slave;
MySQL [(none)]> show slave status \G;
*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: mysql-masterMaster_User: backupMaster_Port: 3306Connect_Retry: 60Master_Log_File: mysql-bin.000004Read_Master_Log_Pos: 154Relay_Log_File: e1cfc4247f8c-relay-bin.000005Relay_Log_Pos: 367Relay_Master_Log_File: mysql-bin.000004Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_Do_DB: Replicate_Ignore_DB: mysql,sys,information_schema,performance_schemaReplicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0Last_Error: Skip_Counter: 0Exec_Master_Log_Pos: 154Relay_Log_Space: 1071Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_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: NoLast_IO_Errno: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 1Master_UUID: 6c3c5a8e-b7ec-11ef-b6aa-0242ac110002Master_Info_File: /var/lib/mysql/master.infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Slave has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: 
1 row in set (0.00 sec)ERROR: No query specified

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com