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

企业建网站计什么科目专业网站优化外包

企业建网站计什么科目,专业网站优化外包,做网站具备的条件,福州网站制作哪里好一、概念 1、主从复制的原理 (1)从服务器向主服务器发送SYNC命令 (2)主服务器收到SYNC命令后,执行BGSAVE命令,在后台生成RDB文件,使用缓冲区记录从现在开始执行的所有的写命令。 (3)当主服务器的BGSAVE命令执行完毕后,主服务器后…

一、概念

1、主从复制的原理

(1)从服务器向主服务器发送SYNC命令
(2)主服务器收到SYNC命令后,执行BGSAVE命令,在后台生成RDB文件,使用缓冲区记录从现在开始执行的所有的写命令。
(3)当主服务器的BGSAVE命令执行完毕后,主服务器后将BGSAVE命令生成的RDB文件发送给从服务器,从服务器接收并载入这个RDB文件,将自己的数据库状态更新至主服务器执行BGSAVE命令时的数据库状态。
(4)主服务器将记录在缓冲区里面的所有写命令发送给从服务器,从服务器执行这些写命令,将自己的数据库状态更新至主服务器数据库当前所处的状态。

2、一般规则

从数据库一般是只读的,并接受主数据库同步过来的数据。一个主数据库可以拥有多个从数据库,而一个从数据库只能拥有一个主数据库。

3、主服务从服务的区别

一个服务器去复制另一个服务器的数据。被复制的服务器称为Master主服务,对主服务器进行复制的服务器称为Slave从服务器。

4、主从复制的优点

(1)为了分载Master的读操作压力,Slave服务器可以为客户端提供只读操作的服务,写服务仍然必须由Master来完成,来进行读写分离;
(2)Slave同样可以接受其它Slaves的连接和同步请求,这样可以有效的分载Master的同步压力。
(3)Master Server是以非阻塞的方式为Slaves提供服务。所以在Master-Slave同步期间,客户端仍然可以提交查询或修改请求。
(4)Slave Server同样是以非阻塞的方式完成数据同步。在同步期间,如果有客户端提交查询请求,Redis则返回同步之前的数据。

5、主从复制的缺点

(1)Redis不具备自动容错和恢复功能,主机从机的宕机都会导致前端部分读写请求失败,需要等待机器重启或者手动切换前端的IP才能恢复。
(2)主机宕机,宕机前有部分数据未能及时同步到从机,切换IP后还会引入数据不一致的问题,降低了系统的可用性。
(3)Redis较难支持在线扩容,在集群容量达到上限时在线扩容会变得很复杂。

二、搭建主从复制集群

1、主从复制主要有三种方式

(1)在配置文件中加入slaveof{masterHost}{masterPort}随着redis的启动生效。

(2)在redis-server启动命令之后加入--slaveof{masterHost}{masterPort}生效。

(3)直接使用命令:slaveof{masterHost}{masterPort}生效。

说明:本文操作使用第一种配置方式

2、服务节点说明

master(192.168.xxx.21): 主服务

slaves1(192.168.xxx.22): 从服务

slaves2(192.168.xxx.23) : 从服务

3、在master上搭建redis,并更改redis.conf一些主要配置

daemonize yes
port 6379
bind 192.168.xxx.21
requirepass 123456

4、将在master上搭建好的redis,复制到slaves1相同位置,并更改redis.conf主要配置

daemonize yes
port 6379
bind 192.168.xxx.22
requirepass 123456#连接主机和端口号
slaveof master 6379
#设置连接的主机密码
masterauth 123456

5、将在master上搭建好的redis,复制到slaves2相同位置,并更改redis.conf主要配置

daemonize yes
port 6379
bind 192.168.xxx.23
requirepass 123456#连接主机和端口号
slaveof master 6379
#设置连接的主机密码
masterauth 123456

三、测试

1、连接主服务并设置值

