2013-05-21 110 views
1

我试图开发一个应用程序,它使用AWS中的dynamoDB作为数据库。我一直在用动力宝石尝试过去的两天,但我正要把我的电脑从窗户外面扔出去。ruby​​ rails dynamo db教程

http://blog.megam.co/archives/201

https://github.com/aws/aws-sdk-ruby

https://github.com/Veraticus/Dynamoid

没有任何人知道一个教程了吗?

我开始了一个新的Rails应用

rails new newApp -O 

加入Gemfile中:

gem 'execjs' 
gem 'therubyracer' 
gem 'aws-sdk' 
gem 'dynamoid' 

然后我做了

bundle install 

以下这一点,我创建了两个初始化: dynamoid.rb :

Dynamoid.configure do |config| 
     config.adapter = 'aws_sdk' # This adapter establishes a connection to the DynamoDB servers using Amazon's own AWS gem. 
     config.namespace = "dev" # To namespace tables created by Dynamoid from other tables you might have. 
     config.warn_on_scan = true # Output a warning to the logger when you perform a scan rather than a query on a table. 
     config.partitioning = true # Spread writes randomly across the database. See "partitioning" below for more. 
     config.partition_size = false#200 # Determine the key space size that writes are randomly spread across. 
     config.read_capacity = 1 # Read capacity for your tables 
     config.write_capacity = 1 # Write capacity for your tables 
    end 

和AWS-sdk.rb:

require "aws" 
    AWS.config({ 
     :access_key_id => '##########', 
     :secret_access_key => '#############################', 
    })      

当我这样做

rails s 

它只是不加载

回答

0

的DynamoDB宝石与轨道4的错误本地主机。

  1. 发布您的错误,当你哟ü型号导轨s
  2. 你使用的是Rails 4还是Rails 3?

我们的Rails项目使用动力类型https://github.com/indykish/nilavu和fake_dynamo。

我们不使用AWS-sdk.rb,但它与aws.yml

development: 

bucket: megam 
use_ssl: false 
access_key_id: <acess_key> 
secret_access_key: <secret> 
#dynamo_db_endpoint: localhost 
#dynamo_db_port: 4567 
#dynamo_db_endpoint: dynamodb.ap-southeast-1.amazonaws.com # Set the regional endpoint 
+0

感谢的作品!不幸的是我正在使用rails3。 我刚带走了fake_dynamo。相反,我正在直接开发aws。一旦一切都完美了,我将把命名空间改为“pro”。 – user2376068