【发布时间】:2016-05-04 01:13:06
【问题描述】:
我的服务器上启动了一个 postgres 服务器,用于创建云形成模板。问题是我不确定如何让它在运行时加载文件,正确的用户或命令是什么:
我试过这个:
May 2 13:50:16 ip-10-205-0-135 cloud-init: 2016-05-02 13:50:16 (31.1 MB/s) - ‘psqlCloudera.sql’ saved [876/876]
May 2 13:50:16 ip-10-205-0-135 cloud-init: psql -U postgres -a -f psqlCloudera.sql
May 2 13:50:16 ip-10-205-0-135 cloud-init: psql: FATAL: Peer authentication failed for user "postgres"
和这样有点不同:
它在我的用户数据中涉及“su - postgres \n”。
May 2 13:31:05 ip-10-205-0-135 cloud-init: Saving to: ‘psqlCloudera.sql’
May 2 13:31:05 ip-10-205-0-135 cloud-init: 0K 100% 36.2M=0s
May 2 13:31:05 ip-10-205-0-135 cloud-init: 2016-05-02 13:31:05 (36.2 MB/s) - ‘psqlCloudera.sql’ saved [876/876]
May 2 13:31:05 ip-10-205-0-135 cloud-init: psql -a -f psqlCloudera.sql
May 2 13:31:05 ip-10-205-0-135 cloud-init: psql: FATAL: role "root" does not exist
在启动时加载 postgres 的正确方法是什么?
【问题讨论】:
标签: postgresql amazon-cloudformation