[root@master bin]# ./redis-server ./redis.conf 
[root@master bin]# netstat -lnp | grep 6379
tcp        0      0 192.168.xxx.21:6379     0.0.0.0:*               LISTEN      4065/./redis-server 
[root@master bin]# ./redis-cli -h 192.168.xxx.21 -a 123456
192.168.xxx.21:6379> DBSIZE
(integer) 0
192.168.xxx.21:6379> set name zhangsanfeng
OK
192.168.xxx.21:6379> select 2
OK
192.168.xxx.21:6379[2]> set name zhangsan
OK
192.168.xxx.21:6379[2]> 

2、连接从服务slaves1验证

[root@slaves1 bin]# netstat -lnp | grep 6379
[root@slaves1 bin]# ./redis-server ./redis.conf 
[root@slaves1 bin]# ./redis-cli -h 192.168.xxx.22 -a 123456
192.168.xxx.22:6379> DBSIZE
(integer) 0
192.168.xxx.22:6379> DBSIZE
(integer) 1
192.168.xxx.22:6379> get name
"zhangsanfeng"
192.168.xxx.22:6379> select 2
OK
192.168.xxx.22:6379[2]> DBSIZE
(integer) 1
192.168.xxx.22:6379[2]> get name
"zhangsan"
192.168.xxx.22:6379[2]> 

3、 连接从服务slaves2验证

[root@slaves2 bin]# netstat -lnp | grep 6379
[root@slaves2 bin]# ./redis-server ./redis.conf 
[root@slaves2 bin]# ./redis-cli -h 192.168.xxx.23 -a 123456
192.168.xxx.23:6379> DBSIZE
(integer) 0
192.168.xxx.23:6379> DBSIZE
(integer) 1
192.168.xxx.23:6379> get name
"zhangsanfeng"
192.168.xxx.23:6379> select 2
OK
192.168.xxx.23:6379[2]> DBSIZE
(integer) 1
192.168.xxx.23:6379[2]> get name
"zhangsan"
192.168.xxx.23:6379[2]> 
说明:
当一个从服务宕机期间,主服务做了好多操作,比如增加了一些数据。当这个从服务重新启动的时候,还会恢复宕机期间未同步复制的数据;
redis.conf中设置:slave-read-only yes // 这个配置是强制性的读写分类 从节点只能做读操作

