Cassandra in Action with Twitter's Ruby Client
ÓÐÒ»¸öȫеÄÏîÄ¿£¬ÒòΪ¿¼Âǵ½½«À´µÄÊý¾ÝÀ©Õ¹ÐÔÄÜ£¬ËùÒÔ¿¼ÂÇÓÃCassandra×öÊý¾Ý´æ´¢£¬Ç°¶ËÓÃLighttpd + FastCGI + Rails¡£ÔÚʹÓÃCassandraµÄʱºò£¬¾õµÃÓÐһЩ¶«Î÷¿ÉÄÜ´ó¼Ò¶¼ÐèÒª£¬¾ÍдÁËÒ»¸ö¼òµ¥µÄÖ¸ÄÏ¡£ÒòΪÄÚÈݱȽϳ¤£¨16Ò³£©£¬¾ÍŪÁ˸öPDFÎļþ¸ø´ó¼ÒÏÂÔØ¡£
Cassandra in Action with Twitter's Ruby Client.pdf
Èç¹ûÏÂÔØÁ´½ÓÓÐÎÊÌ⣬Çë¸øÎÒÓʼþ£ºspanzhang@gmail.com¡£ÐèҪ˵Ã÷һϵÄÊÇ£¬Õâ¸öÖ¸ÄÏÊÇÓÃÓ¢ÓïдµÄ£¬²»¹ý¶¼ÊÇЩºÜ¼òµ¥µÄ¾ä×Ó£¬ÏàÐÅÓÐËļ¶Ó¢Óï¾Í¿ÉÒÔºÁ²»·ÑÁ¦µÄ¿´Ã÷°×¡£ÏÂÃæ°ÑÎÄÕµÄÒýÎÄ·ÅÕâÀ¹©´ó¼Ò²Î¿¼£¬Äã¿ÉÒÔ¿´¿´Êʲ»ÊʺÏÄãµÄÐèÒª£º
Okay, let me get something straight. I’m not going to persuade you to use Cassandra. I just assume you have already chosen Cassandra as your storage solution. Maybe you know the basic things, the underneath mechanisms, about Cassandra or maybe not. Anyway, I assume you don’t care what makes Cassandra outstanding and you just want to use it. If that’s the case, this tutorial is going to help you, in these 3 aspects:
1) to set up the environment correctly,
2) to understand how to model you data in a Cassandra way,
3) to understand and use Twitter’s Cassandra Ruby client.
After reading this tutorial, you should have a working environment and can start your project with a good understanding of doing your job in a very Cassandra way. Here we go!
Ïà¹ØÎĵµ£º
¿ª·¢»·¾³
OS£ºWindowsXP
Ruby: Ruby1.9.1
Rails: Rails2.3.5
IDE: RubyMine2.0.1
1¡¢´´½¨Rails¹¤³Ì
2¡¢ÐÞ¸Ä /config/database.yml
×Ô¶¯´´½¨µÄ¹¤³ÌÖÐĬÈÏÊý¾Ý¿âÁ¬½ÓµÄÊÇsqlite£¬Èç¹ûûÓа²×°´ËÊý¾Ý¿â£¬ÐèÒªÐ޸ĸÃÅäÖ㨱¾ÀýÖÐʹÓõÄÊÇmysql£©
# Mysql Version 5.1.46
development:
adapter: mysql
database: ......
Ç°ÑÔ
ÔÚ¡¶RoutingµÄÔØÈë¡·ÖУ¬ÎÒ´óÖ½éÉÜÁËÒ»ÏÂRailsÖÐ×î¼òµ¥µÄrouteÊÇÈçºÎ¼ÓÔصġ£ÕâƪÎÄÕ£¬ÎÒ½«À´½²Ò»½²RailsϵͳÖиüΪ¸´ÔÓµÄnamed routeºÍÓëRESTfulÏà¹ØµÄresourceÊÇÈçºÎ±»¼ÓÔصġ£ÎªÁ˲»Öظ´Ì«¶àµÄ±ÊÄ«£¬ÕâƪÎÄÕ½«ÔÚÇ°ÎĵĻù´¡ÉϽøÐУ¬Èç¹û·¢ÏÖµ¥¶À¿´´ËÎÄʱ£¬ÓÐÉÙÐíÔÆÀïÎíÀ½¨ÒéÏÈ¿´Ò»¿´ÎÒµÄǰƪÎÄÕ£ºR ......
RESTfulµÄ»¯Éí----resource
µ±È»£¬¹â°ÑRESTfulºÍresource³¶µ½Ò»ÆðËƺõÏ൱ÏÁÒ壬ÔÚRailsÖУ¬ActionController::Resources³éÏóÁËRESTÖеÄResource£¬ÕâÀÎÒ²»Ì¸RESTµÄÏà¹Ø¸ÅÄÍøÉÏ×ÊÁÏÒ»´óÛç¡£ÎÒÃǾÍÀ´¿´¿´RailsÖÐÊÇÈçºÎͨ¹ýResourceÀ´ÇáËÉ£¬¼ò±ãµÄÍê³ÉRESTfulÓ¦Óõİɡ£
resources.rb
Ô´´úÂë ......
¿ª·¢»·¾³
Ruby: Ruby1.9.1
Rails: Rails2.3.5
Mysql:Mysql5.0.9
Driver:mysql-2.8.1-x86-mingw32.gem
IDE:Rubymine2.0.1
Ò»¡¢´´½¨Êý¾Ý±íUsers
ÀûÓÃRubyMine×Ô´øµÄScaffold¹¤¾ß´´½¨Êý¾Ý±íUsers£¬Ò²¿ÉÒÔÊÖ¶¯´´½¨
¶þ¡¢´´½¨ControllerºÍView
RubyÏîÄ¿—>ÓÒ¼ü—>Create Model
Íê³Éºó½«×Ô¶¯Éú³ÉÏàÓ¦µÄÎ ......
Bignum
+ ¼Ó
- ¼õ
* ³Ë
/ ³ý
** Ö¸Êý²Ù×÷2**2 Òâ˼ÊÇ2µÄƽ·½
<=> ´óÓÚ, ......