Elastic Beanstalk - RDS Postgres - 密码验证失败

时间:2014-09-22 07:43:16

标签: postgresql amazon-web-services elastic-beanstalk

我在Elastic Beanstalk上设置了我的Rails应用程序。但是当我在asset:precompile期间在Rails尝试访问数据库时部署它时,它会从Postgres遇到此错误:

2014-09-21 21:28:35,302 [INFO] (7941 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Output from script: running 'bundle exec rake assets:precompile'...
/usr/local/share/gems1.9/gems/bundler-1.6.2/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /var/app/ondeck/vendor/bundle/ruby/1.9.1/bin in PATH, mode 040777
rake aborted!
PG::ConnectionBad: FATAL:  password authentication failed for user "ebroot"
FATAL:  password authentication failed for user "ebroot"
/var/app/ondeck/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:831:in `initialize'
/var/app/ondeck/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:831:in `new'

这是我的database.yml

production:
  adapter: postgresql
  encoding: unicode
  database: <%= ENV['RDS_DB_NAME'] %>
  username: <%= ENV['RDS_USERNAME'] %>
  password: <%= ENV['RDS_PASSWORD'] %>
  host: <%= ENV['RDS_HOSTNAME'] %>
  port: <%= ENV['RDS_PORT'] %>

我在optionsettings文件中有以下配置:

[aws:rds:dbinstance]
DBDeletionPolicy=Snapshot
DBEngine=postgres
DBInstanceClass=db.t1.micro
DBSnapshotIdentifier=
DBUser=ebroot

在RDS的AWS管理控制台中,我检查过用户名仅为ebroot。但它没有联系。

谢谢!


编辑:

好的,我已经连接到实例并试图找出为RDS_PASSWORD设置的值,令我惊讶的是它只是密码的前四个字符!

为什么会发生这种情况?

1 个答案:

答案 0 :(得分:1)

如果连接成功,您需要尝试。

试试这个

1登录你的eb
eb ssh sampleapp-env

2个触发连接

nc -vz your_eb.endpoint_url 5432