12
返回列表 发新帖
楼主: jieforest

Cassandra.io RESTful APIs

[复制链接]
论坛徽章:
277
马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11版主9段
日期:2012-11-25 02:21:03ITPUB年度最佳版主
日期:2014-02-19 10:05:27现任管理团队成员
日期:2011-05-07 01:45:08
11#
 楼主| 发表于 2012-9-16 11:26 | 只看该作者
The runtime result is:
  1. 01.09-Sep-2012 22:59:18 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  2. 02.INFO: API URL: https://api.cassandra.io/1/keyspace/AAPL/
  3. 03.Success | Keyspace added successfully. | null
  4. 04.09-Sep-2012 22:59:21 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  5. 05.INFO: API URL:https://api.cassandra.io/1/columnfamily/AAPL/MarketData/UTF8Type/
  6. 06.Success | MarketData ColumnFamily created successfully | null
  7. 07.09-Sep-2012 22:59:24 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  8. 08.INFO: API URL:https://api.cassandra.io/1/column/AAPL/MarketData/Open/UTF8Type/?isIndex=true
  9. 09.Failed | Unable to create Column: Open | Cassandra encountered an internal error processing this request: TApplicationError type: 6 message:Internal error processing system_update_column_family
  10. 10.09-Sep-2012 22:59:24 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  11. 11.INFO: API URL:https://api.cassandra.io/1/column/AAPL/MarketData/Close/UTF8Type/?isIndex=true
  12. 12.Success | Close Column upserted successfully | null
  13. 13.09-Sep-2012 22:59:26 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  14. 14.INFO: API URL:https://api.cassandra.io/1/column/AAPL/MarketData/High/UTF8Type/?isIndex=true
  15. 15.Success | High Column upserted successfully | null
  16. 16.09-Sep-2012 22:59:27 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  17. 17.INFO: API URL:https://api.cassandra.io/1/column/AAPL/MarketData/Low/UTF8Type/?isIndex=true
  18. 18.Success | Low Column upserted successfully | null09-Sep-2012 22:59:29 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  19. 19.INFO: API URL:https://api.cassandra.io/1/column/AAPL/MarketData/Volume/UTF8Type/?isIndex=true
  20. 20. 
  21. 21.Success | Volume Column upserted successfully | null
  22. 22.09-Sep-2012 22:59:30 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  23. 23.INFO: API URL:https://api.cassandra.io/1/column/AAPL/MarketData/AdjClose/UTF8Type/?isIndex=true
  24. 24.Success | AdjClose Column upserted successfully | null
  25. 25.Posting JSON: {"rowkeys":[{"rowkey":"18-05-2012","columns":[{"columnname":"Open","columnvalue":"533.96","ttl":0},{"columnname":"Close","columnvalue":"530.38","ttl":12000},{"columnname":"High","columnvalue":"543.41","ttl":12000},{"columnname":"Low","columnvalue":"522.18","ttl":12000},{"columnname":"Volume","columnvalue":"26125200","ttl":12000},{"columnname":"AdjClose","columnvalue":"530.12","ttl":12000}]}]}
  26. 26.09-Sep-2012 22:59:32 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  27. 27.INFO: API URL: https://api.cassandra.io/1/data/AAPL/MarketData/
  28. 28.Success | Bulk upload successfull. | null
  29. 29.09-Sep-2012 22:59:32 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  30. 30.INFO: API URL: https://api.cassandra.io/1/data/AAPL/MarketData/18-05-2012/
  31. 31.{Volume=26125200, Open=533.96, Low=522.18, High=543.41, Close=530.38, AdjClose=530.12}
  32. 32.09-Sep-2012 22:59:32 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  33. 33.INFO: API URL: https://api.cassandra.io/1/keyspace/AAPL/
  34. 34.Success | Keyspace dropped successfully. | null
复制代码

使用道具 举报

回复
论坛徽章:
277
马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11版主9段
日期:2012-11-25 02:21:03ITPUB年度最佳版主
日期:2014-02-19 10:05:27现任管理团队成员
日期:2011-05-07 01:45:08
12#
 楼主| 发表于 2012-9-16 11:27 | 只看该作者
