【问题标题】:Seahorse::Client::NetworkingError: Connection refused - connect(2) for "localhost" port 8000Seahorse::Client::NetworkingError: Connection denied - connect(2) for "localhost" port 8000
【发布时间】:2017-07-03 14:41:46
【问题描述】:

我正在构建一个 Rails 应用程序,我使用 dynamodb(使用 dynamoid)作为数据库。对于测试,我使用 dynamodb-local。

当我从命令行进入测试数据库时,出现以下错误。

Seahorse::Client::NetworkingError: Connection denied - connect(2) for “本地主机”端口 8000

config/initializers/dynamoid.rb

AWS_CONFIG = YAML.load_file("#{Rails.root}/config/aws.yml")[Rails.env]

Dynamoid.configure do |config|
  config.adapter = 'aws_sdk_v2' 
  config.namespace = AWS_CONFIG['namespace']
  config.warn_on_scan = false # Output a warning to the logger when you perform a scan rather than a query on a table.
  config.read_capacity = 5 # Read capacity for tables, setting low
  config.write_capacity = 5 # Write capacity for your tables
end


if Rails.env.test? || ENV['ASSET_PRECOMPILE'].present?
  p "Comes here"
  Aws.config[:ssl_verify_peer] = false
    Aws.config.update({
      credentials: Aws::Credentials.new('xxx','xxx'),
      endpoint: 'https://localhost:8000',
      region: 'us-west-2'
      })

瑞克文件:

 task :start_test_dynamo do
  FileUtils.cd('rails-root') do
    sh "rake dynamodb:local:test:start"
    sh "rake dynamodb:seed"
  end
 end

【问题讨论】:

    标签: ruby-on-rails ruby amazon-ec2 rspec rspec-rails


    【解决方案1】:

    检查两件事

    • 您的dynamodb-local 已加载?

    • 您的端点是否正确?

    https://localhost:8000 更改为http://localhost:8000(删除s

    【讨论】:

      猜你喜欢
      • 2016-01-27
      • 2019-07-15
      • 1970-01-01
      • 1970-01-01
      • 2022-01-14
      • 1970-01-01
      • 1970-01-01
      • 2020-05-16
      • 2021-12-16
      相关资源
      最近更新 更多