redis数据库把它分散到两台机器
阿神
阿神 2017-04-21 10:57:02
[Redis讨论组]

我有一个4G的redis数据库,现在已经存在,我想要把它分散到两台机器,一台机器2G,该怎么做?

看了一下redis cluster,都是讲单点失败,主从复制,这个不是我的需求。

sf的redis服务器是多大的内存?

阿神
阿神

闭关修行中......

全部回复(3)
大家讲道理

可以使用3L的做法,或者最直接的办法就是在业务层把数据分开,写在配置里面就可以了,这样以后在拆分的时候会很方便,逻辑也简单,如果真的需要做分布式,建议使用mongoDB

怪我咯

问一下,twemproxy是不是不支持主备自动切换?

巴扎黑

如果你是用redis cluster来做这个数据迁移的话,可以看看其官方的介绍:
Assuming you have your preexisting data set split into N masters, where N=1 if you have no preexisting sharding, the following steps are needed in order to migrate your data set to Redis Cluster:
Stop your clients. No automatic live-migration to Redis Cluster is currently possible. You may be able to do it orchestrating a live migration in the context of your application / environment.
Generate an append only file for all of your N masters using the BGREWRITEAOF command, and waiting for the AOF file to be completely generated.
Save your AOF files from aof-1 to aof-N somewhere. At this point you can stop your old instances if you wish (this is useful since in non-virtualized deployments you often need to reuse the same computers).
Create a Redis Cluster composed of N masters and zero slaves. You'll add slaves later. Make sure all your nodes are using the append only file for persistence.
Stop all the cluster nodes, substitute their append only file with your pre-existing append only files, aof-1 for the first node, aof-2 for the second node, up to aof-N.
Restart your Redis Cluster nodes with the new AOF files. They'll complain that there are keys that should not be there according to their configuration.
Use redis-trib fix command in order to fix the cluster so that keys will be migrated according to the hash slots each node is authoritative or not.
Use redis-trib check at the end to make sure your cluster is ok.
Restart your clients modified to use a Redis Cluster aware client library.w

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号