pg_restore 使用 ssl 证书
pg_restore using ssl certs
有人可以帮助我使用 SSL 证书恢复 postgres 数据库吗?我尝试了以下方法,但没有用
pg_restore "host=hostname user=username dbname=database_name sslcert=sslcert.crt sslkey=sslkey.key sslrootcert=sslroot.pem sslmode=verify-full" -f filename
它给出以下错误
pg_restore: [archiver] could not open input file "host=hostname user=username dbname=database_name sslcert=sslcert.crt sslkey=sslkey.key sslrootcert=sslroot.pem sslmode=verify-full": No such file or directory
pg_restore
的参数不是连接字符串,而是要恢复的文件。您使用 -d
选项指定连接字符串:
pg_restore -d "host=..." filename
您可以通过这种方式指定任何参数。一个更详细的例子是:
pg_restore --format=custom -d "port=5432 host=<hostname>
user=<username> dbname=<dbname> sslrootcert=root.crt
sslkey=server.key sslcert=server.crt sslmode=verify-ca" ../filename.dump -v
请参考文档here。
@Laurenz Albe's 答案很正确。这只是包含 SSL 证书的答案的扩展版本。
pg_restore --format=custom -d "port=5432 host=<hostname>
user=<username> dbname=<dbname> sslrootcert=root.crt
sslkey=server.key sslcert=server.crt sslmode=verify-ca" ../filename.dump -v
请参考文档here。
我在我的数字海洋案例中使用了这个...
pg_restore --clean -d 'postgresql://USER:qfdvr2ata7opidy4@HOST:PORT/DATABASE?sslmode=require' --jobs 2 database.dump
有人可以帮助我使用 SSL 证书恢复 postgres 数据库吗?我尝试了以下方法,但没有用
pg_restore "host=hostname user=username dbname=database_name sslcert=sslcert.crt sslkey=sslkey.key sslrootcert=sslroot.pem sslmode=verify-full" -f filename
它给出以下错误
pg_restore: [archiver] could not open input file "host=hostname user=username dbname=database_name sslcert=sslcert.crt sslkey=sslkey.key sslrootcert=sslroot.pem sslmode=verify-full": No such file or directory
pg_restore
的参数不是连接字符串,而是要恢复的文件。您使用 -d
选项指定连接字符串:
pg_restore -d "host=..." filename
您可以通过这种方式指定任何参数。一个更详细的例子是:
pg_restore --format=custom -d "port=5432 host=<hostname>
user=<username> dbname=<dbname> sslrootcert=root.crt
sslkey=server.key sslcert=server.crt sslmode=verify-ca" ../filename.dump -v
请参考文档here。
@Laurenz Albe's 答案很正确。这只是包含 SSL 证书的答案的扩展版本。
pg_restore --format=custom -d "port=5432 host=<hostname>
user=<username> dbname=<dbname> sslrootcert=root.crt
sslkey=server.key sslcert=server.crt sslmode=verify-ca" ../filename.dump -v
请参考文档here。
我在我的数字海洋案例中使用了这个...
pg_restore --clean -d 'postgresql://USER:qfdvr2ata7opidy4@HOST:PORT/DATABASE?sslmode=require' --jobs 2 database.dump