Comments (12)
2013/10/30 Alex.F [email protected]
代码里面好像默认直接写死了用16个bucket,bucket的分布是根据key的hash来确定,有办法手动指定bucket分布不?
beanseye 里面硬编码了 16 个 bucket, 是指以数据的 1/16
为单位进行分配,如果N=2,就最多允许有32个节点,每个节点有1/16的数据。如果现在有4台beansdb,N=2,
W=3。然后其中一台机器挂掉了(这台机器数据全部丢失),如何能恢复这台机器?我知道应该是可以通过其他的机器恢复数据,不知道有没有现成的方法,还是直接把其他所有的数据都同步一份过来?beanseye 默认会自动发现各个节点的数据分布来实现路由,不需要手动分配。
当需要手动对数据分配进行管理时,只需要用rsync 来拷贝若干个子目录(1/16的数据)到新的节点,
具体的做法可以是这样(迁移 A 节点上的 一个区间 F/ 需要迁移到B节点上, 假定数据目录是/data):
- 将 节点 B 添加到 beanseye 的配置文件中,并重启它
- rsync -auv --append A:/data/F/ B:/data/FF/
先将数据拷贝到临时目录, 如果数据量比较大,拷贝完了后可以再执行一遍,减少数据差异。 - 关闭 B 节点上的 beansdb
- B$ rm /data/F -r 删除可能的空目录
B$ mv /data/FF /data/F 将临时目录换成正式目录 - 启动 B 节点上的 Beansdb
- 如果A上的数据不需要了,关闭 A 上的 beansdb, rm -r /data/F/ , 再启动 beansdb
如果是恢复 B 上的数据,这一步就不需要做了。 - 运行 sync.py 来同步 B 和其它节点上得上的 F 区间的数据,达到一致。
如果需要迁移多个区间,是可以一次做完的。多台机器的话,最好一台一台地来。
还有如果现在用了4台beansdb,想再加一台beansdb,现有在使用一致性hash基础上,该如何做?
在beansdb机器数目发生改变的时候,是通过什么方法来保证数据的备份数(即N是配置文件里面设置的数目)?
N 是配置文件里面设的,是beanseye 会尝试去找 N 个不同节点来写数据,至少有 W 个成功时则认为成功,因此 必须 W <=
N。如果配置文件中 W > N, 会调整成N。—
Reply to this email directly or view it on GitHubhttps://github.com//issues/2
.
- Davies
from beanseye.
如果使用 beanseye ,就不需要定期使用 sync.py 对数据进行同步了,beanseye 自动做了这个步骤?
from beanseye.
没有,仍然是需要的。
On Oct 31, 2013 1:28 AM, "Alex.F" [email protected] wrote:
如果使用 beanseye ,就不需要定期使用 sync.py 对数据进行同步了,beanseye 自动做了这个步骤?
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-27469265
.
from beanseye.
使用beanseye管理4个beansdb服务器,设置N=2,beanseye会自动将内容分配到4台beansdb上面,并且保证每一份数据都有2份。那什么时候需要定期运行sync.py?
from beanseye.
最好设定定时任务,每分钟运行。如果数据没有差异,它会很快退出。
from beanseye.
数据在存储的时候,会根据key算出存储到哪个bucket,然后查询该bucket存储的服务器(beanseye里面好像是默认每个bucket会存储到每台beansdb服务器上面),然后根据负载什么的算出实际需要存储的N个服务器,并写入。
当N小于服务器数目的时候,实际上只有N台服务器会写入同一份数据,其他服务器是没有这些数据。也就是有4个服务器,N=2情况下,1 2写入A数据,1 3 写入B数据, 1 4写入C数据, 2 3写入 D数据, 2 4 写入 E数据, 3 4写入 F数据,那sync.py 该怎么运行?
from beanseye.
2013/10/31 Alex.F [email protected]
数据在存储的时候,会根据key算出存储到哪个bucket,然后查询该bucket存储的服务器(beanseye里面好像是默认每个bucket会存储到每台beansdb服务器上面),然后根据负载什么的算出实际需要存储的N个服务器,并写入。
当N小于服务器数目的时候,实际上只有N台服务器会写入同一份数据,其他服务器是没有这些数据。也就是有4个服务器,N=2情况下,1 2写入A数据,1 3
写入B数据, 1 4写入C数据, 2 3写入 D数据, 2 4 写入 E数据, 3 4写入 F数据,那sync.py 该怎么运行?目前 sync.py 里面没有实现自动发现数据分布的逻辑,需要手动把实际数据分布写入到 dbclient.py
里面的配置中。你可以尝试实现以下自动发现,大概思路就是用 get('@')
获得每个节点的各个区间的数据量,然后每个区间选择数据量最大的N个节点作为数据分布节点,对这些节点尽量两两同步。—
Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-27549812
.
- Davies
from beanseye.
通过proxy 一份数据x写W份,并且记录分布在那几台机器上(比如 a c f 机器上)
那别的proxy怎么知道x数据写到a c f机器上了
from beanseye.
所有proxy的配置文件是一样的
from beanseye.
还有就是数据怎么平均的落到每个节点
from beanseye.
proxy根据key做hash,决定写哪个bucket(0-f),每个bucket的三个后端都会被写,写成功W个就认为写成功。
from beanseye.
谢谢你的回答,但我还是觉得没有解决数据比较平均分配到每台机器的上面。
就比较来了9百万的数据,结果有hash后有5百万的key落到了bucket 1上,这样就导致bucket 1上数据比较多了。能否提供下你的mail 联系?
from beanseye.
Related Issues (9)
- May I use it as a restful service? HOT 1
- AutoScheduler的数据分布问题 HOT 5
- It has two configuration file under conf directory, which one should I use? HOT 3
- Could you help me to use some config options about yaml config file? HOT 1
- have some questions about yaml conf file, I have to ask you again. HOT 1
- 编译beanseye 出错:make: *** [dep] 错误 2 HOT 4
- run beanseye error: panic: runtime error: index out of range
- panic: runtime error: index out of range
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from beanseye.