The runtime result is:
  1. 01.09-Sep-2012 22:59:18 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  2. 02.INFO: API URL: https://api.cassandra.io/1/keyspace/AAPL/
  3. 03.Success | Keyspace added successfully. | null
  4. 04.09-Sep-2012 22:59:21 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  5. 05.INFO: API URL:https://api.cassandra.io/1/columnfamily/AAPL/MarketData/UTF8Type/
  6. 06.Success | MarketData ColumnFamily created successfully | null
  7. 07.09-Sep-2012 22:59:24 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  8. 08.INFO: API URL:https://api.cassandra.io/1/column/AAPL/MarketData/Open/UTF8Type/ isIndex=true
  9. 09.Failed | Unable to create Column: Open | Cassandra encountered an internal error processing this request: TApplicationError type: 6 message:Internal error processing system_update_column_family
  10. 10.09-Sep-2012 22:59:24 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  11. 11.INFO: API URL:https://api.cassandra.io/1/column/AAPL/MarketData/Close/UTF8Type/ isIndex=true
  12. 12.Success | Close Column upserted successfully | null
  13. 13.09-Sep-2012 22:59:26 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  14. 14.INFO: API URL:https://api.cassandra.io/1/column/AAPL/MarketData/High/UTF8Type/ isIndex=true
  15. 15.Success | High Column upserted successfully | null
  16. 16.09-Sep-2012 22:59:27 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  17. 17.INFO: API URL:https://api.cassandra.io/1/column/AAPL/MarketData/Low/UTF8Type/ isIndex=true
  18. 18.Success | Low Column upserted successfully | null09-Sep-2012 22:59:29 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  19. 19.INFO: API URL:https://api.cassandra.io/1/column/AAPL/MarketData/Volume/UTF8Type/ isIndex=true
  20. 20.
  21. 21.Success | Volume Column upserted successfully | null
  22. 22.09-Sep-2012 22:59:30 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  23. 23.INFO: API URL:https://api.cassandra.io/1/column/AAPL/MarketData/AdjClose/UTF8Type/ isIndex=true
  24. 24.Success | AdjClose Column upserted successfully | null
  25. 25.Posting JSON: {"rowkeys":[{"rowkey":"18-05-2012","columns":[{"columnname":"Open","columnvalue":"533.96","ttl":0},{"columnname":"Close","columnvalue":"530.38","ttl":12000},{"columnname":"High","columnvalue":"543.41","ttl":12000},{"columnname":"Low","columnvalue":"522.18","ttl":12000},{"columnname":"Volume","columnvalue":"26125200","ttl":12000},{"columnname":"AdjClose","columnvalue":"530.12","ttl":12000}]}]}
  26. 26.09-Sep-2012 22:59:32 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  27. 27.INFO: API URL: https://api.cassandra.io/1/data/AAPL/MarketData/
  28. 28.Success | Bulk upload successfull. | null
  29. 29.09-Sep-2012 22:59:32 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  30. 30.INFO: API URL: https://api.cassandra.io/1/data/AAPL/MarketData/18-05-2012/
  31. 31.{Volume=26125200, Open=533.96, Low=522.18, High=543.41, Close=530.38, AdjClose=530.12}
  32. 32.09-Sep-2012 22:59:32 io.cassandra.sdk.CassandraIoSDK constructAPIUrl
  33. 33.INFO: API URL: https://api.cassandra.io/1/keyspace/AAPL/
  34. 34.Success | Keyspace dropped successfully. | null
复制代码

使用道具 举报

回复
论坛徽章:
277
马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11版主9段
日期:2012-11-25 02:21:03ITPUB年度最佳版主
日期:2014-02-19 10:05:27现任管理团队成员
日期:2011-05-07 01:45:08
13#
 楼主| 发表于 2012-9-16 11:27 | 只看该作者
Analysis

