mirror of
https://github.com/qiurunze123/miaosha.git
synced 2023-11-19 22:41:03 +08:00
分布式系统
This commit is contained in:
parent
14a4171342
commit
993488fd18
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
![整体流程](https://raw.githubusercontent.com/qiurunze123/imageall/master/miaosha.png)
|
![整体流程](https://raw.githubusercontent.com/qiurunze123/imageall/master/miaosha.png)
|
||||||
|
|
||||||
> 软件环境 : 未来设计
|
> 未来设计图 : 未来设计
|
||||||
|
|
||||||
![整体流程](https://raw.githubusercontent.com/qiurunze123/imageall/master/futuremiaosha.png)
|
![整体流程](https://raw.githubusercontent.com/qiurunze123/imageall/master/futuremiaosha.png)
|
||||||
|
|
||||||
|
@ -64,7 +64,8 @@
|
||||||
| 022 |mysql主从复制思路及实操(未更新代码) |[解决思路](/docs/mysql-master-slave.md) |
|
| 022 |mysql主从复制思路及实操(未更新代码) |[解决思路](/docs/mysql-master-slave.md) |
|
||||||
| 023 |如何进行分库分表 |[解决思路](/docs/mysql-master-slave.md) |
|
| 023 |如何进行分库分表 |[解决思路](/docs/mysql-master-slave.md) |
|
||||||
|
|
||||||
#### [分布式基础--未更新](/docs/redis-code.md)
|
#### [分布式系统发展历程(已更新)](/docs/fenbushi.md)
|
||||||
|
#### [分布式系统](/docs/redis-code.md)
|
||||||
#### [mybatis源码解析--未更新](/docs/mybatis-code.md)
|
#### [mybatis源码解析--未更新](/docs/mybatis-code.md)
|
||||||
#### [redis专题缓存的优势及如何进行集群--未更新](/docs/redis-code.md)
|
#### [redis专题缓存的优势及如何进行集群--未更新](/docs/redis-code.md)
|
||||||
#### [spring源码--未更新](/docs/redis-code.md)
|
#### [spring源码--未更新](/docs/redis-code.md)
|
||||||
|
|
33
docs/fenbushi.md
Normal file
33
docs/fenbushi.md
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
### 分布式系统
|
||||||
|
|
||||||
|
有问题或者宝贵意见联系我的QQ,非常希望你的加入!
|
||||||
|
|
||||||
|
> 分布式系统历程----1
|
||||||
|
|
||||||
|
![整体流程](https://raw.githubusercontent.com/qiurunze123/imageall/master/fenbushi1.png)
|
||||||
|
|
||||||
|
> 分布式系统历程----2
|
||||||
|
|
||||||
|
![整体流程](https://raw.githubusercontent.com/qiurunze123/imageall/master/fenbushi2.png)
|
||||||
|
|
||||||
|
> 分布式系统历程----3
|
||||||
|
|
||||||
|
![整体流程](https://raw.githubusercontent.com/qiurunze123/imageall/master/fenbushi3.png)
|
||||||
|
|
||||||
|
> 分布式系统历程----4
|
||||||
|
|
||||||
|
![整体流程](https://raw.githubusercontent.com/qiurunze123/imageall/master/fenbushi4.png)
|
||||||
|
|
||||||
|
> 分布式系统历程----5
|
||||||
|
|
||||||
|
![整体流程](https://raw.githubusercontent.com/qiurunze123/imageall/master/fenbushi5.png)
|
||||||
|
|
||||||
|
> 分布式系统历程----6
|
||||||
|
|
||||||
|
![整体流程](https://raw.githubusercontent.com/qiurunze123/imageall/master/fenbushi6.png)
|
||||||
|
|
||||||
|
> 分布式系统历程----7
|
||||||
|
|
||||||
|
![整体流程](https://raw.githubusercontent.com/qiurunze123/imageall/master/fenbushi7.png)
|
||||||
|
|
||||||
|
|
|
@ -72,13 +72,14 @@
|
||||||
mysql的日志文件: /var/log/mysql.log
|
mysql的日志文件: /var/log/mysql.log
|
||||||
|
|
||||||
140 为master
|
140 为master
|
||||||
|
|
||||||
1. 创建一个用户’repl’,并且允许其他服务器可以通过该用户远程访问master,通过该用户去读取二进制数据,实现数据同步
|
1. 创建一个用户’repl’,并且允许其他服务器可以通过该用户远程访问master,通过该用户去读取二进制数据,实现数据同步
|
||||||
Create user repl identified by ‘repl; repl用户必须具有REPLICATION SLAVE权限,除此之外其他权限都不需要
|
create user repl identified by ‘repl; repl用户必须具有replication slave权限,除此之外其他权限都不需要
|
||||||
GRANT REPLICATION SLAVE ON *.* TO ‘repl’@’%’ IDENTIFIED BY ‘repl’ ;
|
grant replication slave on *.* to ‘repl’@’%’ identified BY ‘repl’ ;
|
||||||
2. 修改140 my.cnf配置文件,在[mysqld] 下添加如下配置
|
2. 修改140 my.cnf配置文件,在[mysqld] 下添加如下配置
|
||||||
log-bin=mysql-bin //启用二进制日志文件
|
log-bin=mysql-bin //启用二进制日志文件
|
||||||
server-id=130 服务器唯一ID
|
server-id=130 服务器唯一ID
|
||||||
3. 重启数据库 systemctl restart mysqld
|
3. 重启数据库 systemctl restart mysqld sudo /etc/init.d/mysql start
|
||||||
4. 登录到数据库,通过show master status 查看master的状态信息
|
4. 登录到数据库,通过show master status 查看master的状态信息
|
||||||
142 为slave
|
142 为slave
|
||||||
1. 修改142 my.cnf配置文件, 在[mysqld]下增加如下配置
|
1. 修改142 my.cnf配置文件, 在[mysqld]下增加如下配置
|
||||||
|
@ -88,7 +89,26 @@
|
||||||
read_only=1
|
read_only=1
|
||||||
2. 重启数据库: systemctl restart mysqld
|
2. 重启数据库: systemctl restart mysqld
|
||||||
3. 连接到数据库客户端,通过如下命令建立同步连接
|
3. 连接到数据库客户端,通过如下命令建立同步连接
|
||||||
change master to master_host=’192.168.11.140’, master_port=3306,master_user=’repl’,master_password=’repl’,master_log_file=’mysql-bin.000001’,master_log_pos=0;
|
change master to master_log_file='mysql-bin 隆.000002',master_log_pos=154;
|
||||||
|
error:
|
||||||
|
ERROR 1794 (HY000): Slave is not configured or failed to initialize properly. You must at least set --server-id to enable either a master or a slave. Additional error messages can be found in the MySQL error log.
|
||||||
|
最后通过如下的操作解决的问题,具体原因还尚未清楚
|
||||||
|
CHANGE MASTER TO
|
||||||
|
MASTER_HOST='39.107.245.253',
|
||||||
|
MASTER_USER='repl',
|
||||||
|
MASTER_PASSWORD='repl',
|
||||||
|
MASTER_LOG_FILE='mysql-bin 隆.000001',
|
||||||
|
MASTER_LOG_POS= 154;
|
||||||
|
(1)登录数据库后,删除5张表,并重新导入脚本
|
||||||
|
use mysql
|
||||||
|
drop table slave_master_info;
|
||||||
|
drop table slave_relay_log_info;
|
||||||
|
drop table slave_worker_info;
|
||||||
|
drop table innodb_index_stats;
|
||||||
|
drop table innodb_table_stats;
|
||||||
|
---------------------
|
||||||
|
2.重启数据库
|
||||||
|
change master to master_host='39.107.245.253', master_port=3306,master_user='repl',master_password='repl',master_log_file='mysql-bin 隆.000001',master_log_pos=154;
|
||||||
红色部分从master的show master status可以找到对应的值,不能随便写。
|
红色部分从master的show master status可以找到对应的值,不能随便写。
|
||||||
4. 执行 start slave
|
4. 执行 start slave
|
||||||
5. show slave status\G;查看slave服务器状态,当如下两个线程状态为yes,表示主从复制配置成功
|
5. show slave status\G;查看slave服务器状态,当如下两个线程状态为yes,表示主从复制配置成功
|
||||||
|
|
|
@ -20,7 +20,7 @@ mybatis.config-locations=classpath:mybatis/config.xml
|
||||||
#datasource
|
#datasource
|
||||||
spring.datasource.url=jdbc:mysql://39.107.245.253:3306/miaosha?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
|
spring.datasource.url=jdbc:mysql://39.107.245.253:3306/miaosha?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
|
||||||
spring.datasource.username=root
|
spring.datasource.username=root
|
||||||
spring.datasource.password=root
|
spring.datasource.password=nihaoma
|
||||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||||
#druid
|
#druid
|
||||||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||||
|
@ -49,7 +49,7 @@ spring.resources.static-locations=classpath:/static/
|
||||||
redis.host=39.107.245.253
|
redis.host=39.107.245.253
|
||||||
redis.port=6379
|
redis.port=6379
|
||||||
redis.timeout=100
|
redis.timeout=100
|
||||||
redis.password=123456
|
redis.password=youxin11
|
||||||
redis.poolMaxTotal=1000
|
redis.poolMaxTotal=1000
|
||||||
redis.poolMaxIdle=500
|
redis.poolMaxIdle=500
|
||||||
redis.poolMaxWait=500
|
redis.poolMaxWait=500
|
||||||
|
|
Loading…
Reference in New Issue
Block a user