当前位置: 首页 > news >正文

pc网站开发工具/中国搜索引擎有哪些

pc网站开发工具,中国搜索引擎有哪些,梅州新农村建设网站,b2b品牌榜前十名一、角色划分1、MySQL数据库规划我现在的环境是:zhdy04和zhdy05已经做好了主主架构配置,现在需要的是把两台或者多台从服务器与主一一同步。主机名IP 地址角色Mysql_server_idzhdy04192.168.230.145masterA145zhdy05192.168.230.146masterB146zhdy06192.…

一、角色划分

1、MySQL数据库规划

我现在的环境是:zhdy04和zhdy05已经做好了主主架构配置,现在需要的是把两台或者多台从服务器与主一一同步。

主机名IP 地址角色Mysql_server_id

zhdy04

192.168.230.145

masterA

145

zhdy05

192.168.230.146

masterB

146

zhdy06

192.168.230.147

slaveA

147

zhdy07

192.168.230.148

slaveB

148

106zfyquhu.gif

二、MySQL数据同步设定

1、因为咱们测试的机器数据库全部都是初始值,所以不需要导入任何数据库。(写的原因是假如,配置的环境和现在不一致。我们仍然需要做数据备份和导入)

2、数据同步帐号添加

按理来说,之前我们已经配置了主主,也就是zhdy04和zhdy05已经互相授权了。接下来我们需要设置的是:

在zhdy04上面授权zhdy06可以同步。

在zhdy05上面授权zhdy07可以同步。

zhdy04 masterA服务器:

mysql> grant replication slave on *.* to 'repl'@'192.168.230.147' identified by 'zhangduanya';

