Riak, haproxy, and client side applications

本文介绍了将本地PhosGL开发从Django应用迁移到使用Riak搜索集群和haproxy的过程。通过创建不同类型的存储桶来管理各种资源,并利用JavaScript直接将新文档放入Riak键值存储中。同时,为了方便版本管理和回滚更改,作者计划引入UUID以实现更加灵活的部署和更新策略。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转载:http://blog.dloh.org/Riak,-haproxy,-and-client-side-applications

Last night I switched my local PhosGL development from a django app to running a riaksearch cluster fronted by haproxy. The amount of change required was mapping the old urls to the new riak buckets. I created buckets for objects, images, sounds, shaders, and models. I also created an application bucket that serves the default HTML document. The immediate advantage of this is I can now have JavaScript PUT new documents directly into the riak key value store. For primay source control, I have a git-hook which calls the 'make install' script which rebuilds the MANIFEST file, revs it's version, and curls all of the files in version control into their appropriate buckets.

Currently since this deployment scheme is destructive, rolling back changes is just a matter of reversing the commit and having the make install command run. In the not too distant future I'm going to integrate a UUID script to generate universally unique ids for each object in the datastore, and use a client side router object which manages mapping canonical names to UUIDs.

The advantage here is that publishing a single routing table is all that is necessary to do a release, and reverting changes just amounts to pushing the old route object. The other very clever bit is I can publish a timeline object which contains routes to all the previous route objects, and run the app as it existed at any point in time.

Since I already have a module loader and data access layer, it only requires a minimal prefetch and one indirection in the use method to imement. This same interface can also support PUT for revisions of objects wherein each revision merely puts a new object and the UUID mapping can generate future routes and not deploy them. This way I can build for a future release in place and it will simply be a matter of updating the canonical route object with the appropriate UUID.

This is obviously really simple, as we only use HTTP GET and PUT. Riak handles distribution, and haproxy multiplexes and loadbalances. But the coolest bit is search. Because I am storing code and data in a Solr indexed key value store, my application can discover documents and objects via search. More over using a got-hook to publish diffs to the key value store allows us to search for changes. Finally since every entity will have a UUID, it is possible to search for every version of an object that ever implemented or called a method, protocol, or referenced a static or global entity.

Once the WebGL editor is nice enough with a subset of vi commands my fingers refuse to unlearn, I will probably stop using git entirely. This will mean implementing diff in JavaScript, but someone has probably done that already.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值