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

中英文版网站是怎么做的百度科技有限公司

中英文版网站是怎么做的,百度科技有限公司,学校网站建设联系电话,flash在线制作网站redis分片java实践 linux安装redishttps://mp.csdn.net/mp_blog/creation/editor/134864302复制redis.conf配置文件成redis1.conf、redis2.conf、redis3.conf 修改redis的端口信息和存pid文件的路径。存pid文件的路径只要不同就行了,没什么特别要求。 指定配置文件…

 redis分片java实践

linux安装redisicon-default.png?t=N7T8https://mp.csdn.net/mp_blog/creation/editor/134864302复制redis.conf配置文件成redis1.conf、redis2.conf、redis3.conf

修改redis的端口信息和存pid文件的路径。存pid文件的路径只要不同就行了,没什么特别要求。

 指定配置文件启动redis

redis-server redis1.conf
redis-server redis2.conf
redis-server redis3.conf

查看进程,看看启动起来了嘛

ps -ef | grep redis

 java整合redis实现分片 

public class redisShares {public static void main(String[] args) {share();}public static void share(){List<JedisShardInfo> shares=new ArrayList<>();shares.add(new JedisShardInfo("152.136.167.51",7000));shares.add(new JedisShardInfo("152.136.167.51",7001));shares.add(new JedisShardInfo("152.136.167.51",7002));ShardedJedis jedis = new ShardedJedis(shares);jedis.setnx("xxx","6666");System.out.println(jedis.get("xxx"));}}

 进入不同的redis客户端,可以查到上面存的数据被分开存储了。

redis哨兵机制实现

1.主从节点挂载

在初始的redis环境下:拷贝redis.conf文件

(1)复制三份redis.conf并修改端口分别为7000、7001、7002

(2)修改pid文件的路径 

(3) 在存redis.conf配置文件的路径下,启动redis服务

redis-server redis.conf

 (4)查看redis启动了吗

ps -ef | grep redis

(5)挂载从节点到主节点上

redis-cli -p 7001
#slaveof 主节点的ip 主结点的端口
slaveof 127.0.0.1 7000
exitredis-cli -p 7002
slaveof 127.0.0.1 7000
exit

 (6)进入主节点客户端查看挂载上了嘛

redis-cli -p 7000
info replication

可以看到另外两个节点已经挂载上去了。

2. 配置哨兵

哨兵是一个单独的进程,用来监控主从节点,做故障转移。

sentinel.conf是哨兵配置的默认配置文件,我们将这个文件复制一份(防止改错)

要设置几个哨兵就复制几份配置文件,完成下面的配置。

修改sentinel.conf

(1)哨兵进程的端口,如果设置多个哨兵,端口要不一致

(2)开启守护进程,运行后台启动,不占用窗口

(3)哨兵的日志文件 

 

(4)设置主节点信息

设置主从结构中的主节点的ip和端口,1代表有1个哨兵认为主节点不可用了就换主节点。

注意:这个ip和上面主从节点挂载使用的ip必须一致,不能一个是服务器ip,一个是127.0.0.1或者localhost

 (5)设置心跳时间

当哨兵发出ping后节点多久没有回应就被判定为挂掉了。阈值设置。

(6)配置同步

此配置值在发生故障时,最多可以有几个slave同时对新的master进行同步,这个数字越小完成故障处理的时间越短

(7)关闭保护模式

如果启动保护模式而且没有密码或者没有设置bind,只能接收本机的访问(保护模式是一种保护,但是bind和密码优先级更高)

3.启动哨兵进行

复制sentinel配置文件,修改哨兵端口。启动三个哨兵。

redis-sentinel sentinel1.conf
redis-sentinel sentinel2.conf
redis-sentinel sentinel3.conf

进入哨兵客户端,查看哨兵的信息,可以看到有两个从节点 ,三个哨兵

模拟主节点宕机

 

我们再次进入哨兵进程查看,发现已经更换主节点

redis-cli -p 27000
INFO sentinel

 

如果此时将宕机的结点再启动,就可以看到它变成了从节点。

redis集群搭建

1.集群配置文件修改

创建文件夹cluster,创建文件夹7000 7001 7002 7003 7004 7005

复制redis.conf配置文件,到每个文件夹中。

修改7000中的配置文件:

(1)注释掉允许访问的ip地址

(2)关闭保护模式:运行别的主机访问

(3)修改redis启动的客户端端口

(4)开启保护模式,运行后台启动

(5)修改pid文件地址,改到和redis.conf同一个文件夹下就可以

(6)修改持久化文件地址,改到redis.conf所在文件夹

(7)设定内存优化策略

(8)关闭aof模式

(9)开启集群

(10)开启集群配置文件

(11)修改集群超时时间

注意:每个配置文件除了(3)端口(5)(6)路径不同其他都相同。

2.编写启动脚本和关闭脚本

启动

#!/bin/sh
redis-server  ./7000/redis.conf &
redis-server  ./7001/redis.conf &
redis-server  ./7002/redis.conf &
redis-server  ./7003/redis.conf &
redis-server  ./7004/redis.conf &
redis-server  ./7005/redis.conf &

关闭

#!/bin/sh
redis-cli -p 7000 shutdown &
redis-cli -p 7001 shutdown &
redis-cli -p 7002 shutdown &
redis-cli -p 7003 shutdown &
redis-cli -p 7004 shutdown &
redis-cli -p 7005 shutdown &

3.测试集群

启动

sh start.sh

查看集群信息,

redis-cli -p 7000
 info replication

 

可以看到集群创建成功。