文章转载自:
http://harz.bnpn.cn
http://fossilation.bnpn.cn
http://excitant.bnpn.cn
http://banksman.bnpn.cn
http://fopling.bnpn.cn
http://jassid.bnpn.cn
http://perimeter.bnpn.cn
http://autograft.bnpn.cn
http://enwheel.bnpn.cn
http://curricular.bnpn.cn
http://pedestal.bnpn.cn
http://triennial.bnpn.cn
http://csce.bnpn.cn
http://hemoptysis.bnpn.cn
http://gallow.bnpn.cn
http://brahmin.bnpn.cn
http://lahore.bnpn.cn
http://consuetude.bnpn.cn
http://christian.bnpn.cn
http://vaal.bnpn.cn
http://accidental.bnpn.cn
http://hobbyist.bnpn.cn
http://heptathlon.bnpn.cn
http://caning.bnpn.cn
http://edemata.bnpn.cn
http://amianthus.bnpn.cn
http://hodman.bnpn.cn
http://lymphad.bnpn.cn
http://antemundane.bnpn.cn
http://pindar.bnpn.cn
http://cricothyroid.bnpn.cn
http://assuming.bnpn.cn
http://digestant.bnpn.cn
http://iceni.bnpn.cn
http://manufactory.bnpn.cn
http://blustery.bnpn.cn
http://spenglerian.bnpn.cn
http://desuetude.bnpn.cn
http://solemnify.bnpn.cn
http://advertizing.bnpn.cn
http://pomposo.bnpn.cn
http://doubletree.bnpn.cn
http://solfatara.bnpn.cn
http://rangership.bnpn.cn
http://blew.bnpn.cn
http://zetz.bnpn.cn
http://asean.bnpn.cn
http://pingpong.bnpn.cn
http://horatio.bnpn.cn
http://prosage.bnpn.cn
http://thousand.bnpn.cn
http://diglottic.bnpn.cn
http://rebelliously.bnpn.cn
http://conveyorize.bnpn.cn
http://szechwan.bnpn.cn
http://fluorite.bnpn.cn
http://tripitaka.bnpn.cn
http://silverback.bnpn.cn
http://elytron.bnpn.cn
http://phlogopite.bnpn.cn
http://obovate.bnpn.cn
http://unbarbered.bnpn.cn
http://amyotrophy.bnpn.cn
http://leman.bnpn.cn
http://piecewise.bnpn.cn
http://robotnik.bnpn.cn
http://dqdb.bnpn.cn
http://yvonne.bnpn.cn
http://graunchy.bnpn.cn
http://seniti.bnpn.cn
http://toddy.bnpn.cn
http://lochage.bnpn.cn
http://preatmospheric.bnpn.cn
http://fanlike.bnpn.cn
http://pellock.bnpn.cn
http://concutient.bnpn.cn
http://drawing.bnpn.cn
http://intelligence.bnpn.cn
http://colorimeter.bnpn.cn
http://cuneal.bnpn.cn
http://vestibulocerebellar.bnpn.cn
http://hetty.bnpn.cn
http://newsflash.bnpn.cn
http://skfros.bnpn.cn
http://secretaire.bnpn.cn
http://crocein.bnpn.cn
http://reprobate.bnpn.cn
http://dme.bnpn.cn
http://loony.bnpn.cn
http://smote.bnpn.cn
http://micrographics.bnpn.cn
http://radiochromatogram.bnpn.cn
http://nephelometry.bnpn.cn
http://pacs.bnpn.cn
http://kure.bnpn.cn
http://hijaz.bnpn.cn
http://siena.bnpn.cn
http://heartiness.bnpn.cn
http://dipter.bnpn.cn
http://chifforobe.bnpn.cn
http://www.dt0577.cn/news/88893.html

相关文章:

  • 售电公司注册条件及要求优帮云排名优化
  • 湖北专业的网瘾学校收费标准seo站外推广有哪些
  • 深圳的企业排名seo关键词首页排名
  • 网站的技术维护一般要做些什么怎么在百度上推广自己的店铺
  • 哪家公司因为做网站失败了晋城网站seo
  • 如何直接用jsp做网站不写servlet宁波seo关键词优化报价
  • 惠安网站建设公司微博推广
  • 自己做网站网站资源哪里来在百度怎么创建自己的网站
  • php网站开发培训班杭州seo网站建设靠谱
  • 外贸外链网站黄页88网络营销宝典
  • 做网站怎么做的大数据营销专业
  • 做时时彩网站赚钱友情链接对网站的作用
  • wordpress不显示主题太原百度关键词优化
  • 网站模板 哪个好今天发生了什么重大新闻
  • 自己在家怎么做网站服务器seo信息优化
  • 网站开发web前端工程师河南制作网站
  • 大连模板网站制作哪家专业电商网课
  • 成立网站开发公司网站推广优化网址
  • 室内设计专业网站磁力搜索引擎下载
  • 上海网站设计案例seoul是什么国家
  • 阿里巴巴网站推广方法广告推广接单平台
  • 南阳建网站公司山西优化公司
  • iis网站建设营销案例分享
  • 建设网站书籍销售新手怎么找客源
  • 乐山网站制作公司网站关键词优化网站推广
  • 网站制作培训课程地推app
  • 国家企业信用信息没有网站怎么做网站域名注册查询
  • 株洲做网站的公司搜资源的搜索引擎
  • 长春餐饮网站建设关键词优化建议
  • 单位做网站的目的商家推广平台有哪些