Query OK, 0 rows affected (0.03 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

zhdy05 masterB服务器:

mysql> grant replication slave on *.* to 'repl'@'192.168.230.148' identified by 'zhangduanya';

Query OK, 0 rows affected (0.03 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

3、数据库配置文件修改

zhdy04 masterA服务器:

server-id=145

log-bin=mysql-bin

auto-increment-increment=2

auto-increment-offset=1

log-slave-updates

zhdy05 masterB服务器:

server-id=146

log-bin=mysql-bin

auto-increment-increment=2

auto-increment-offset=2

log-slave-updates

zhdy06 slaveA服务器:

server-id=147

zhdy07 slaveB服务器:

server-id=148

在此我为了让大家更加容易理解我所做的配置,所以没有添加任何附加的服务,例如如下:

log-bin = mysql-bin #打开二进制功能,MASTER主服务器必须打开此项

binlog-format=ROW

binlog-row-p_w_picpath=minimal

log-slave-updates=true

gtid-mode=on

enforce-gtid-consistency=true

master-info-repository=TABLE

relay-log-info-repository=TABLE

sync-master-info=1

slave-parallel-workers=0

sync_binlog=0

binlog-checksum=CRC32

master-verify-checksum=1

slave-sql-verify-checksum=1

binlog-rows-query-log_events=1

#expire_logs_days=5

max_binlog_size=1024M #binlog单文件最大值

replicate-ignore-db = mysql #忽略不同步主从的数据库

replicate-ignore-db = information_schema

replicate-ignore-db = performance_schema

replicate-ignore-db = test

replicate-ignore-db = zabbix

max_connections = 3000

max_connect_errors = 30

skip-character-set-client-handshake #忽略应用程序想要设置的其他字符集

init-connect='SET NAMES utf8' #连接时执行的SQL

character-set-server=utf8 #服务端默认字符集

wait_timeout=1800 #请求的最大连接时间

interactive_timeout=1800 #和上一参数同时修改才会生效

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES #sql模式

skip-name-resolve

slow_query_log=1

long_query_time = 6

slow_query_log_file=slow-query.log

innodb_flush_log_at_trx_commit = 2

innodb_log_buffer_size = 16M

binlog-do-db=openfire

binlog-ignore-db=mysql,information_schema

replicate-do-db=openfire

replicate-ignore-db=mysql,information_schema

read_only = 1 #开始只读模式

read_only=0; #关闭只读,可以读写

4、重启4台DB:

/etc/init.d/mysqld restart

5、同步设置:

zhdy04 masterA服务器:

mysql> show master status;

记录下各自的 master_log_file、master_log_pos值

+------------------+----------+--------------+------------------+-------------------+

| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |

+------------------+----------+--------------+------------------+-------------------+

| mysql-bin.000004 | 120 | | | |

+------------------+----------+--------------+------------------+-------------------+

1 row in set (0.01 sec)

zhdy05 masterB服务器:

mysql> show master status;

+------------------+----------+--------------+------------------+-------------------+

| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |

+------------------+----------+--------------+------------------+-------------------+

| mysql-bin.000004 | 120 | | | |

+------------------+----------+--------------+------------------+-------------------+

1 row in set (0.00 sec)

zhdy06 slaveA服务器:

mysql> change master to master_host='192.168.230.145', master_user='repl', master_password='zhangduanya', master_log_file='mysql-bin.000004', master_log_pos=120;

Query OK, 0 rows affected, 2 warnings (0.04 sec)

zhdy07 slaveB服务器:

mysql> change master to master_host='192.168.230.146', master_user='repl', master_password='zhangduanya', master_log_file='mysql-bin.000004', master_log_pos=120;

Query OK, 0 rows affected, 2 warnings (0.08 sec)

6、检查配置

首先一定要把四台的firewalld全部关闭!

# systemctl stop firewalld

# systemctl disable firewalld

分别检查四台服务器的

Slave_IO_Running: Yes Slave_SQL_Running: Yes

开启情况!

zhdy06 slaveA服务器:

mysql> start slave;

Query OK, 0 rows affected (0.02 sec)

mysql> show slave status\G

*************************** 1. row ***************************

Slave_IO_State: Waiting for master to send event

Master_Host: 192.168.230.145

Master_User: repl

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: mysql-bin.000004

Read_Master_Log_Pos: 120

Relay_Log_File: zhdy06-relay-bin.000002

Relay_Log_Pos: 283

Relay_Master_Log_File: mysql-bin.000004

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

zhdy04 masterA服务器:

mysql> start slave;

Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show slave status\G

*************************** 1. row ***************************

Slave_IO_State: Waiting for master to send event

Master_Host: 192.168.230.146

Master_User: repl

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: mysql-bin.000004

Read_Master_Log_Pos: 120

Relay_Log_File: zhdy04-relay-bin.000012

Relay_Log_Pos: 283

Relay_Master_Log_File: mysql-bin.000004

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

zhdy07 slaveB服务器:

mysql> start slave;

Query OK, 0 rows affected (0.02 sec)

mysql> show slave status\G

*************************** 1. row ***************************

Slave_IO_State: Waiting for master to send event

Master_Host: 192.168.230.146

Master_User: repl

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: mysql-bin.000004

Read_Master_Log_Pos: 120

Relay_Log_File: zhdy07-relay-bin.000002

Relay_Log_Pos: 283

Relay_Master_Log_File: mysql-bin.000004

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

zhdy05 masterB服务器:

mysql> start slave;

Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show slave status\G

*************************** 1. row ***************************

Slave_IO_State: Waiting for master to send event

Master_Host: 192.168.230.145

Master_User: repl

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: mysql-bin.000004

Read_Master_Log_Pos: 120

Relay_Log_File: zhdy05-relay-bin.000011

Relay_Log_Pos: 283

Relay_Master_Log_File: mysql-bin.000004

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

由此看来全部同步成功!

7、最后一步,在主服务器zhdy04 masterA创建一个数据库,也就是说这四台服务器都会有这个数据库!

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

| qqq |

| test |

+--------------------+

5 rows in set (0.06 sec)

我就不一一截屏了,然后所有的数据库均有了qqq这个数据库!

8、总结

也就是说,未来我们搭建多主多从看完这个配置是不是也有思路了?就像配置路由器一样,互相连接的互相授权下是不是就可以了?

给大家一个设置的方法:

auto-increment-increment = 10

auto-increment-offset = 1

auto-increment-increment = 10

auto-increment-offset = 2

auto-increment-increment = 10

auto-increment-offset = 3

这样是不是就可以设置10台主mysql了呢?

但是一旦超过20台呢?或者是100台?

20台

auto-increment-increment = 20

auto-increment-offset = 1

auto-increment-increment = 20

auto-increment-offset = 2

…..

auto-increment-increment = 20

auto-increment-offset = 20

100台

auto-increment-increment = 100

auto-increment-offset = 1

auto-increment-increment = 100

auto-increment-offset = 2

…..

auto-increment-increment = 100

auto-increment-offset = 100

是不是就不会重复了? 不难看出,自增长值可设置为主机的数量值即可,但是一定要想到可扩充性,也就是尽量设置这个值大些。

http://www.lbrq.cn/news/779005.html

相关文章:

  • 网站建设要注意哪些问题/软文推广300字
  • 市建设局网站/株洲今日头条新闻
  • 网站服务费网络建设会计分录/seo点击软件哪个好用
  • 找人做网站被骗了 算诈骗吗/网站seo分析报告案例
  • 使用oss做静态网站/seo报价单
  • 东莞建设工程信息网/跨境电商seo什么意思
  • 潮州市网站建设公司/机器人编程培训机构排名
  • 网站防劫持怎么做/seo网站关键词优化机构
  • 上门做网站公司哪家好/如何注册属于自己的网站
  • 好网站建设/搜索引擎有哪些?
  • 电子商务网站建设客户需求调查表/上海网络推广培训机构
  • c2c类型电子商务网站/学历提升
  • 国外网站都不能上怎么做跨境电商/广州推广服务
  • w7自己做网站/搜索引擎优化时营销关键词
  • 软件项目设计方案/湛江seo
  • 网站设置安全/免费做网站软件
  • 一个人做导购网站/网络营销薪酬公司
  • 集团响应式网站建设/中国十大it培训机构排名
  • 完成一个个人主页网站的制作/网址导航该如何推广
  • 网站空间一般有多大/网站百度seo关键词优化
  • dede怎么做动态网站/小程序制作
  • 怎样才能做公司的网站/比较正规的代运营
  • 编程教学网站推荐/seo外链怎么做
  • 做淘宝网站要安全保障么/企业seo优化服务
  • 微网站免费模板/深圳seo优化公司
  • 网站后台灰色/seo排名优化方式
  • 山东住房和城乡建设厅网站一体化平台/营销方案案例
  • 襄阳做网站公司有哪些/大型营销型网站制作
  • 张店网站开发招聘/网络营销中心
  • 亳州网站建设公司/百度广告客服电话
  • SSE流式输出分层与解耦、用户自动结束语错误处理
  • C++高频知识点(二十一)
  • Redis 数据结构及特点
  • Leaflet地图高亮与编辑功能实现
  • 【精彩回顾·成都】成都 User Group×柴火创客空间:开源硬件驱动 AI 与云的创新实践!
  • 【Python 高频 API 速学 ④】