Step 1./ The code creates a keyspace named AAPL using HTTP POST, url: https://api.cassandra.io/1/keyspace/AAPL/It uses KeySpaceAPI class with Token and AccountId as parameters for the constructor. Token is used as username, while AccountID is the password. (Remember: these attributes can be retrieved usingheroku config command or via Heroku Admin console)

Step 2./ Then the code creates a column family called MarketData.It uses ColumnFamilyAPI – with the credentials mentioned above – and the REST url is https://api.cassandra.io/1/colum ... rketData/UTF8Type/.

使用道具 举报

回复
论坛徽章:
277
马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11版主9段
日期:2012-11-25 02:21:03ITPUB年度最佳版主
日期:2014-02-19 10:05:27现任管理团队成员
日期:2011-05-07 01:45:08
14#
 楼主| 发表于 2012-9-16 11:28 | 只看该作者
Analysis

Step 1./ The code creates a keyspace named AAPL using HTTP POST, url: https://api.cassandra.io/1/keyspace/AAPL/It uses KeySpaceAPI class with Token and AccountId as parameters for the constructor. Token is used as username, while AccountID is the password. (Remember: these attributes can be retrieved usingheroku config command or via Heroku Admin console)

Step 2./ Then the code creates a column family called MarketData.It uses ColumnFamilyAPI – with the credentials mentioned above – and the REST url is https://api.cassandra.io/1/colum ... rketData/UTF8Type/.

使用道具 举报

回复
论坛徽章:
277
马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11版主9段
日期:2012-11-25 02:21:03ITPUB年度最佳版主
日期:2014-02-19 10:05:27现任管理团队成员
日期:2011-05-07 01:45:08
15#
 楼主| 发表于 2012-9-16 11:29 | 只看该作者
Step 3./ Then the code upserts the coumns called Open, Close, High, Low, Volume and AjdClose. It uses ColumnAPI – same credentials as we already know – and the REST url is https://api.cassandra.io/1/column/AAPL/MarketData/Open/UTF8Type/ isIndex=true where AAPL is the keyspace, MarketData is the column family and Open is the column.

Step 4./ Then the code prepares the data as name/value pairs (Open = “533.96″, Close = “530.38″, etc), defines a rowkey (“18-05-2012″) and the uses DataAPI postBulkData method to upload the data into Cassandra.io. DataAPI credentials are the same as above.

使用道具 举报

回复
论坛徽章:
277
马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11版主9段
日期:2012-11-25 02:21:03ITPUB年度最佳版主
日期:2014-02-19 10:05:27现任管理团队成员
日期:2011-05-07 01:45:08
16#
 楼主| 发表于 2012-9-17 09:30 | 只看该作者
Step 5./ The code then fetches the data using HTTP GET with url: https://api.cassandra.io/1/data/AAPL/MarketData/18-05-2012/. The response is in JSON format: {Volume=26125200, Open=533.96, Low=522.18, High=543.41, Close=530.38, AdjClose=530.12}

Step 6./ Finally the code destroys the keyspace using HTTP DELETE, url: https://api.cassandra.io/1/keyspace/AAPL/.

使用道具 举报

回复
论坛徽章:
277
马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11版主9段
日期:2012-11-25 02:21:03ITPUB年度最佳版主
日期:2014-02-19 10:05:27现任管理团队成员
日期:2011-05-07 01:45:08
17#
 楼主| 发表于 2012-9-17 09:31 | 只看该作者
Summary

If you want to try out a robust, highly available  Casssandra datastore without any upfront infrastructure investment and with an easy to use API, you can certainly have a closer look at Cassandra.io on Heroku. It takes only a few minutes to start up and the APIs offer a simply REST based data management for Java, Ruby and PHP developers.

使用道具 举报

回复
论坛徽章:
277
马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11版主9段
日期:2012-11-25 02:21:03ITPUB年度最佳版主
日期:2014-02-19 10:05:27现任管理团队成员
日期:2011-05-07 01:45:08
18#
 楼主| 发表于 2012-9-17 09:31 | 只看该作者
over.

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表