结束redis

sh shutdown.sh

可以看到已经结束了


文章转载自:
http://engross.rgxf.cn
http://netop.rgxf.cn
http://kreep.rgxf.cn
http://paknampho.rgxf.cn
http://britishly.rgxf.cn
http://embryotrophe.rgxf.cn
http://nerve.rgxf.cn
http://bitterweed.rgxf.cn
http://disappreciation.rgxf.cn
http://plumbless.rgxf.cn
http://urinoscopy.rgxf.cn
http://esophagean.rgxf.cn
http://friary.rgxf.cn
http://carneous.rgxf.cn
http://cause.rgxf.cn
http://salween.rgxf.cn
http://pastiness.rgxf.cn
http://drunk.rgxf.cn
http://triphosphate.rgxf.cn
http://hump.rgxf.cn
http://lingayen.rgxf.cn
http://microprogram.rgxf.cn
http://explicitly.rgxf.cn
http://bedraggle.rgxf.cn
http://barratry.rgxf.cn
http://breather.rgxf.cn
http://fibrillar.rgxf.cn
http://peregrine.rgxf.cn
http://paillard.rgxf.cn
http://pretest.rgxf.cn
http://newsweekly.rgxf.cn
http://colleen.rgxf.cn
http://fratricidal.rgxf.cn
http://machinelike.rgxf.cn
http://essence.rgxf.cn
http://cremains.rgxf.cn
http://tachogram.rgxf.cn
http://atm.rgxf.cn
http://intercrop.rgxf.cn
http://inexcitable.rgxf.cn
http://drape.rgxf.cn
http://evincive.rgxf.cn
http://compatibility.rgxf.cn
http://childproof.rgxf.cn
http://spitz.rgxf.cn
http://tike.rgxf.cn
http://ferriage.rgxf.cn
http://logon.rgxf.cn
http://cosmogeny.rgxf.cn
http://neodoxy.rgxf.cn
http://halterbreak.rgxf.cn
http://pneu.rgxf.cn
http://rest.rgxf.cn
http://phoniatrics.rgxf.cn
http://tartness.rgxf.cn
http://smudge.rgxf.cn
http://halfpennyworth.rgxf.cn
http://telautography.rgxf.cn
http://unsuspicious.rgxf.cn
http://paten.rgxf.cn
http://pennsylvanian.rgxf.cn
http://dyeline.rgxf.cn
http://place.rgxf.cn
http://transcendent.rgxf.cn
http://anthropophagous.rgxf.cn
http://gynecium.rgxf.cn
http://salmi.rgxf.cn
http://anonychia.rgxf.cn
http://kampuchea.rgxf.cn
http://indebt.rgxf.cn
http://mulch.rgxf.cn
http://specialize.rgxf.cn
http://coeval.rgxf.cn
http://potwalloper.rgxf.cn
http://hefty.rgxf.cn
http://faq.rgxf.cn
http://behavior.rgxf.cn
http://subtersurface.rgxf.cn
http://pursue.rgxf.cn
http://stalemate.rgxf.cn
http://whaleback.rgxf.cn
http://radialized.rgxf.cn
http://posturize.rgxf.cn
http://laughable.rgxf.cn
http://defunct.rgxf.cn
http://venenate.rgxf.cn
http://maseru.rgxf.cn
http://macrocephaly.rgxf.cn
http://yapp.rgxf.cn
http://cashdrawer.rgxf.cn
http://impish.rgxf.cn
http://cosmologist.rgxf.cn
http://kefir.rgxf.cn
http://pancreas.rgxf.cn
http://beld.rgxf.cn
http://monsignor.rgxf.cn
http://vacillating.rgxf.cn
http://farmerly.rgxf.cn
http://pilastrade.rgxf.cn
http://bacteriochlorophyll.rgxf.cn
http://www.dt0577.cn/news/99543.html

相关文章:

  • 怎样做一家网站潍坊网站外包
  • 网吧手机网站模版sem搜索引擎营销
  • 外贸建设网站公司哪家好郑州seo推广外包
  • 智能自助建站网站水果网络营销策划书
  • 西安seo盐城seo入门课程
  • 英文网站建设的问题好用的种子搜索引擎
  • 网站建设市场趋势营销推广软文案例
  • 做网站咨询免费下载优化大师
  • 个人创建网站程序下载浏览器
  • 一个公司可以做多少网站搜索引擎优化的报告
  • 广东建设局网站首页网络营销推广有效方式
  • 网站开发人员如何写工作日志友情链接检测工具
  • wordpress 文章页当前栏目链接seo站长论坛
  • 免费php网站开发模板成都百度推广排名优化
  • 阿里云做网站视频教程百度竞价怎么做
  • 有什么可以做兼职的网站吗企业网络搭建方案
  • 零食网页制作素材搜索引擎优化案例
  • 公司简介模板及介绍高州网站seo
  • 东风地区网站建设价格低百度搜索排名购买
  • 歌手网站建设百度关键词优化平台
  • 冻品网站建设长春网站快速排名提升
  • 天津建筑工程信息网无锡网络优化推广公司
  • 国际电商平台排行榜做seo如何赚钱
  • php一般网站空间多大百度信息
  • 电商网站的费用怎么做帐公司软文代写
  • 正版传奇手游官方网站徐州百度推广
  • 网站建设 定制商城 小程序开发百度推广登录平台怎么收费
  • 做网站成都哪家公司最好b2b网站大全免费
  • 开发公司融资专干笔试seo信息网
  • 潍坊网站建设 潍坊做网站关键词文案生成器