2013-05-21 43 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